//
// Preview Image Data Used with sizzle.js
// Uses the id previewDiv at bottom of page;
//

this.imagePreview = function(selector){
	
	var thumburl;
	var xOffset = 120;
	var yOffset = 30;
	var window_width = $(window).width();
	
	
	//$(window).resize(function(){ window_width = $(window).width(); });

		
	$(selector).mouseover(function(e){
		
/* 		var thumburl = this.src; */
		thumburl = this.src.replace('_tn', '_show');
		
		if( (e.pageX+450) > window_width){
			yOffset = -370;
		} else { yOffset = 30; }
										
		$("#previewDiv")
			.attr("src", thumburl)
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");			
    },

	function(){
		$("#previewDiv")
		.hide()
		.attr('src', '');
    });	
	$(selector).mousemove(function(e){
		$("#previewDiv")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
			
	});
	
	$(selector).mouseout(function(e){
		$("#previewDiv")
			.fadeOut("fast");
	});

$(selector).ontouch = function(e){

alert("hello");

}

};

/*  custom scripts here */

$(document).ready(function(){

	$("#previewDiv").hide();
	
	
	//imagePreview('#tb tr td img');
	
	//imagePreview('dl dd img');
	imagePreview('.thumbNail img');
	   
});
