/*!
 * mCarousel jQuery Plugin v1.0
 * Copyright 2011, pit69
 */
(function(b){b.fn.mcarousel=function(){var a,i,d,j,g,c,h,l,f;function m(){c=b("#"+a+"-wrap").width();b("."+a+"-elem").css({left:c,top:parseInt(0.5*(i-j))+10});b("#"+a+"-left").css({left:parseInt(0.5*(c-3*d))-30});b("#"+a+"-center").css({width:g,height:h,left:parseInt(0.5*(c-g)),top:parseInt(0.5*(i-h))});b("#"+a+"-right").css({left:parseInt(0.5*(c+d))+30});b("#"+a+"-prev").css({left:parseInt(0.5*(c-g))-80,top:parseInt(0.5*h)-100});b("#"+a+"-next").css({left:parseInt(0.5*(c+g))-44,top:parseInt(0.5* h)-100})}function n(){k||(k=true,b("."+a+"-descr").css("display","none"),b("#"+a+"-center").animate({width:d,height:j,left:parseInt(0.5*(c-d)),top:parseInt(0.5*(i-j))+10},l,"swing",function(){e.children("li").last().insertBefore(e.children("li").first()).css({left:-d,"z-index":2}).animate({left:parseInt(0.5*(c-3*d))-30},f,"swing",function(){b(this).attr("id",a+"-left")});b("#"+a+"-left").css("z-index",3).animate({left:parseInt(0.5*(c-d))},f,"swing",function(){b(this).attr("id",a+"-center").animate({width:g, height:h,left:parseInt(0.5*(c-g)),top:parseInt(0.5*(i-h))},l,"swing",function(){b(this).children("."+a+"-descr").fadeIn(f,function(){k=false})})});b(this).css("z-index",2).animate({left:parseInt(0.5*(c+d))+30},f,"swing",function(){b(this).attr("id",a+"-right")});b("#"+a+"-right").css("z-index",1).animate({left:c+30},f,"swing",function(){b(this).removeAttr("id")})}))}function o(){k||(k=true,b("."+a+"-descr").css("display","none"),b("#"+a+"-center").animate({width:d,height:j,left:parseInt(0.5*(c-d)), top:parseInt(0.5*(i-j))+10},l,"swing",function(){b("#"+a+"-right").next().css({left:c,"z-index":2}).animate({left:parseInt(0.5*(c+d))+30},f,"swing",function(){b(this).attr("id",a+"-right")});b("#"+a+"-right").css("z-index",3).animate({left:parseInt(0.5*(c-d))},f,"swing",function(){b(this).attr("id",a+"-center").animate({width:g,height:h,left:parseInt(0.5*(c-g)),top:parseInt(0.5*(i-h))},l,"swing",function(){b(this).children("."+a+"-descr").fadeIn(f,function(){k=false})})});b(this).css("z-index",2).animate({left:parseInt(0.5* (c-3*d))-30},f,"swing",function(){b(this).attr("id",a+"-left")});b("#"+a+"-left").css("z-index",1).animate({left:-d-30},f,"swing",function(){b(this).removeAttr("id")}).insertAfter(e.children("li").last())}))}var e=this,k=false;a="mcarousel";c=0;i=500;g=640;h=500;d=480;j=400;f=300;l=150;e.children("li").length>3&&(e.attr("id",a).wrap('<div id="'+a+'-wrap"></div>').append('<div id="'+a+'-prev"></div><div id="'+a+'-next"></div>'),e.parent().height(i),e.children("li").attr("class",a+"-elem").css({width:d, height:j}),e.children("li").children("div").attr("class",a+"-descr").css({width:460,left:parseInt(0.5*(g-460-40))}),e.children("li:eq(0)").attr("id",a+"-left").css("z-index",2),e.children("li:eq(1)").attr("id",a+"-center").css("z-index",3),e.children("li:eq(2)").attr("id",a+"-right").css("z-index",2),e.children("li:eq(1)").children("."+a+"-descr").css("display","block"),m(),b("#"+a+"-prev").bind("click",n),b("#"+a+"-next").bind("click",o),b(window).bind("resize",m))}})(jQuery);
