function openGallery(url,winName,winParams) { //
	var theWindow = window.open(url,winName,winParams);
	if (theWindow) {
		theWindow.focus();
	}
}
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = -80;
		yOffset = -200;
		
		// 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("<div id='imagePreview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</div>");								 
		$("#imagePreview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.css("z-index", 1000)
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#imagePreview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#imagePreview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});
