function showSearch(){new Effect.Parallel([new Effect.Appear("suche",{sync:true,duration:2.1}),new Effect.SlideDown("suche",{sync:true,duration:2.1})],{});return false}function hideSearch(){new Effect.Parallel([new Effect.SlideUp("suche",{sync:true,duration:2.1}),new Effect.Fade("suche",{sync:true,duration:2.1})],{});return false}function showBox(f,a){var b=$(f);var c=b.down(".box")?b.down(".box"):b;if($(a)){var e=Position.cumulativeOffset($(a));b.setStyle({position:"absolute",display:"block",visibility:"hidden",left:e.left+"px",top:e.top+"px"});var d=c.getHeight();if(d){b.setStyle({height:d+"px",width:c.getWidth()+"px",top:(parseInt(b.getStyle("top"))-d)+"px",visibility:"visible",display:"none"})}}new Effect.Parallel([new Effect.Appear(b,{sync:true,duration:2.1}),new Effect.SlideDown(b,{sync:true,duration:2.1})],{});return false}function hideBox(a){new Effect.Parallel([new Effect.SlideUp(a,{sync:true,duration:2.1}),new Effect.Fade(a,{sync:true,duration:2.1})],{});return false}function switchImg(a,b){document.getElementById(a).removeAttribute("src");document.getElementById(a).setAttribute("src","/img/"+a+"_"+b+".gif")}function inputFocus(b,a){if($F(b)==a){$(b).value=""}}function inputBlur(b,a){if($F(b)==""){$(b).value=a}}function value_clean(a,b){var c=$(a);if(b&&b==c.value){c.setAttribute("value","")}}function changeProductNav(a){var e=$("product_background");var b=new Array("0x0","149x0","298x0","0x128","149x128","298x128");for(var d=1;d<b.length;d++){var c=$("sortiment_navi_"+d);if(c){if(d==a){c.style.display="block";var g=b[d];var f=g.split("x");e.style.display="block";e.style.left=String(f[0])+"px";e.style.top=String(f[1])+"px"}else{c.style.display="none"}}}}function switchBackground(a,b){var c=document.getElementById(a);if(c){c.style.backgroundImage='url("'+b+'")'}}function changeWorldwideNavi(a,b){var h=parseInt(a);switchBackground(b,"/img/karte_"+h+".gif");var c=1;var e;while(e=document.getElementById(b+"_point_"+c)){var g;if(g=document.getElementById(b+"_li_"+c)){g.removeAttribute("class")}e.removeAttribute("class");e.style.color="E2001A";c++}var f=document.getElementById(b+"_li_"+h);var d=document.getElementById(b+"_point_"+h);if(f&&d){if(a>0){f.setAttribute("class","current");d.setAttribute("class","tesa_blue");d.style.color="6C77AB"}}}function redirectSelect(a){document.location.href=a[a.selectedIndex].value}function change_tab(a){var b="tab_container_"+a+" clearfix";document.getElementById("tab_container_list").removeAttribute("class");document.getElementById("tab_container_list").setAttribute("class",b);for(i=1;i<=4;i++){if(i==a){document.getElementById("content_inner_"+i).style.display="block";document.getElementById("tab_nav_"+i).style.backgroundPosition="0 -150px";document.getElementById("tab_nav_"+i).style.borderBottom="0";document.getElementById("tab_link_"+i).style.borderBottom="0";document.getElementById("tab_link_"+i).style.backgroundPosition="100% -150px";document.getElementById("tab_link_"+i).style.color="#6D75AA";document.getElementById("tab_link_"+i).style.paddingBottom="3px"}else{document.getElementById("content_inner_"+i).style.display="none";document.getElementById("tab_nav_"+i).style.backgroundPosition="left top";document.getElementById("tab_nav_"+i).style.borderWith="1px solid #6D75AA";document.getElementById("tab_link_"+i).style.color="#E2001A";document.getElementById("tab_link_"+i).style.backgroundPosition="right top";document.getElementById("tab_link_"+i).style.borderWith="1px solid #6D75AA";document.getElementById("tab_link_"+i).style.paddingBottom="2px"}}}function writeDropdown(h,b,f){var g=$(h);var d=$F(h);var a=g.getElementsByTagName("option");var c=$A(a);var e=0;c.each(function(j){if(e){g.removeChild(j)}e++});b.each(function(l){var j=document.createElement("option");j.value=l[0];j.selected=(j.value==d);var k=document.createTextNode(l[1]);j.appendChild(k);g.appendChild(j)});if(f&&b.keys().length){Element.show(g)}else{if(Element.hasClassName(g,"hide")){Element.hide(g)}}}function setDropdown(e,c){var d=$(e);var b=d.getElementsByTagName("option");var a=$A(b);a.each(function(f){f.selected=(f.value==c)})}function openLayerVideo(a){if(a=="open"){document.getElementById("video_layer").style.display="block"}else{document.getElementById("video_layer").style.display="none"}}function openMediaPopup(c,d,a,f,e){if(!f){f=(screen.height/2)-250}if(!e){e=(screen.width/2)-230}if(!d){d=500}if(!a){a=540}var b=window.open(c,"mediapopup","resizable=no,menubar=no,scrollbars=no,status=no,directories=no,width="+d+",height="+a+",top="+f+",left="+e);b.focus()}function openMicrositePopup(c,d,a,g,f,e){if(!g){g=100}if(!f){f=0}if(!d){d=738}if(!a){a=600}if(!e){e="yes"}var b=window.open(c,"microsite","resizable=no,menubar=no,scrollbars="+e+",status=no,directories=no,width="+d+",height="+a+",top="+g+",left="+f);b.focus()}sitemapInProgress=false;function toggleSitemapbox(a,b){if($(a)&&!sitemapInProgress){sitemapInProgress=true;if(b==undefined){b=0.5}if($(a).style.display=="none"){Effect.BlindDown(a,{duration:b,afterFinish:function(){sitemapInProgress=false}});document.getElementById(a+"_img").src="/img/icon_minus.gif";document.getElementById(a+"_link").removeAttribute("class");document.getElementById(a+"_link").setAttribute("class","tesa_blue")}else{Effect.BlindUp(a,{duration:b,afterFinish:function(){sitemapInProgress=false}});document.getElementById(a+"_img").src="/img/icon_plus.gif";document.getElementById(a+"_link").removeAttribute("class");document.getElementById(a+"_link").setAttribute("class","")}}}function preload(){var b=document.getElementsByClassName("hiddenpreload");var a=new Array;for(i=0;i<b.length;i++){a[i]=new Image();a[i].src=b[i].firstChild.data}}function countCookies(d){var e=0;var a=document.cookie.split(/;/);for(var b=0;b<a.length;b++){if(a[b].trim().substr(0,d.length)==d){e++}}return e}function setCookie(c,e,a,h,d,g){var b=new Date();b.setTime(b.getTime());if(a){a=a*1000*60*60*24}var f=new Date(b.getTime()+(a));if(!h){h="/"}document.cookie=c+"="+escape(e)+((a)?";expires="+f.toGMTString():"")+((h)?";path="+h:"")+((d)?";domain="+d:"")+((g)?";secure":"")}function getCookie(c){var d=document.cookie.indexOf(c+"=");var a=d+c.length+1;if((!d)&&(c!=document.cookie.substring(0,c.length))){return null}if(d==-1){return null}var b=document.cookie.indexOf(";",a);if(b==-1){b=document.cookie.length}return unescape(document.cookie.substring(a,b))}function deleteCookie(a,c,b){if(!c){c="/"}if(getCookie(a)){document.cookie=a+"="+((c)?";path="+c:"")+((b)?";domain="+b:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"}}function addToCookie(d,g,c,b){c=Number(c);var e=getCookie(d);if(!e){if(c>0){var a=new Array(c+1);g=a.join(",").concat(g)}setCookie(d,g,b);return}var f=e.split(",");if(f.indexOf(g)<0){if(c>=0){if(f[c]){f.splice(c,0,g)}else{f[c]=g}}else{f.push(g)}}setCookie(d,f.join(","),b)}function removeFromCookie(c,f,b){var d=getCookie(c);if(!d){return}var e=d.split(",");var a=e.indexOf(f);if(a>=0){e=e.slice(0,a).concat(e.slice(a+1))}setCookie(c,e.join(","),b)}function isInCookie(b,e){var c=getCookie(b);if(!c){return false}var d=c.split(",");var a=d.indexOf(e);return(a>=0)}function switchCookie(b,c,a){if(getCookie(b)){deleteCookie(b)}else{setCookie(b,c,a)}}function show(b){var a=$(b);if(a){a.style.display="block";a.style.visibility="visible";return true}return false}function hide(b){var a=$(b);if(a){a.style.display="none";a.style.visibility="hidden";return true}return false}function activate(b){var a=$(b);if(a){a.disabled=false;return true}return false}function deactivate(b){var a=$(b);if(a){a.disabled=true;return true}return false}function go(a){var b=$F(a);if(b){document.location.href=b}}function zoomPackshot(){var a=$$(".packshot");a=$A(a);for(var b=0;b<a.length;b++){if(a[b].style.display!="none"){document.location.href=a[b].parentNode.href}}}function togglePackshotShow(){if(!window.packshotShow){window.packshotShow=new PeriodicalExecuter(nextPackshot,10)}else{window.packshotShow.currentlyExecuting=!window.packshotShow.currentlyExecuting;if(window.packshotShow.currentlyExecuting){$("packshotShowStart").show();$("packshotShowPause").hide()}else{$("packshotShowStart").hide();$("packshotShowPause").show()}}}function nextPackshot(e){e=e||1;var a=$$(".packshot");a=$A(a);var b=0;var c=0;if(a.length<2){return}for(var d=0;d<a.length;d++){if(a[d].style.display!="none"){b=d}}if(e==1){c=(b+1>=a.length?0:b+1)}else{c=(b-1<0?a.length-1:b-1)}if(b!=c){a[b].hide();a[c].show()}}function updateContainer(e,g,c,a,l,h){g=g||"";a=a||"get";var k=g.toQueryParams();k.target=encodeURIComponent(e);if(l){k.url=encodeURIComponent(l)}var b;if(!c){c=document.location.protocol+"//"+document.location.host+document.location.pathname;var j=document.location.search.toQueryParams();var f=$H(j);b=f.merge(k).toQueryString()}else{hNewQuery=$H(k);b=hNewQuery.toQueryString()}var d=h?$(h):$(e).down(".indicator");if(d){d.show()}new Ajax.Updater(e,c,{method:a,parameters:b,evalScripts:true,onComplete:function(){if(d){d.hide()}}});return false}function submitForm(c,a){var b=$(c);if(b){updateContainer(a,b.serialize(),b.action,b.method);return false}return true}function updateDropdownElement(e,b,d,c,a){if(c){d+="ajax=1&produkt="+c.value+"&update="+e+"&selectProdukt="+a}new Ajax.Updater(e,b,{method:"get",parameters:d,evalScripts:true})}function updateCpdbDropdowns(h){var e=$(h);var g=h.substr(4);var c=e.action.replace("result","update");var d=e.serialize();var b=new Ajax.Request(c,{method:"get",parameters:d,onComplete:function(a,f){writeDropdown("selectAssortment"+g,$H(f.selectAssortment),f.showHiddenDropdowns);writeDropdown("selectApplicationfield"+g,$H(f.selectApplicationfield),f.showHiddenDropdowns);writeDropdown("selectApplication"+g,$H(f.selectApplication),f.showHiddenDropdowns)}})}function initCpdbDropdowns(formId){var f=$(formId);var suffix=formId.substr(4);try{var data=getCookie("cpdbSettings"+suffix);if(data){data=eval("("+data+")");setDropdown("selectAssortment"+suffix,data.assortmentId);setDropdown("selectApplicationfield"+suffix,data.applicationfieldId);setDropdown("selectApplication"+suffix,data.applicationId);if(data.query){$("search"+suffix).value=data.query.replace(/\+/g," ")}updateCpdbDropdowns(formId)}}catch(e){return null}}function resetForm(c){var a=$(c);var b=c.substr(4);document.cookie="cpdbSettings"+b+"=;path=/;expires=Thu, 01-Jan-70 00:00:01 GMT";a.q.value="";a.assortment.selectedIndex=0;a.applicationfield.selectedIndex=0;a.application.selectedIndex=0;updateCpdbDropdowns(c)}Event.observe(document,"dom:loaded",function(){var b,a,c;b=function(f){var d=f.tagName=="LI"?$(f):$(f).up("li"),e=d!==c;a();if(e){d.addClassName("open");d.removeClassName("closed");c=d}return true};a=function(){if(c){c.removeClassName("open");c.addClassName("closed");c=null}return true};$$("#nav > li > a",".sub-nav .box3 ul li.has-subnav > a").each(function(d){d.onclick=function(){return !b(d)}});$$(".main-nav a.close",".sub-nav a.close").each(function(d){d.onclick=function(f){return !a()}});$$(".sub-nav li.has-subnav li a[rel=nofollow]").each(function(d){d.onclick=function(){return false}});$$("#wrapper").each(function(k){var h=320,g=12,j="",f=k.getWidth(),e,d;$$(".sub-nav .box3 ul li.has-subnav ul li").each(function(m){var l;if(d&&d!=m.up("ul")){e=null}if(!e||e.getHeight()+m.getHeight()>=h){j="first";l=document.createElement("ul");d=m.up("ul");Element.insert(e?e:d,{after:l});e=l}if(j){m.addClassName(j);j=""}if(e){$(e).insert(m.remove())}if(d&&!d.down("li")){d.remove()}});$$(".sub-nav .box3 ul li.has-subnav .holder").each(function(s){var r=s.up("li"),n=r.positionedOffset(),m=r.select("ul").length,p,t,q,o,l;r.addClassName("columns-"+m);p=s.getWidth(),t=n.top+r.getHeight(),q=n.left+Math.round(-0.5*p+r.getWidth()/2),o=g,l=f-p-g;s.setStyle({left:Math.max(o,Math.min(l,q))+"px",top:t+"px"});r.addClassName("closed")})})});function updateCleanAirPrinter(d,b,a){var c=new Ajax.Updater(d,b,{method:"get",parameters:"company="+a,evalScripts:true,onComplete:function(){initCustomForms()}});return false}function fixFloatingList(b){var a=0;var c=new Array();$(b).select("li").each(function(d){if(d.hasClassName("clearfix")){if(a){c.each(function(f){f.setStyle({height:a+"px"})});a=0;c=new Array()}}a=Math.max(a,d.getHeight());c.push(d)})}Event.observe(window,"load",function(){$(document.body).select("ul.floating").each(function(a){fixFloatingList(a)})});var TesaProductTable=Class.create({initialize:function(a){this.$wrapper=$(a);this.$productTable=this.$wrapper.down("table.product-table");this.sortableColumns=this.$productTable.select("thead th.sortable");this.$tableBody=this.$productTable.down("tbody");this.sortableColumns.each(function(b){b.onclick=this.clickOnSortableColumn.bindAsEventListener(this,b)}.bind(this));this.$filterForm=this.$wrapper.down("form");if(this.$filterForm){this.filterUpdateFunction=this.filterTableRows.bind(this);this.filterForProperty={};this.$filterForm.select("td.filter").each(function(b){b.down("a.toggle").onclick=this.toggleFilter.bindAsEventListener(this,b);switch(true){case b.hasClassName("checkbox"):this.initCheckboxFilter(b);break;case b.hasClassName("range-slider"):this.initRangeSlider(b);break}}.bind(this))}this.$filterForm.select("table").each(function(b){if(b.hasClassName("init-closed")){b.removeClassName("init-closed");b.addClassName("closed")}})},initCheckboxFilter:function(b){var e=b.down("input").getAttribute("name"),d=b.select('input[type="checkbox"]'),a=this.filterUpdateFunction,c;d.each(function(f){Event.observe(f,"checkbox:click",a);Event.observe(f,"click",a)});c=function(h,g,j){var f=$H(Form.serializeElements(g,true)).get(h);if(typeof f==="string"){f=[f]}return f.indexOf(this.propertyValueForRow(j,h))>=0}.bind(this);this.filterForProperty[e]=c.curry(e,d);b.down("a.reset").onclick=function(){d.each(function(f){f.checked=false;updateCheckbox(f)});a();return false}},initRangeSlider:function(m){var g=m.select("input"),c=g[0],j=g[1],k=parseInt($F(c),10),h=parseInt($F(j),10),q=30,f=c.getAttribute("name").replace(/\-min$/,""),p=m.select(".slider-handle"),e=m.down(".slider-range"),d=m.down(".slider-holder"),n=d.getWidth(),l=this.filterUpdateFunction,b,a,o;b=new Control.Slider(p,d,{restricted:true,sliderValue:[0,1],onSlide:function(r){p[0].innerHTML=g[0].value=o(r[0]);p[1].innerHTML=g[1].value=o(r[1]);e.setStyle({left:Math.round(n*r[0])+"px",width:Math.round(n*r[1]-n*r[0])+"px"})},onChange:function(r,s){var t=Math.round(n*r[1]-n*r[0]);if(t<q){if(s.activeHandleIdx===0){r[0]=r[1]-q/n;s.setValue(r[0],0)}else{r[1]=r[0]+q/n;s.setValue(r[1],1)}this.onSlide(s.values)}l()}});o=function(t,r,s){return Math.round(t+(r-t)*s)}.curry(k,h);a=function(v,s,u,w){var t=parseFloat(this.propertyValueForRow(w,v)),r=parseFloat($F(s));return u?t>=r:t<=r}.bind(this);this.filterForProperty[c.getAttribute("name")]=a.curry(f,c,true);this.filterForProperty[j.getAttribute("name")]=a.curry(f,j,false);m.down("a.reset").onclick=function(){b.setValue(0,0);b.setValue(1,1);b.options.onSlide(b.values);l();return false}},filterTableRows:function(){var a=$H(this.$filterForm.serialize(true)).keys(),b=this.findRows();b.map(this.showRow);a.each(function(d){var c=this.filterForProperty[d];b.each(function(e){if(c&&!c(e)){$(e).hide()}})}.bind(this));this.updateRows()},toggleFilter:function(b,a){a.up("table").toggleClassName("closed");return false},clickOnSortableColumn:function(a,j){var h=j.previousSiblings().length,c=j.classNames(),b=c.include("default-desc")?"desc":"asc",d=c.include("ordered-desc")?"desc":c.include("ordered-asc")?"asc":"",g=d?d=="desc"?"asc":"desc":b,f=[],e;switch(true){case c.include("sortable-number"):e="number";break;case c.include("sortable-date"):e="date";break;default:e="char"}this.findRows().each(function(k){f.push({value:this.rowValue(k,h,e),row:k})}.bind(this));f=f.sort(this.compareRow.bind(this));if(g=="desc"){f=f.reverse()}f.reverse().each(function(k){Element.insert(this.$tableBody,{top:k.row})}.bind(this));this.updateRows();this.sortableColumns.each(function(k){k.removeClassName("ordered-asc");k.removeClassName("ordered-desc")});j.addClassName("ordered-"+g);return false},findRows:function(){return this.$productTable.select("tbody tr")},updateRows:function(){var a=1;this.findRows().each(function(b){if(b.visible()){b.removeClassName("odd");b.removeClassName("even");b.addClassName(a%2?"odd":"even");a=a+1}})},showRow:function(a){$(a).setStyle({display:"table-row"})},hideRow:function(a){$(a).setStyle({display:"none"})},compareRow:function(b,a){return b.value==a.value?0:b.value>a.value?1:-1},rowValue:function(d,a,b){var c=$(d).select("td")[a].innerHTML.replace(/&nbsp;/i," ");switch(b){case"number":c=c.replace(/ /,"");c=c.replace(/,/,".");c=c.replace(/^.*?([0-9\.]+).*/,"$1",c).trim();return c.match(/^[\.0-9]+/)?parseFloat(c):0;case"date":return new Date(c);default:return c.toLowerCase()}},propertyValueForRow:function(b,a){return $(b).down("td.property-"+a).getAttribute("data-value")}});Event.observe(document,"dom:loaded",function(){$$(".industry-product-filter").each(function(a){new TesaProductTable(a)})});var TesaBackground=Class.create({initialize:function(){var a=this;this.callbacks={};this.background=$(document.createElement("div"));this.background.setStyle({display:"none",backgroundColor:"#000",position:"absolute",top:0,left:0,width:0,height:0,zIndex:1000});new Insertion.Bottom(document.body,this.background);this.background.onclick=this.clickOnBackground.bindAsEventListener(this);Event.observe(window,"scroll",function(){a.update()});Event.observe(window,"resize",function(){a.update()})},setAfterShow:function(a,b){this.callbacks.afterShow=b.bindAsEventListener(a)},setBeforeHide:function(a,b){this.callbacks.beforeHide=b.bindAsEventListener(a)},show:function(){var a=this;a.update();new Effect.Appear(a.background,{duration:0.5,to:0.8,beforeStart:a.callbacks.beforeShow||Prototype.emptyFunction,afterFinish:a.callbacks.afterShow||Prototype.emptyFunction})},hide:function(){var a=this;var b=a.callbacks.beforeHide||Prototype.emptyFunction;var c=a.callbacks.afterHide||Prototype.emptyFunction;a.callbacks={};new Effect.Fade(a.background,{duration:0.5,to:0,beforeStart:b,afterFinish:c,queue:"end"})},update:function(){var b=Position.realOffset(document.body);var a=document.viewport.getDimensions();this.background.setStyle({top:Math.max(b[1]-100,0)+"px",width:a.width+"px",height:(a.height+200)+"px"})},clickOnBackground:function(){this.hide();return false}});TesaBackground.singleton=function(){if(!TesaBackground.background){TesaBackground.background=new TesaBackground()}return TesaBackground.background};var HomepageKeyVisual=Class.create({initialize:function(c){var b=this;if(!$(c)){return false}this.periodicalExecuter=null;this.switching=false;this.currentIdx=0;this.currentPage=0;this.frequency=5;this.duration=1;this.switchDelay=0.2;this.switchExecuter=null;this.stage=$(c).down(".kv-stage");this.aStageElement=this.stage.select(".kv-stageElement");this.box=$(c).down(".kv-box");this.holder=$(c).down(".kv-holder");this.aThumb=this.holder.select("ul li");this.aPage=$(c).select("ul.kv-pages li");this.thumbWidth=0;this.thumbMargin=0;this.thumbsPerPage=0;var a=0;this.aThumb.each(function(d){b.thumbWidth=b.thumbWidth||d.getWidth();b.thumbMargin=b.thumbMargin||parseInt(d.getStyle("marginRight"));Event.observe(d,"mouseover",b.mouseOverThumb.bindAsEventListener(b,a));Event.observe(d,"mouseout",b.mouseOutThumb.bindAsEventListener(b,a));if(Prototype.Browser.MobileSafari){d.onclick=b.clickOnThumb.bindAsEventListener(b,a)}if(d.hasClassName("active")){b.currentIdx=a}a++});a=0;this.aPage.each(function(d){d.onclick=b.clickOnPage.bindAsEventListener(b,a);if(d.hasClassName("active")){b.currentPage=a}a++});this.thumbsPerPage=Math.floor(this.box.getWidth()/this.thumbWidth);this.stage.onmouseover=this.stop.bindAsEventListener(this);this.stage.onmouseout=this.start.bindAsEventListener(this);this.start()},switchToIndex:function(b){var a=this;b=b%this.aThumb.length;if(!this.switching&&b!=this.currentIdx){this.moveToPage(Math.floor(b/this.thumbsPerPage));this.switching=true;this.aThumb.each(function(c){c.removeClassName("active")});new Effect.Fade(this.aStageElement[this.currentIdx],{duration:this.duration});new Effect.Appear(this.aStageElement[b],{duration:this.duration,afterFinish:function(){a.currentIdx=b;a.aThumb[b].addClassName("active");a.switching=false}})}},moveToPage:function(c){var b=this;if(this.currentPage!=c){var a=c*this.thumbsPerPage*(this.thumbWidth+this.thumbMargin);if(c+1==this.aPage.length&&this.aThumb.length%this.thumbsPerPage>0){a-=(this.thumbsPerPage-this.aThumb.length%this.thumbsPerPage)*(this.thumbWidth+this.thumbMargin)}this.aPage.each(function(d){d.removeClassName("active")});new Effect.Move(this.holder,{x:-1*a,mode:"absolute",duration:this.duration,afterFinish:function(){b.currentPage=c;b.aPage[c].addClassName("active")}})}},start:function(){if(!this.periodicalExecuter){var a=this;this.periodicalExecuter=new PeriodicalExecuter(function(b){a.switchToIndex(a.currentIdx+1)},this.frequency)}},stop:function(){if(this.periodicalExecuter){this.periodicalExecuter.stop();this.periodicalExecuter=null}},clickOnThumb:function(b,a){if(this.switchExecuter){this.switchExecuter.stop()}this.stop();this.switchToIndex(a);return false},mouseOverThumb:function(c,b){var a=this;this.stop();if(this.switchExecuter){this.switchExecuter.stop()}this.switchExecuter=new PeriodicalExecuter(function(d){d.stop();a.switchToIndex(b)},this.switchDelay);return true},mouseOutThumb:function(c,b){var a=this;if(this.switchExecuter){this.switchExecuter.stop()}this.switchExecuter=new PeriodicalExecuter(function(d){d.stop();a.start()},this.switchDelay);return true},clickOnPage:function(b,a){this.moveToPage(a);return false}});Event.observe(document,"dom:loaded",function(){new HomepageKeyVisual("homepageKeyVisual")});var TesaLightbox=Class.create({initialize:function(b){var a=this;this.currentGallery;this.galleryLink=b;this.background=TesaBackground.singleton();this.lightbox=$(document.createElement("div"));this.lightbox.setStyle({padding:"20px",width:"940px",overflow:"hidden",position:"absolute",top:0,left:0,zIndex:1010,backgroundColor:"white",display:"none"});new Insertion.Bottom(document.body,this.lightbox);this.background.setAfterShow(this,this.showLightbox);this.background.setBeforeHide(this,this.hideLightbox);this.background.show()},showLightbox:function(){var a=this;new Ajax.Updater(a.lightbox,a.galleryLink.href,{method:"get",onComplete:function(){a.lightbox.select(".close").each(function(b){b.onclick=function(){a.background.hide();return false}});a.currentGallery=new Gallery(a.lightbox.down(".gallery"),true);a.updatePosition(true);new Effect.Appear(a.lightbox,{duration:0.5,afterFinish:function(){a.currentGallery.switchToElement(null)}})}})},hideLightbox:function(){var a=this;new Effect.Fade(this.lightbox,{duration:0.5,afterFinish:function(){if(a.currentGallery){a.currentGallery.remove()}a.lightbox.remove()}})},updatePosition:function(b){var c=Position.realOffset(document.body);var a=document.viewport.getDimensions();if(this.lightbox&&b){new Effect.Move(this.lightbox,{x:Math.floor((a.width-this.lightbox.getWidth())/2),y:(c[1]+10),mode:"absolute",duration:0})}},clickOnBackground:function(a){this.hideLightbox();return false}});Event.observe(document,"dom:loaded",function(){$$('a[rel="lightbox"]').each(function(a){a.onclick=function(){new TesaLightbox(a);return false}})});var Gallery=Class.create({initialize:function(c,b){var a=this;this.gallery=$(c);this.mediaHolder=this.gallery.down(".media-holder");this.galleryScroller=this.gallery.down(".gallery-box");this.galleryThumblist=this.gallery.down(".gallery-holder ul");this.aGalleryThumb=[];this.currentIndex=0;this.pageWidth;this.galleryThumblist.select("li.thumb").each(function(d){a.aGalleryThumb.push(d);var e=d.down("a");if(e){e.onclick=a.clickOnThumb.bindAsEventListener(a,e)}});if(this.aGalleryThumb.length<=1){this.galleryScroller.hide()}this.currentPage=1;if(this.gallery.hasClassName("gallery-small")){this.elementsPerPage=2}else{if(this.gallery.hasClassName("gallery-big")){this.elementsPerPage=5}else{this.elementsPerPage=4}}this.totalPages=Math.ceil(this.aGalleryThumb.length/this.elementsPerPage);this.scrollLeft=this.galleryScroller.down(".btn-left");this.scrollRight=this.galleryScroller.down(".btn-right");this.scrollLeft.onclick=this.clickOnScrollButton.bindAsEventListener(this,this.scrollLeft,-1);this.scrollRight.onclick=this.clickOnScrollButton.bindAsEventListener(this,this.scrollRight,1);this.mediaHolder.onclick=this.clickOnMediaHolder.bindAsEventListener(this);this.mediaHolder.onmousemove=this.mouseMoveMediaHolder.bindAsEventListener(this);this.mediaHolder.onmouseout=this.mouseOutMediaHolder.bindAsEventListener(this);this.switchToElement(null)},scrollThumbnails:function(b){var a=this;if(!this.pageWidth){this.pageWidth=this.gallery.down(".gallery-holder").getWidth()}if(!b){b=this.totalPages}else{if(b>this.totalPages){b=1}}new Effect.Move(this.galleryThumblist,{x:((b-1)*this.pageWidth*-1),mode:"absolute",queue:"end",afterFinish:function(){if(b==1){a.scrollLeft.hide()}else{a.scrollLeft.show()}if(b==a.totalPages){a.scrollRight.hide()}else{a.scrollRight.show()}}});this.currentPage=b},switchToElement:function(d,c){var a=this;var g=false;var h=false;a.mediaHolder.removeClassName("video");if(!d){var b=0;var f=false;this.aGalleryThumb.each(function(j){if(!b++||(j.hasClassName("active")&&!f)){f=j.hasClassName("active");d=j}})}if(d){d.siblings().each(function(j){$(j).removeClassName("active")});d.addClassName("active");g=d.hasClassName("video");h=d.hasClassName("image")}this.currentIndex=d.previousSiblings().length;this.scrollThumbnails(Math.floor(this.currentIndex/this.elementsPerPage)+1);this.beforeLoading();var e=d.down("a");new Ajax.Updater(this.mediaHolder,e.href,{method:"get",evalScripts:true,parameters:"autoplay="+(c?"1":"0"),onComplete:function(l,k){if(h){var j=a.mediaHolder.down("img");j.onload=function(){new Effect.Appear(j);a.afterLoading()};j.src=j.title;j.title=j.alt}else{if(g){a.mediaHolder.addClassName("video")}a.afterLoading()}}})},clickOnScrollButton:function(a,b,c){$(b).blur();this.scrollThumbnails(this.currentPage+c);return false},clickOnThumb:function(a,b){$f("*").each(function(){this.unload()});$(b).blur();this.switchToElement(b.up("li"));return false},imageAction:function(a){var b=null;var c=this.mediaHolder.cumulativeOffset();if(this.currentIndex>0&&this.currentIndex<this.aGalleryThumb.length-1){b=parseInt(c.left)+Math.floor(parseInt(this.mediaHolder.getWidth())/2)}else{if(this.currentIndex>0){b=parseInt(c.left)+parseInt(this.mediaHolder.getWidth())}else{if(this.currentIndex<this.aGalleryThumb.length-1){b=0}else{return false}}}return(Event.pointerX(a)<b)?"prev":"next"},clickOnMediaHolder:function(a){switch(this.imageAction(a)){case"prev":this.switchToElement(this.aGalleryThumb[this.currentIndex-1]);break;case"next":this.switchToElement(this.aGalleryThumb[this.currentIndex+1]);break}return false},mouseMoveMediaHolder:function(a){if(this.mediaHolder.hasClassName("loading")||this.mediaHolder.hasClassName("video")){return false}switch(this.imageAction(a)){case"prev":this.mediaHolder.down(".prevImage").show();this.mediaHolder.down(".nextImage").hide();break;case"next":this.mediaHolder.down(".prevImage").hide();this.mediaHolder.down(".nextImage").show();break}},mouseOutMediaHolder:function(a){if(this.mediaHolder.hasClassName("loading")||this.mediaHolder.hasClassName("video")){return false}this.mediaHolder.down(".prevImage").hide();this.mediaHolder.down(".nextImage").hide()},beforeLoading:function(){this.gallery.addClassName("loading")},afterLoading:function(){this.gallery.removeClassName("loading");var b=this.aGalleryThumb[this.currentIndex];var c=this.gallery.down(".data-box");c.innerHTML=$(b).down(".data-box").innerHTML;var a=Math.max(c.down(".about-box").getHeight(),c.down(".option-list").getHeight());new Effect.Morph(c,{style:"height:"+a+"px",duration:0.5})},remove:function(){this.gallery.remove()}});Event.observe(window,"load",function(){$$(".gallery").each(function(a){var b=new Gallery(a)})});var GalleryBox=Class.create({initialize:function(c){var a=this;this.$wrapper=$(c);this.mediaHolder=this.$wrapper.select(".image-holder");this.mediaCount=this.mediaHolder.length;this.pagerBlocks=this.$wrapper.select("ul.pager li");this.mediaTitles=this.$wrapper.select("span.medium-title");this.currentIndex=0;this.indexQueue=[];this.autoPlay=this.$wrapper.getAttribute("data-autoplay")?true:false;this.transitionSpeed=parseInt(this.$wrapper.getAttribute("data-transition-speed",10))||1;this.rotationSpeed=parseInt(this.$wrapper.getAttribute("data-rotation-speed",10))||5;this.rotationExecuter=null;this.switching=false;this.videoPlaying=false;if(!this.pagerBlocks.length){return}for(var b=1;b<this.mediaCount;b+=1){this.mediaHolder[b].setStyle({display:"none"})}this.pagerBlocks.each(function(e,d){e.onclick=function(){a.stopRotation();a.showMedium(d);return false}});this.$wrapper.select(".video a").each(function(d){flowplayer(d).onStart(function(){a.videoPlaying=true;a.stopRotation()});flowplayer(d).onStop(function(){a.videoPlaying=false});flowplayer(d).onPause(function(){a.videoPlaying=false});flowplayer(d).onFinish(function(){a.videoPlaying=false})});this.startRotation();this.$wrapper.onmouseover=function(){a.stopRotation()};this.$wrapper.onmouseout=function(){a.startRotation()}},startRotation:function(){var a=this;if(!this.autoPlay){return}if(!this.rotationExecuter){this.rotationExecuter=new PeriodicalExecuter(function(){a.showNextMedium()},this.rotationSpeed+this.transitionSpeed)}},stopRotation:function(){if(this.rotationExecuter){this.rotationExecuter.stop();this.rotationExecuter=null}},showQueuedMedium:function(){if(this.indexQueue.length){this.stopRotation();this.showMedium(this.indexQueue.pop());this.indexQueue=[]}},showNextMedium:function(){if(!this.videoPlaying){this.showMedium((this.currentIndex+1)%this.mediaCount)}},showMedium:function(c){var b=this,a=this.currentMedium();if(c==this.currentIndex){return}if(this.switching){this.indexQueue.push(c);return}if(a.hasClassName("video")){flowplayer(a.down("a")).stop()}this.switching=true;this.pagerBlocks[this.currentIndex].removeClassName("active");this.mediaTitles[this.currentIndex].hide();new Effect.Appear(this.medium(c),{duration:b.transitionSpeed});new Effect.Fade(a,{duration:b.transitionSpeed,afterFinish:function(){b.currentIndex=c;b.pagerBlocks[b.currentIndex].addClassName("active");b.mediaTitles[b.currentIndex].show();b.switching=false;b.showQueuedMedium()}})},medium:function(a){return this.mediaHolder[a]},currentMedium:function(){return this.medium(this.currentIndex)}});Event.observe(document,"dom:loaded",function(){$$(".teaser-gallery").each(function(b){var a=new GalleryBox(b)})});var CommerceConnectorPopup=Class.create({initialize:function(){var a=this;this.href=null;a.background;Event.observe(window,"load",function(){$$(".stockist a").each(function(b){b.onclick=a.clickOnButton.bindAsEventListener(a,b.href)})})},show:function(){var b=this;var c=new Ajax.Request(this.href,{method:"get",evalScripts:true,onSuccess:function(f,e){new Insertion.After(b.background.background,f.responseText);var d=$("commerceConnector");var g=d.getDimensions();var a=typeof(window.pageYOffset)=="number"?window.pageYOffset:document.documentElement.scrollTop;var h=-1*(parseInt(g.height)-parseInt(a));d.setStyle({top:h+"px",zIndex:b.background.background.getStyle("zIndex")+1});new Effect.Move(d,{y:g.height,mode:"relative"});Event.observe(window,"scroll",function(){b.updatePosition()});Event.observe(window,"resize",function(){b.updatePosition()});b.parseResponse()}})},hide:function(){var a=this;if($("commerceConnector")){new Effect.Move($("commerceConnector"),{y:$("commerceConnector").getHeight()*-1,mode:"relative",afterFinish:function(){$("commerceConnector").remove();if(a.background){a.background.hide()}}})}},updatePosition:function(){new Effect.Move("commerceConnector",{y:typeof(window.pageYOffset)=="number"?window.pageYOffset:document.documentElement.scrollTop,mode:"absolute",duration:0.5})},parseResponse:function(b){var a=this;$("commerceConnector").select(".close").each(function(c){c.onclick=a.clickOnClose.bindAsEventListener(a)});$("commerceConnector").select(".ajax").each(function(c){switch(c.nodeName){case"A":c.onclick=a.clickOnAjaxLink.bindAsEventListener(a,c.href);break;case"FORM":c.onsubmit=a.submitAjaxForm.bindAsEventListener(a,c)}})},clickOnAjaxLink:function(d,e){var b=this;var c=new Ajax.Updater("commerceConnector",e,{method:"get",evalScripts:true,onComplete:function(f,a){b.parseResponse()}});return false},submitAjaxForm:function(a,b){this.clickOnAjaxLink(a,b.action+"?"+b.serialize());return false},clickOnButton:function(a,b){this.href=b;this.background=TesaBackground.singleton();this.background.setAfterShow(this,this.show);this.background.setBeforeHide(this,this.hide);this.background.show();return false},clickOnClose:function(a){this.background.hide();return false}});var TesaTouch=Class.create({initialize:function(b,a){this.element=$(b);this.initVariables();this.deltaX=a.deltaX||1;this.deltaY=a.deltaY||1;this.minLength=a.minLength||20;this.restrict=a.restrict||null;this.onStart=a.onStart||Prototype.emptyFunction;this.onEnd=a.onEnd||Prototype.emptyFunction;this.onCancel=a.onCancel||Prototype.emptyFunction;this.onMove=a.onMove||Prototype.emptyFunction;this.onStep=a.onStep||Prototype.emptyFunction;this.element.ontouchstart=this.touchStart.bindAsEventListener(this);this.element.ontouchend=this.touchEnd.bindAsEventListener(this);this.element.ontouchmove=this.touchMove.bindAsEventListener(this);this.element.ontouchcancel=this.touchCancel.bindAsEventListener(this)},initVariables:function(a){this.fingerCount=0;this.startX=0;this.startY=0;this.curX=0;this.curY=0;this.stepsX=0;this.stepsY=0},touchStart:function(a){this.initVariables();this.fingerCount=a.touches.length;if(this.fingerCount==1){this.startX=a.touches[0].pageX;this.startY=a.touches[0].pageY;this.onStart(this.startX,this.startY)}else{this.touchCancel(a)}},touchMove:function(a){if(a.touches.length==1){this.curX=a.touches[0].pageX;this.curY=a.touches[0].pageY;var d=Math.round(Math.sqrt(Math.pow(this.curX-this.startX,2)+Math.pow(this.curY-this.startY,2)));if(d>=this.minLength){var e=this.direction();if(!this.restrict||(this.restrict=="horizontal"&&(e=="left"||e=="right"))||(this.restrict=="vertical"&&(e=="up"||e=="down"))){a.preventDefault();var c=Math.floor((this.curX-this.startX)/this.deltaX);var b=Math.floor((this.curY-this.startY)/this.deltaY);this.onMove(e,d);if(c!=this.stepsX||b!=this.stepsY){this.onStep(e,c-this.stepsX,b-this.stepsY);this.stepsX=c;this.stepsY=b}}}}else{this.touchCancel(a)}},touchEnd:function(a){this.onEnd(this.curX,this.curY)},touchCancel:function(a){this.onCancel(this.curX,this.curY)},angle:function(){var e=this.startX-this.curX;var d=this.curY-this.startY;var b=Math.round(Math.sqrt(Math.pow(e,2)+Math.pow(d,2)));var a=Math.atan2(d,e);var c=Math.round(a*180/Math.PI);if(c<0){c=360-Math.abs(c)}return c},direction:function(){var a=this.angle();if((a<=45)&&(a>=0)){return"left"}else{if((a<=360)&&(a>=315)){return"left"}else{if((a>=135)&&(a<=225)){return"right"}else{if((a>45)&&(a<135)){return"down"}else{return"up"}}}}}});var TesaAutocompleter=null;if(Prototype.Browser.IE&&"undefined"==typeof document.documentMode||Prototype.Browser.IE&&document.documentMode<8){TesaAutocompleter=Class.create(Ajax.Autocompleter,{initialize:function($super,c,d,b,a){$super(c,d,b,a);this.clicked_outside=false;Event.observe(document,"click",this.onDocumentClick.bindAsEventListener(this));this.element.stopObserving("blur");this.element.observe("blur",this.onBlurOverride.bindAsEventListener(this))},onDocumentClick:function(a){if(this.element.id!=a.target.id){this.clicked_outside=true}},onBlurOverride:function(b){var a=this;var c=function(){if(a.clicked_outside){a.clicked_outside=false;a.onBlur(b)}else{a.element.focus()}};setTimeout(c,200)}})}else{TesaAutocompleter=Ajax.Autocompleter}var TesaInfographic=Class.create({initialize:function(b){var a=this;this.$wrapper=$(b);this.spots=this.$wrapper.select(".spot");this.boxes=this.$wrapper.select(".messagebox");this.$currentBox;this.$wrapper.select(".messagebox .close").each(function(c){c.onclick=a.clickOnClose.bindAsEventListener(a,c)});this.spots.each(function(c){c.onclick=function(){var d=a.spots.indexOf(c);a.openMessageBox(a.boxes[d]);return false}})},clickOnClose:function(b,a){this.closeMessageBox();return false},openMessageBox:function(a){this.closeMessageBox();a.addClassName("open");this.$currentBox=a;a.setStyle({top:Math.round((this.$wrapper.getHeight()-a.getHeight())/2)+"px"})},closeMessageBox:function(){if(this.$currentBox){this.$currentBox.removeClassName("open");this.$currentBox=null}}});Event.observe(document,"dom:loaded",function(){$$("#infographic").each(function(a){var b=new TesaInfographic(a)})});var Videoplayer=Class.create({});Videoplayer.defaults={controls:{buttonColor:"#FFFFFF",progressColor:"#E60000",progressGradient:"none",bufferColor:"#999999",sliderColor:"#999999",sliderBorder:"#999999",volumeColor:"#E60000",volumeSliderColor:"#999999",volumeGradient:"none",backgroundColor:"rgba(0, 0, 0, 0.3)",backgroundGradient:"none"},canvas:{background:"#ff0000"}};
