(function($){$.fn.extend({hoverizeList:function(options){positionTab={};
var calculatePositionTab=function(elements){var cpt=0;
var tot=elements.length;
$.each(elements,function(){var img=$(this).find('img:first').get(0);
var imgWidth,imgHeigth;
imgWidth=$(img).width();
imgHeight=$(img).height();
var pos=$(this).position();
var width,height,left,top;
width=50;
height=Math.floor(imgHeight*width/imgWidth);
left=Math.floor(pos.left-imgWidth-10);
if(tot>1){top=Math.floor(pos.top-(imgHeight-$(this).height())*cpt/(tot-1));
}else{top=Math.floor(pos.top);
}
var data=new Array();
data[0]=left;
data[1]=top;
data[2]=width;
data[3]=height;
positionTab[$(img).attr('src')]=data;
cpt++;
});
}
return this.each(function(){var div=$('<div></div>');
$(document.body).append(div);
$(div).css({position:'absolute','top':'0px','left':'0px'});
var conteneur=$(this).find('ul:first');
var elements=conteneur.find('li');
calculatePositionTab(elements);
$.each(elements,function(){var img=$(this).find('img').clone();
$(this).mouseover(function(e,fadeIn){data=positionTab[img.attr('src')];
$(img).removeClass('hidden');
var _div=$(div);
if(fadeIn){_div.hide();
}
_div.css({left:data[0],top:data[1]}).html(img);
if(fadeIn){_div.fadeIn(1000);
}});
});
if(typeof opera=='object'){var cpt=0;
var n=$("li img").length;
$("li img").each(function(){$(this).load(function(){cpt++;
if(cpt==n){calculatePositionTab(elements);
$(elements[0]).trigger('mouseover',true);
}});
});
}
$(window).resize(function(){calculatePositionTab(elements);
$(elements[0]).trigger('mouseover',true);
});
$(this).mouseout(function(e){$(elements[0]).mouseover();
});
$(elements[0]).trigger('mouseover',true);
});
}});
})(jQuery);




J(window).load(function() {
J(".hoverizeList").hoverizeList();
});


