jQuery(function($) {
                    	
	var magnified = null;
	$("div#indexProductList").css("position", "relative");
	
	$("img.item_thumb_image").each( function(i) {
    /*
		$(this).bind( "mouseover", function() {
			magnified = $(this).clone();
			$(magnified).removeAttr("width");
			$(magnified).removeAttr("height");
			$(magnified).hide();
			$("div#indexProductList").append( magnified );
			
			var parentOffset = $("div#indexProductList").offset();
			var offset = $(this).offset();
			var css = {};
			css.position = "absolute";
			css.top = offset.top - parentOffset.top - $(this).height();
			if( i % 4 < 2 ) {
				css.right = 0;
			} else {
				css.left = 0;	
			}
			$(magnified).css( css );
			$(magnified).fadeIn("fast");
		
		});	
        */
        $(this).hover( 
        
        function() {
			magnified = $(this).clone();
            $(magnified).attr({id:"magnified"});
			$(magnified).removeAttr("width");
            if($(magnified).height() > 400 ) {
                $(magnified).height("400px");
            }
			$(magnified).hide();
			//$("div#indexProductList").append( magnified );
			$("body").append( magnified );
			var parentOffset = $("div#indexProductList").offset();
			var offset = $(this).offset();
			var css = {};
			css.position = "absolute";
			//css.top = offset.top - parentOffset.top - $(this).height();
            css.top = offset.top - $(magnified).height()/2 + $(this).height()/2;
			/*
            if( i % 4 < 2 ) {
				css.right = "20px";
			} else {
				css.left = "20px";	
			}*/
            if( i % 4 < 2 ) {
                css.left = (offset.left + $(this).width() + 20) + "px";
            } else {
                css.left = ( offset.left - $(magnified).width() - 20  ) + "px";
            }
			$(magnified).css( css );
            $(magnified).css({"z-index":1000});
            //$(magnified).center({horizontal:false});
			$(magnified).fadeIn("fast");
		
		},
        
        function() {
        if( magnified !== null ) {
			$(magnified).hide();
			magnified = null;	
		}
        }
        
        );							
	});
	
	/*
	$("img.item_thumb_image).bind( "mouseout", function() {
		if( magnified !== null ) {
			$(magnified).hide();
			magnified = null;	
		}
	});
    */
	
});