/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = -23;
		yOffset = 2;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});

// Text efect
$(document).ready(function () {
	
	var colour = $("#overlay");
	var content = $("#hover");
	
	content.hide();
	colour.hide();	
		
	$("#container").hover(function() {
		content.stop().show().css({ "bottom" : "-450px" }).animate({bottom : 0}, 300);
		colour.stop().fadeTo(500, .7)
	}
	,function() {
		content.stop().animate({bottom : -450}, 300);
		colour.stop().fadeTo(500, 0)
	});

	// 2 Image ----------------------------------------------------------------------------------------
	var colour1 = $("#overlay1");
	var content1 = $("#hover1");
	
	
	content1.hide();
	colour1.hide();	
		
	$("#container1").hover(function() {
		content1.stop().show().css({ "bottom" : "-450px" }).animate({bottom : 0}, 300);
		colour1.stop().fadeTo(500, .7)
	}
	,function() {
		content1.stop().animate({bottom : -450}, 300);
		colour1.stop().fadeTo(500, 0)
	});

	// 3 image ----------------------------------------------------------------------------------------

	var colour2 = $("#overlay2");
	var content2 = $("#hover2");
	
	content2.hide();
	colour2.hide();	
		
	$("#container2").hover(function() {
		content2.stop().show().css({ "bottom" : "-450px" }).animate({bottom : 0}, 300);
		colour2.stop().fadeTo(500, .7)
	}
	,function() {
		content2.stop().animate({bottom : -450}, 300);
		colour2.stop().fadeTo(500, 0)
	});




       ////////////////////

      var colour3 = $("#overlay3");
	var content3 = $("#hover3");

	content3.hide();
	colour3.hide();

	$("#container3").hover(function() {
		content3.stop().show().css({ "bottom" : "-450px" }).animate({bottom : 0}, 300);
		colour3.stop().fadeTo(500, .7)
	}
	,function() {
		content3.stop().animate({bottom : -450}, 300);
		colour3.stop().fadeTo(500, 0)
	});
});
