projects={};projects.init=function(){$(".control").show();$(".close").hide();$(".projekty img").not(".large").parent().find(".larger").hide();$(".next").click(function(a){projects.toggle(this,"next",-600);a.preventDefault()});$(".prev").click(function(a){projects.toggle(this,"prev",600);a.preventDefault()});$(".control").hover(function(){$(".control").stop(false,true);$(this).animate({opacity:1})},function(){$(".control").stop(false,true);$(this).animate({opacity:.7})});$(".larger").click(function(a){var b=$(this).parent().parent();b.addClass("active").find(".controls").hide();b.animate({height:b.find("img").css("height")});b.css("z-index","10001").parent().find(".left-box").css("z-index","10001").find(".zaslepka1").fadeIn().parent().find(".zaslepka2").show().parent().parent().find(".close").fadeIn();foldpage.showOverlay();$(".overlay").click(hideOverlayHandler=function(){projects.closeProject()});a.preventDefault()});$(".projekty .right-box .close").click(function(a){projects.closeProject();a.preventDefault()});$(".descr").click(function(a){var b=$(this).parent().parent();b.addClass("active").find(".controls").hide();b.find(".description").show();b.animate({height:400+b.find(".description").outerHeight()});b.css("z-index","10001").parent().find(".left-box").css("z-index","10001").find(".zaslepka1").fadeIn().parent().find(".zaslepka2").show().parent().parent().find(".close").fadeIn();foldpage.showOverlay("project");$(".overlay").click(hideOverlayHandler=function(){projects.closeProject()});a.preventDefault()})};projects.closeProject=function(){var a=$(".projekty .active");$(".active .close").fadeOut();a.parent().find(".zaslepka1").fadeOut();foldpage.hideOverlay();$(".active .controls").fadeIn();a.stop(false,false).animate({height:400},function(){a.css("z-index","300").removeClass("active").parent().find(".left-box").css("z-index","300").parent().find(".zaslepka2").hide();$(".overlay").unbind("click");$(".description").hide()})};projects.toggle=function(a,b,c){var d=$(a).attr("id");var e=$("."+d+" .pic img");e.stop(true,true);e.each(function(a){if(b=="prev")var d=a==0?e[e.length-1]:e[a-1];else if(b=="next")var d=a==e.length-1?e[0]:e[a+1];else if(b=="show"){var f=a==e.length-1?number-2:a+number-1;if(f==e.length)f=a-1;var d=e[f]}var g=$(d).clone();g.css({right:c,left:"auto"});g.appendTo($(this).parent());$(this).animate({left:c},function(){$(this).remove()});$(g).animate({right:parseInt($(this).css("left"),10)})});var f=b=="next"?$("."+d+" .rest1 img"):$("."+d+" .main img").last();if(f.attr("class")==="large")$(a).parent().find(".larger").show();else $(a).parent().find(".larger").hide()};projects.show=function(a,b){for(i=0;i<b;i++){projects.toggle(a,"next",-600)}}
