Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(b,a){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper)}},true);this.element=this.subject=$(b);this.parent(a);var c=this.element.retrieve("wrapper");this.wrapper=c||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);return this},compute:function(e,d,c){var b=[];var a=2;a.times(function(f){b[f]=Fx.compute(e[f],d[f],c)});return b},start:function(b,e){if(!this.check(arguments.callee,b,e)){return this}this[e||this.options.mode]();var d=this.element.getStyle(this.margin).toInt();var c=this.wrapper.getStyle(this.layout).toInt();var a=[[d,c],[0,this.offset]];var g=[[d,c],[-this.offset,0]];var f;switch(b){case"in":f=a;break;case"out":f=g;break;case"toggle":f=(this.wrapper["offset"+this.layout.capitalize()]==0)?a:g}return this.parent(f[0],f[1])},slideIn:function(a){return this.start("in",a)},slideOut:function(a){return this.start("out",a)},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(a){this[a||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(a){return this.start("toggle",a)}});Element.Properties.slide={set:function(b){var a=this.retrieve("slide");if(a){a.cancel()}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},b))},get:function(a){if(a||!this.retrieve("slide")){if(a||!this.retrieve("slide:options")){this.set("slide",a)}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")))}return this.retrieve("slide")}};Element.implement({slide:function(d,e){d=d||"toggle";var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[(c)?"slideOut":"slideIn"](e);this.store("slide:flag",!c);a=true;break;default:b.start(d,e)}if(!a){this.eliminate("slide:flag")}return this}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(b,a){this.element=this.subject=$(b);this.parent(a);var d=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body)}var c=this.element;if(this.options.wheelStops){this.addEvent("start",function(){c.addEvent("mousewheel",d)},true);this.addEvent("complete",function(){c.removeEvent("mousewheel",d)},true)}},set:function(){var a=Array.flatten(arguments);this.element.scrollTo(a[0],a[1])},compute:function(e,d,c){var b=[];var a=2;a.times(function(f){b.push(Fx.compute(e[f],d[f],c))});return b},start:function(c,h){if(!this.check(arguments.callee,c,h)){return this}var e=this.element.getSize(),f=this.element.getScrollSize();var b=this.element.getScroll(),d={x:c,y:h};for(var g in d){var a=f[g]-e[g];if($chk(d[g])){d[g]=($type(d[g])=="number")?d[g].limit(0,a):a}else{d[g]=b[g]}d[g]+=this.options.offset[g]}return this.parent([b.x,b.y],[d.x,d.y])},toTop:function(){return this.start(false,0)},toLeft:function(){return this.start(0,false)},toRight:function(){return this.start("right",false)},toBottom:function(){return this.start(false,"bottom")},toElement:function(b){var a=$(b).getPosition(this.element);return this.start(a.x,a.y)}});var Asset=new Hash({javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);var b=new Element("script",{src:f,type:"text/javascript"});var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;b.addEvents({load:e,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){e()}}}).setProperties(d);if(Browser.Engine.webkit419){var c=(function(){if(!$try(a)){return}$clear(c);e()}).periodical(50)}return b.inject(g.head)},css:function(b,a){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head)},image:function(c,b){b=$merge({onload:$empty,onabort:$empty,onerror:$empty},b);var d=new Image();var a=$(d)||new Element("img");["load","abort","error"].each(function(e){var f="on"+e;var g=b[f];delete b[f];d[f]=function(){if(!d){return}if(!a.parentNode){a.width=d.width;a.height=d.height}d=d.onload=d.onabort=d.onerror=null;g.delay(1,a,a);a.fireEvent(e,a,1)}});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1)}return a.setProperties(b)},images:function(d,c){c=$merge({onComplete:$empty,onProgress:$empty},c);if(!d.push){d=[d]}var a=[];var b=0;d.each(function(f){var e=new Asset.image(f,{onload:function(){c.onProgress.call(this,b,d.indexOf(f));b++;if(b==d.length){c.onComplete()}}});a.push(e)});return new Elements(a)}});var GlobalBehaviour=new Class({expandableLinks:"",initialize:function(a){this.menuRoundedCorners();this.expandableSearchBox();this.expandableLinks=a;if(this.expandableLinks){this.expandLinks()}this.initializeAntispam();this.equalColumnHeights()},menuRoundedCorners:function(){var b=new Element("span",{"class":"leftBracket"});var a=new Element("span",{"class":"rightBracket"});$("menu").adopt(b,a)},expandableSearchBox:function(){if($("searchResults")&&$("search").value.length>0){$("searchResults").set("html",'<img src="images/ico-loader.gif" alt="Načítám ..." />')}else{if($("searchResults")){$("searchResults").set("html","")}}if($("search").value.length<1){$("searchBox").addClass("js")}$("searchBox").addEvents({mouseenter:function(){this.removeClass("js")},mouseleave:function(){if($("search").value.length<1){this.addClass("js")}}})},equalColumnHeights:function(){var b=$("sideContent");var a=$("content");if(a.getSize().y>b.getSize().y){b.setStyle("height",(a.getSize().y-a.getStyle("padding-bottom").toInt()))}},expandLinks:function(a){$$(".expandableLink").each(function(b){b.addEvents({mouseenter:function(){this.addClass("expandableLinkOver")},mouseleave:function(){this.removeClass("expandableLinkOver")},click:function(){location.href=this.getElement("a").href}})})},initializeAntispam:function(){if($("cislovka")){$("cislovka").value="5";$("cislovka").getParent().addClass("noDisplay")}}});var TabSwitcher=new Class({Implements:Options,options:{autoswitch:10000},switchTimer:null,initialize:function(a){this.setOptions(a);this.createNavigation();if(this.options.autoswitch>0){this.switchTimer=this.switchClaim.periodical(this.options.autoswitch)}this.attachSwitcher()},createNavigation:function(){var d=1000;var a=new Element("ol");var b=$("claimBar");var c=[];var e=new Element("li");e.addEvents({click:function(){$$("#claimBar li").each(function(f){f.removeClass("selected")});this.addClass("selected");$$("#claimBar img").each(function(f){f.set("tween",{duration:d}).fade(0);if(f.get("src")=="images/claim-"+this.get("text")+".jpg"){f.set("tween",{duration:d}).fade(1)}},this);$clear(this.retrieve("switcher"))},mouseenter:function(){this.addClass("pointed")},mouseleave:function(){this.removeClass("pointed")}});c.include($$("#claimBar img"));c.include(new Element("img",{src:"images/claim-2.jpg",alt:""}));c.include(new Element("img",{src:"images/claim-3.jpg",alt:""}));c.include(new Element("img",{src:"images/claim-4.jpg",alt:""}));c.each(function(g,f){if(f===0){a.adopt(e.clone().set({"class":"selected",html:f+1}).cloneEvents(e));b.adopt(g)}else{a.adopt(e.clone().set("html",f+1).cloneEvents(e));b.adopt(g.set("tween",{duration:1}).fade(0))}});b.adopt(a)},switchClaim:function(){var b=1000;var a=$$("#claimBar li.selected");a.removeClass("selected");$("claimBar").getElement("img[src=images/claim-"+a.get("text")+".jpg]").set("tween",{duration:b}).fade(0);if(a.get("text")<4){a.getNext().addClass("selected");$("claimBar").getElement("img[src=images/claim-"+a.getNext().get("text")+".jpg]").set("tween",{duration:b}).fade(1)}else{$("claimBar").getElement("li").addClass("selected");$("claimBar").getElement("img[src=images/claim-1.jpg]").set("tween",{duration:b}).fade(1)}},attachSwitcher:function(){$$("#claimBar li").each(function(a){a.store("switcher",this.switchTimer)},this)}});var ThermwetSavingsCalculator=new Class({Implements:Options,options:{cena_prumerna_energie:2800,ztrata_vetrani:0.5,ucinnost:0.82,delay:3000},switchTimer:null,initialize:function(b,a){this.setOptions(a);this.error=new Hash();this.formElement=b;this.winScroller=new Fx.Scroll(window);this.switchFields();this.images=[];this.images[0]=new Asset.image("images/ico-calculator-small.png",{"class":"loader",alt:""});this.images[1]=new Asset.image("images/ico-loader.gif",{alt:"Načítám ..."});$(this.formElement).addEvent("submit",function(c){c.preventDefault();this.runCalculation()}.bind(this));$$("input[name=calculation_type]").addEvent("click",function(){this.switchFields()}.bind(this))},calculate:function(){if($("calculation_type_1").checked){return this.calculatePrice()}else{return this.calculateCosts()}},calculateCosts:function(){return Math.round(this.naklady_rocni*this.options.ztrata_vetrani*this.options.ucinnost)},calculatePrice:function(){this.ztrata_vetrani_abs=this.ztrata_domu*this.options.ztrata_vetrani;this.ztrata_celkova=this.ztrata_domu*this.plocha_domu/1000;this.ztrata_celkova_vetrani=this.options.ztrata_vetrani*this.ztrata_celkova;this.naklady_predpokladane=this.options.cena_prumerna_energie*this.ztrata_celkova;this.naklady_vetrani=this.options.cena_prumerna_energie*this.ztrata_celkova_vetrani;this.uspora_tepelna=this.ztrata_celkova_vetrani/this.options.ucinnost;this.uspora_financni=this.naklady_vetrani*this.options.ucinnost;return Math.round(this.uspora_financni)},validate:function(){this.error.empty();if($("calculation_type_1").checked){if(this.isInteger($("plocha"))&&$("plocha").get("value").toInt()>0){this.plocha_domu=$("plocha").get("value").toInt()}else{this.error.set("plocha","Pole Obytná polocha domu musí být kladné celé číslo.")}if(this.isInteger($("ztrata"))&&$("ztrata").get("value").toInt()>0){this.ztrata_domu=$("ztrata").get("value").toInt()}else{this.error.set("ztrata","Pole Měrná vypočtená roční potřeba energie musí být kladné celé číslo.")}}else{if(this.isInteger($("cena"))&&$("cena").get("value").toInt()>0){this.naklady_rocni=$("cena").get("value").toInt()}else{this.error.set("cena","Pole Cena za roční vytápění objektu musí být kladné celé číslo.")}}},runCalculation:function(){var a="";this.validate();$(this.formElement).getElements("input").removeClass("errorValue");if(this.error.getLength()>0){this.error.each(function(c,b){$(b).addClass("errorValue");a+=c+"\n"});alert(a)}else{if(this.resultsBox){this.winScroller.toElement("calculatorResult").chain(function(){(function(){this.resultsBox.getElement("p span").set("html",this.calculate()+",- Kč")}.bind(this)).delay(500)}.bind(this))}else{this.resultsBox=new Element("div",{id:"calculatorResult","class":"calculatorResult calculatorLoading calculatorResultAdv",html:"<div></div>"});this.resultsBox.getElement("div").setStyle("height","230px").adopt(this.images[0],new Element("br"),this.images[1]);this.resultsBox.inject(this.formElement,"before");this.myVerticalSlide=new Fx.Slide(this.resultsBox);this.myVerticalSlide.hide();this.myVerticalSlide.slideIn().chain(function(){this.winScroller.toElement("calculatorResult")}.bind(this));(function(){this.resultsBox.removeClass("calculatorLoading");this.resultsBox.getElements("img").destroy();this.resultsBox.getElement("div").set("html","<p>Pořízením rekuperátorů ThermWet můžete ročně ušetřit až <span>"+this.calculate()+',- Kč</span> na výdajích za vytápění!<br />Začněte šetřit již dnes!</p><ul><li><a href="poptavkovy-formular" class="readMore">Mám zájem o cenovou kalkulaci</a></li><li><a href="kontakty" class="readMore">Mám zájem o další informace</a></li></ul>')}.bind(this)).delay(this.options.delay)}}},switchFields:function(){if($("calculation_type_1").checked){$("cena").getParent().addClass("noDisplay");$("plocha").getParent().removeClass("noDisplay");$("ztrata").getParent().removeClass("noDisplay")}else{$("plocha").getParent().addClass("noDisplay");$("ztrata").getParent().addClass("noDisplay");$("cena").getParent().removeClass("noDisplay")}},isEmpty:function(a){return((a.get("value")===null)||(a.get("value").length===0))},isInteger:function(a){return(/^-?[1-9]\d*$/).test(a.get("value"))}});window.addEvent("domready",function(){new GlobalBehaviour("expandableLink");if($("claimBar")){new TabSwitcher()}if($("calcForm")){savingsCalc=new ThermwetSavingsCalculator("calcForm")}});google.load("search","1");var webSearch;function addPaginationLinks(){var d=webSearch.cursor;var c=d.currentPageIndex;var a=new Element("ol",{"class":"paging"});d.pages.each(function(h,f){if(c==f){var e=new Element("em",{text:" "+h.label+" "});a.adopt(new Element("li").adopt(e))}else{var g=new Element("a",{href:"javascript:webSearch.gotoPage("+f+");",text:h.label});g.setStyle("margin-right","2px");a.adopt(new Element("li").adopt(g))}});var b=$("searchResults");b.adopt(a)}function searchComplete(){var b=$("searchResults");b.set("html","");var a=new Element("dl");if(webSearch.results&&webSearch.results.length>0){webSearch.results.each(function(g,e){var d=g;var c=new Element("dt");var h=new Element("a",{text:d.titleNoFormatting,href:d.unescapedUrl});var f=new Element("dd",{html:d.content+"<br /><span>"+d.url+"</span>"});c.adopt(h);a.adopt(c);a.adopt(f)});b.adopt(a);addPaginationLinks(webSearch)}else{b.set("text",'Na dotaz "'+$("search").value+'" nebylo nic nalezeno.')}}function OnLoad(){webSearch=new google.search.WebSearch();webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);webSearch.setSiteRestriction("thermwet.cz");webSearch.setSearchCompleteCallback(this,searchComplete,null);webSearch.execute($("search").value)}google.setOnLoadCallback(OnLoad);
/*
	Slimbox v1.71 - The ultimate lightweight Lightbox clone
	(c) 2007-2009 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/
var Slimbox=(function(){var F=window,n=Browser.Engine.trident4,u,g,G=-1,o,w,E,v,y,M,s,m={},t=new Image(),K=new Image(),I,a,h,q,J,e,H,c,A,L,x,i,d,C;F.addEvent("domready",function(){$(document.body).adopt($$(I=new Element("div",{id:"lbOverlay",events:{click:D}}),a=new Element("div",{id:"lbCenter"}),H=new Element("div",{id:"lbBottomContainer"})).setStyle("display","none"));h=new Element("div",{id:"lbImage"}).injectInside(a).adopt(q=new Element("div",{styles:{position:"relative"}}).adopt(J=new Element("a",{id:"lbPrevLink",href:"#",events:{click:B}}),e=new Element("a",{id:"lbNextLink",href:"#",events:{click:f}})));c=new Element("div",{id:"lbBottom"}).injectInside(H).adopt(new Element("a",{id:"lbCloseLink",href:"#",events:{click:D}}),A=new Element("div",{id:"lbCaption"}),L=new Element("div",{id:"lbNumber"}),new Element("div",{styles:{clear:"both"}}))});function z(){var N=F.getScroll(),O=F.getSize();$$(a,H).setStyle("left",N.x+(O.x/2));if(v){I.setStyles({left:N.x,top:N.y,width:O.x,height:O.y})}}function l(N){["object",n?"select":"embed"].forEach(function(P){Array.forEach(document.getElementsByTagName(P),function(Q){if(N){Q._slimbox=Q.style.visibility}Q.style.visibility=N?"hidden":Q._slimbox})});I.style.display=N?"":"none";var O=N?"addEvent":"removeEvent";F[O]("scroll",z)[O]("resize",z);document[O]("keydown",p)}function p(O){var N=O.code;return u.closeKeys.contains(N)?D():u.nextKeys.contains(N)?f():u.previousKeys.contains(N)?B():false}function B(){return b(w)}function f(){return b(E)}function b(N){if(N>=0){G=N;o=g[N][0];w=(G||(u.loop?g.length:0))-1;E=((G+1)%g.length)||(u.loop?0:-1);r();a.className="lbLoading";m=new Image();m.onload=k;m.src=o}return false}function k(){a.className="";d.set(0);h.setStyles({backgroundImage:"url("+o+")",display:""});q.setStyle("width",m.width);$$(q,J,e).setStyle("height",m.height);A.set("html",g[G][1]||"");L.set("html",(((g.length>1)&&u.counterText)||"").replace(/{x}/,G+1).replace(/{y}/,g.length));if(w>=0){t.src=g[w][0]}if(E>=0){K.src=g[E][0]}M=h.offsetWidth;s=h.offsetHeight;var P=Math.max(0,y-(s/2)),N=0,O;if(a.offsetHeight!=s){N=i.start({height:s,top:P})}if(a.offsetWidth!=M){N=i.start({width:M,marginLeft:-M/2})}O=function(){H.setStyles({width:M,top:P+s,marginLeft:-M/2,visibility:"hidden",display:""});d.start(1)};if(N){i.chain(O)}else{O()}}function j(){if(w>=0){J.style.display=""}if(E>=0){e.style.display=""}C.set(-c.offsetHeight).start(0);H.style.visibility=""}function r(){m.onload=$empty;m.src=t.src=K.src=o;i.cancel();d.cancel();C.cancel();$$(J,e,h,H).setStyle("display","none")}function D(){if(G>=0){r();G=w=E=-1;a.style.display="none";x.cancel().chain(l).start(0)}return false}Element.implement({slimbox:function(N,O){$$(this).slimbox(N,O);return this}});Elements.implement({slimbox:function(N,Q,P){Q=Q||function(R){return[R.href,R.title]};P=P||function(){return true};var O=this;O.removeEvents("click").addEvent("click",function(){var R=O.filter(P,this);return Slimbox.open(R.map(Q),R.indexOf(this),N)});return O}});return{open:function(P,O,N){u=$extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeTransition:false,initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},N||{});x=new Fx.Tween(I,{property:"opacity",duration:u.overlayFadeDuration});i=new Fx.Morph(a,$extend({duration:u.resizeDuration,link:"chain"},u.resizeTransition?{transition:u.resizeTransition}:{}));d=new Fx.Tween(h,{property:"opacity",duration:u.imageFadeDuration,onComplete:j});C=new Fx.Tween(c,{property:"margin-top",duration:u.captionAnimationDuration});if(typeof P=="string"){P=[[P,O]];O=0}y=F.getScrollTop()+(F.getHeight()/2);M=u.initialWidth;s=u.initialHeight;a.setStyles({top:Math.max(0,y-(s/2)),width:M,height:s,marginLeft:-M/2,display:""});v=n||(I.currentStyle&&(I.currentStyle.position!="fixed"));if(v){I.style.position="absolute"}x.set(0).start(u.overlayOpacity);z();l(1);g=P;u.loop=u.loop&&(g.length>1);return b(O)}}})();Slimbox.scanPage=function(){$$(document.links).filter(function(a){return a.rel&&a.rel.test(/^lightbox/i)}).slimbox({},null,function(a){return(this==a)||((this.rel.length>8)&&(this.rel==a.rel))})};window.addEvent("domready",Slimbox.scanPage);