function changeHeaderImg(a){activedot=$(".headernav .dot.active");activeCdotimg=activedot.children("img");newdot=$(".headernav .dot:eq("+a+")");newdotimg=newdot.children("img");rel=newdot.attr("rel");relarr=rel.split("#");newsrc=relarr[0];newcolor=relarr[1];newheaderimg='<img class="headerimg" src="'+newsrc+'" />';limg=new Image;limg.src=newsrc;oldheaderimg=$(".headerimg");newheaderimg=$("#headerimglayer").prepend(newheaderimg);$(limg).one("load",function(){activedot.removeClass("active");newdot.addClass("active");$(".headerimg:last").fadeOut("slow",function(){$(this).remove()});$(".headerimg:first").fadeIn("slow");$("#pageheader").animate({backgroundColor:"#"+newcolor},"slow");activehimg=a});if($.browser.msie&&limg.complete){$(limg).trigger("load")}}function himgSlider(){if(activehimg<himgctr-1){changeHeaderImg(activehimg+1)}else{changeHeaderImg(0)}himgtout=setTimeout("himgSlider()",5e3)}function headani(){himgctr=$(".headernav .dot").length;$(".headernav .dot").click(function(){if(himgtout!=undefined){clearTimeout(himgtout)}ind=$(".headernav .dot").index($(this));changeHeaderImg(ind)});himgtout=setTimeout("himgSlider()",5e3)}function changeProjectImg(a){activedot=$(".project .dots a.active");activedotimg=activedot.children("img");newdot=$(".project .dots a:eq("+a+")");newdotimg=newdot.children("img");rel=newdot.attr("rel");newsrc=rel;newheaderimg='<div class="el"><table><tr><td><img src="'+newsrc+'" /></td></tr></table></div>';limg=new Image;limg.src=newsrc;oldheaderimg=$(".project .galerie .container .el");newheaderimg=$(".project .galerie .container ").prepend(newheaderimg);$(limg).one("load",function(){if($.browser.msie&&$.browser.version<7){activedotimg.attr("style",activedotimg.attr("style").replace("dot_a.png","dot.png"));newdotimg.attr("style",newdotimg.attr("style").replace("dot.png","dot_a.png"))}else{activedotimg.attr("src",activedotimg.attr("src").replace("dot_a.png","dot.png"));newdotimg.attr("src",newdotimg.attr("src").replace("dot.png","dot_a.png"))}activedot.removeClass("active");newdot.addClass("active");oldheaderimg.fadeOut("slow",function(){$(this).remove()});newheaderimg.fadeIn("slow");activepimg=a});if($.browser.msie&&limg.complete){$(limg).trigger("load")}}function prevProjectImg(){clearTimeout(pimgtout);if(activepimg>0){changeProjectImg(activepimg-1)}else{changeProjectImg(pimgctr-1)}}function nextProjectImg(){clearTimeout(pimgtout);if(activepimg<pimgctr-1){changeProjectImg(activepimg+1)}else{changeProjectImg(0)}}function pimgSlider(){if(activepimg<pimgctr-1){changeProjectImg(activepimg+1)}else{changeProjectImg(0)}pimgtout=setTimeout("pimgSlider()",4e3)}function projani(){activepimg=0;pimgtout=undefined;pimgctr=$(".project .dots a").length;$(".project .dots a").click(function(){if(pimgtout!=undefined){clearTimeout(pimgtout)}ind=$(".project .dots a").index($(this));changeProjectImg(ind)});pimgtout=setTimeout("pimgSlider()",4e3)}function projects(){projani();$(".projects .categories li a").click(function(){clearTimeout(pimgtout);cid=$(this).attr("rel");$(".projects .categories li a.active").removeClass("active");$(this).addClass("active");$(".projects .project > *").remove();$.get(host+"ajax_projcat.php?id="+cid,function(a){ddom=$(a);fimgsrc=ddom.find(".galerie .container .el img").attr("src");limg=new Image;limg.src=fimgsrc;ddom.find(".galerie").hide();ddom.appendTo($(".projects .project"));$(limg).one("load",function(){$(".projects .project .galerie").fadeIn("fast")});if($.browser.msie&&limg.complete){$(limg).trigger("load")}projani()})});$(".project .projnavi li").live("click",function(){clearTimeout(pimgtout);pid=$(this).find("a").attr("rel");$(this).addClass("active").siblings().removeClass("active");$(".project .projcont > *").remove();$.get(host+"ajax_proj.php?id="+pid,function(a){ddom=$(a);ddom.hide();ddom.appendTo($(".projects .project .projcont"));fimgsrc=ddom.find(".container .el img").attr("src");limg=new Image;limg.src=fimgsrc;$(limg).one("load",function(){$(".projects .project .galerie").fadeIn("fast")});if($.browser.msie&&limg.complete){$(limg).trigger("load")}projani()})})}function prevGalImg(){c=$(this).parents(".container");ctr=c.data("ctr");a=c.data("a");if(a<=0){a=ctr-1}else{a--}c.find(".el:not(:eq("+a+"))").fadeOut();c.find(".el:eq("+a+")").fadeIn();c.data("a",a)}function nextGalImg(){c=$(this).parents(".container");ctr=c.data("ctr");a=c.data("a");if(a>=ctr-1){a=0}else{a++}c.find(".el:not(:eq("+a+"))").fadeOut();c.find(".el:eq("+a+")").fadeIn();c.data("a",a)}function initGalerie(){$(".pcontent .galerie .container").each(function(){t=$(this);ctr=t.find(".el").length;if(ctr>1){t.data("ctr",ctr);t.data("a",0);t.append('<div class="navi"><a class="prev"></a><a class="next"></a></div>');t.find(".prev").click(prevGalImg);t.find(".next").click(nextGalImg)}})}function blurInput(a,b){if(a.value==""){a.value=b}}function focusInput(a,b){if(a.value==b){a.value=""}}function kontakt(a){form=$(a);form.submit(function(b){var c=$(this);if(!b.isDefaultPrevented()){b.preventDefault();$.ajax({url:host+"ajaxKontakt.php",data:c.serialize(),dataType:"json",type:"POST",success:function(b){if(b.success){$(a+" .msg").removeClass("error").addClass("success").html(b.text);$(a+" input:not(.submit), "+a+" textarea").val("")}else{$(a+" .msg").addClass("error").html(b.text)}}})}})}function slider(a){$(a).prepend('<div class="nav"><a class="prev" /><a class="next" /></div>');$(a+" .prev").fadeTo("normal",.3);var b=960;maxels=4;$(a+" .next").click(function(){slider=$(this).parent().siblings(".container").children(".slider");w=slider.children(".el").width()+parseInt(slider.children(".el").css("marginRight"));b=maxels*w;ol=parseInt(slider.css("left"));nl=ol-b;fl=slider.children(".el").length*w;if(-nl>=fl-b){nl=-(fl-b);$(this).fadeTo("normal",.3).css("cursor","default")}$(this).siblings(".prev").fadeTo("normal",1).css("cursor","pointer");slider.animate({left:nl+"px"},"normal")});$(a+" .prev").click(function(){slider=$(this).parent().siblings(".container").children(".slider");w=slider.children(".el").width()+parseInt(slider.children(".el").css("marginRight"));ol=parseInt(slider.css("left"));nl=ol+b;if(nl>=0){nl=0;$(this).fadeTo("normal",.3).css("cursor","default")}$(this).siblings(".next").fadeTo("normal",1).css("cursor","pointer");slider.animate({left:nl+"px"},"normal")})}function docRdy(){headani();$(".jsshow").show();kontakt(".contact form");projects();$("#fixednav ul li a").click(function(){href=$(this).attr("href");harr=href.split("#");hash=harr[1];sel="#"+hash;if($(sel).length>0){st=$(sel).offset().top;if($.browser.opera){$("html").animate({scrollTop:st+"px"},500)}else{$("html, body").animate({scrollTop:st+"px"},500)}return false}});$("#fixednav").mouseenter(function(){$("#fixednav ul").slideDown("fast",function(){$(this).stop()})});$("#fixednav").mouseleave(function(){$("#fixednav ul").slideUp("fast")});slider(".news .newscont");$(".latest-projects .left img").qtip({style:{name:"light",tip:true,border:{width:1,radius:2,color:"#000"},padding:10,textAlign:"center",tip:true},position:{target:"mouse",corner:{target:"rightTop",tooltip:"bottomLeft"}}})}$(docRdy);var activepimg;var pimgctr;var pimgtout;var activehimg=0;var himgctr=0;var himgtout
