/*
 * 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 = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$j("img.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		c = ""; // THIS SETS TITLE TO BE EMPTY
		$j("body").append("<p id='preview'><img src='"+ this.alt +"' alt='Image preview' />"+ c +"</p>");								 
		$j("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$j("#preview").remove();
    });	
	$j("img.preview").mousemove(function(e){
		$j("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

this.imageZoom = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	
	$j("img.zoom:first").load(function () {

		this.t = this.title;
		this.title = "";	
		$j("#zoom").remove();	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		c = ""; // THIS SETS TITLE TO BE EMPTY 
		$j("#right").append("<img id='zoom' src='"+ this.alt +"' alt='Image zoom' />"+ c +"");								 
		$j("#zoom")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
});	
	$j("img.zoom").hover(function(e){
		this.t = this.title;
		this.title = "";	
		$j("#zoom").remove();	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		c = ""; // THIS SETS TITLE TO BE EMPTY 
		$j("#right").append("<img id='zoom' src='"+ this.alt +"' alt='Image zoom' />"+ c +"");								 
		$j("#zoom")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
    });	
	$j("img.zoom").mousemove(function(e){
		$j("#zoom")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

this.imageLoad = function(){
    $j("img.zoom").ready(function(){
        this.t = this.title;
    		this.title = "";
        $j("#right").append("<img id='zoom' src='"+ this.alt +"' alt='Image zoom' />"+ c +"");
    });
};

// starting the script on page load
$j(document).ready(function(){
//	imagePreview();
	imageZoom(); 	

$j("ul.thumb li").hover(function() {
	$j(this).css({'z-index' : '10'});
	$j(this).find('img.preview').addClass("hover").stop()
		.animate({
			marginTop: '-130px', 
			marginLeft: '-130px', 
			top: '50%', 
			left: '50%', 
			width: '250px', 
			height: '250px'
		}, 200);
	
	} , function() {
	$j(this).css({'z-index' : '0'});
	$j(this).find('img.preview').removeClass("hover").stop()
		.animate({
			marginTop: '0', 
			marginLeft: '0',
			top: '0', 
			left: '0', 
			width: '100px', 
			height: '100px'
		}, 400);
});

});


  $j(function(){
  $j("#menu_left ul ul").hide();
  $j("#menu_left ul .active").parents().show();
  $j("#menu_left ul li.submenu > a").click(function(){ $j(this).parent('li').find('ul').toggle("slow"); return false;});
  });




