/*
 * 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 */
    var LI_CSS_CLASS = ".imagelarge";
    var IMG_CSS_CLASS = ".ImageRelatedLarge";
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		if ($(this).find(LI_CSS_CLASS).length > 0) {
		 $(this).find(LI_CSS_CLASS).each(function(i) {
//			console.log("hello");
			if ($(this).find(IMG_CSS_CLASS).length > 0) {
//				console.log($(this).find(IMG_CSS_CLASS).width());
				$(this).width($(this).find(IMG_CSS_CLASS).width()+2);
				$(this).show();
			}
		 });
		}

    },
    function(){
		if ($(this).find(LI_CSS_CLASS).length > 0) {
		 $(this).find(LI_CSS_CLASS).each(function(i) {
//			console.log("bye");
			if ($(this).find(IMG_CSS_CLASS).length > 0) {
				$(this).hide();
			}
		 });
		}
    });	
	
		
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});