//This section implements the mouseover feature on images
/*$(document).ready(function() {		
		$("#thumbnail img").hover(function(e){
			$("#imgMouseOver").css("top",(e.pageY+5)+"px")
							 .css("left",(e.pageX+5)+"px")					
							 .html("<img src="+ $(this).attr("alt") +" alt='Large Image' /><br/>"+$(this).attr("rel")+"<br />Click to view in full screen")
							 .fadeIn("slow");
		}, function(){
			$("#imgMouseOver").fadeOut("fast");
		});		
		
	});
*/
//This section implements clicking the link functionality
jQuery.fn.center = function () 
{
	this.css("position","absolute");
	this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	return this;
}

$(document).ready(function() 
{
	$("#thumbnail img").click(function(e)
	{
	
		$("#background").css({"opacity" : "0.7"})
						.fadeIn("slow");			
					
		$("#imgFullScreen").html("<img src='"+$(this).parent().attr("href")+"' alt='"+$(this).attr("alt")+"' width='400' height='300' /><br/>"+$(this).attr("rel")
					+"<br /><span style='font-size:14.0pt; font-weight:bold'>Click to return to gallery</span>")
				   .center()
				   .fadeIn("slow");			
		//$("#thumbnail").css({"opacity" : "0.25"})
		//				.fadeIn("slow");
		$("#thumbnail").hide(1000);
		return false;
	});
		
	$(document).keypress(function(e){
		if(e.keyCode==27){
			$("#background").fadeOut("slow");
			$("#imgFullScreen").fadeOut("slow");
		//	$("#thumbnail").css({"opacity" : "1.00"})
		//				.fadeIn("slow");			
			$("#thumbnail").show(1000);
		}
	});
	
	$(document).click(function(){
		$("#background").fadeOut("slow");
		$("#imgFullScreen").fadeOut("slow");
		//$("#thumbnail").css({"opacity" : "1.00"})
		//			.fadeIn("slow");			
		$("#thumbnail").show(1000);
	});
	
	$("#imgFullScreen").click(function(){
		$("#background").fadeOut("slow");
		$("#imgFullScreen").fadeOut("slow");
		//$("#thumbnail").css({"opacity" : "1.00"})
		//			.fadeIn("slow");		
		$("#thumbnail").show(1000);
	});
});

