﻿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 */
	
	$("input.preview").hover(function(e){
		$("body").append("<p id='vehiculopreview'><img style=\"height: 230px\" src='../images/vehiculos"+ this.getAttribute("previewsrc") +"' /></p>");								 
		$("#vehiculopreview")
		    
		    .css("position","absolute")
		    .css("top",(e.pageY - 125 ) + "px")
		    .css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		$("#vehiculopreview").remove();
    });	
    /*
	$("input.preview").mousemove(function(e){
		$("#vehiculopreview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
	*/
	
};
// starting the script on page load
$(document).ready(function(){
	imagePreview();
});