var controler=new Class({Implements:Options,options:{urlCart:"/cgi-bin/xxl_cart_data.cgi",urlImage:"/cgi-bin/xxl_user_images.cgi",urlEnv:"/php/xxl_data.php",resetButtonId:"designer_reset_button",saveButtonId:"product_save_to_cart"},initialize:function(A,D,C,B){this.values=new Hash();this.set("session_id",A);this.set("session_prefix",A.substring(0,1));this.set("country",D);this.listener=new Array();this.request=new Request({method:"post",async:false,onSuccess:this.evaluateResponse.bind(this)});this.set("maxFileSizeMB",30);if(C){this.set("cart_id",C);this.loadFromCart()}if($(this.options.resetButtonId)){this.resetButton=$(this.options.resetButtonId);this.resetButton.addEvent("click",this.reset.bind(this))}if($(this.options.saveButtonId)){$(this.options.saveButtonId).addEvent("click",this.saveToCart.bind(this))}},set:function(A,B){this.values.set(A,B)},get:function(A){if(this.values.has(A)){return this.values.get(A)}else{return false}},loadFromCart:function(){this.request.send({data:{xxl_session:this.get("session_id"),load:this.get("cart_id")},url:this.options.urlCart});if(this.get("orientation")!=="square"){if(this.get("orientation")==="landscape"){if(this.get("rotation").toInt()===90||this.get("rotation").toInt()===270){this.set("orientation","portrait")}}else{if(this.get("rotation").toInt()===90||this.get("rotation").toInt()===270){this.set("orientation","landscape")}}}},loadImage:function(A){if(A!=this.get("currentImage")){this.set("currentImage",A);this.request.send({data:{xxl_session:this.get("session_id"),id:A,action:"load",product:this.get("products_id")?this.get("products_id"):0},url:this.options.urlImage});this.set("layerOrientation",this.get("orientation"));this.set("rotation",0);this.set("selectionLayerOffSetX",false);this.set("selectionLayerOffSetY",false);this.refreshListener()}else{}},saveToCart:function(B){var A=new Event(B);if(this.get("currentImage")){if(this.get("cart_id")){this.request.send({data:{xxl_session:this.get("session_id"),save:this.get("cart_id"),selectionLayerOffSetX:this.get("selectionLayerOffSetX"),selectionLayerOffSetY:this.get("selectionLayerOffSetY"),selectionLayerWidth:this.get("selectionLayerWidth"),selectionLayerHeight:this.get("selectionLayerHeight"),current_rotation:this.get("rotation"),layerOrientation:this.get("layerOrientation"),products_id:this.get("products_id"),image_id:this.get("currentImage"),effect_id:this.get("effects_id"),quality:this.get("quality"),border:this.get("building_border"),frame:this.get("frame_id")},url:this.options.urlCart})}else{this.request.send({data:{xxl_session:this.get("session_id"),add:1,selectionLayerOffSetX:this.get("selectionLayerOffSetX"),selectionLayerOffSetY:this.get("selectionLayerOffSetY"),selectionLayerWidth:this.get("selectionLayerWidth"),selectionLayerHeight:this.get("selectionLayerHeight"),current_rotation:this.get("rotation"),layerOrientation:this.get("layerOrientation"),products_id:this.get("products_id"),image_id:this.get("currentImage"),effect_id:this.get("effects_id"),quality:this.get("quality"),border:this.get("building_border"),frame:this.get("frame_id")},url:this.options.urlCart})}}if(this.get("save_to_cart_error")){A.stop();alert(this.get("save_to_cart_error"))}else{}},evaluateResponse:function(C,D){var A=JSON.decode(C);if(A){for(var B in A){this.set(B,A[B])}}},refreshListener:function(){this.listener.each(function(A){A.refresh()})},register:function(A){this.listener.push(A);if(this.get("cart_id")){A.refresh()}},reset:function(){var A=this.get("currentImage");this.values.each(function(C,B,D){if(B!="session_id"&&B!="session_prefix"&&B!="country"&&B!="cart_id"){D.erase(B)}});if(this.get("cart_id")){this.loadFromCart();ui.refresh();this.refreshListener()}else{this.loadImage(A)}},changeMaterial:function(A){this.set("material_id",A.id);this.set("material_name",A.name);this.set("material_misc",A.misc);this.refreshListener()},changeFormat:function(A){if(this.get("formats_id")!=A.formats_id){if((this.get("print_width")/this.get("print_height"))!=(A.print_width/A.print_height)){this.set("selectionLayerOffSetX",false);this.set("selectionLayerOffSetY",false)}this.set("formats_id",A.formats_id);this.set("formats_name",A.name);this.set("formats_misc",A.misc);this.set("print_height",A.print_height);this.set("print_width",A.print_width);this.set("quality",A.quality)}this.set("products_id",A.products_id);this.set("product_price",A.product_price);this.set("product_value",A.product_value);this.refreshListener()},changeEffect:function(A){this.set("effects_id",A.id);this.set("effects_name",A.name);this.set("effects_misc",A.misc);this.set("effect_price",A.effect_price);this.set("effect_value",A.effect_value);this.refreshListener()},changeBuilding:function(A){if(this.get("building")!==A.variant||this.get("building_border")!==A.building_border||this.get("building_border_width")!==A.border_width){this.set("selectionLayerOffSetX",false);this.set("selectionLayerOffSetY",false)}this.set("building",A.variant);this.set("building_name",A.building_name);this.set("building_desc",A.building_misc);this.set("products_id",A.products_id);this.set("building_price",A.building_price);this.set("building_value",A.building_value);this.set("building_border",A.building_border);this.set("building_border_width",A.border_width);this.refreshListener()},removeBuilding:function(){if(this.get("building")!=="std"||this.get("building_border_width")){this.set("selectionLayerOffSetX",false);this.set("selectionLayerOffSetY",false)}this.set("building",false);this.set("building_name",false);this.set("building_desc",false);this.set("building_price",false);this.set("building_value",false);this.set("building_border",false);this.set("building_border_width",false);this.refreshListener()},changeFrame:function(A){if(this.get("frame_id")!==A.id){this.set("frame_id",A.id);this.set("frame_name",A.title);this.set("frame_misc",A.desc);this.set("frame_price",A.frame_price);this.set("frame_value",A.frame_value);this.refreshListener()}},removeFrame:function(){if(this.get("frame_id")!==0){this.set("frame_id",0);this.set("frame_name",false);this.set("frame_misc",false);this.set("frame_price",false);this.set("frame_value",false);this.refreshListener()}}});var Infobox2={options:{width:500,height:300},initialize:function(A){this.options=$merge(this.options,A)},loadContent:function(B,A){if(A){this.initialize(A)}this.load(null,B)},loadURL:function(A,B){if(B){this.initialize(B)}this.load(A,null)},show:function(){if($chk($("infobox_main2"))){$("bg-dimmer").setStyle("display","block");$("infobox_main2").setStyle("display","block")}},dispose:function(){if($chk($("infobox_main2"))){$("bg-dimmer").destroy();$("infobox_main2").destroy();$(document).removeEvent("keydown",Infobox2.readESCKey)}},addCloseButton:function(A){var B=new Element("a",{id:"infobox2-close-button","class":"closeButton",href:"javascript:Infobox2.dispose();"});B.inject($("infobox_main2"));$(document).addEvent("keydown",Infobox2.readESCKey)},load:function(A,D){var C=new Element("div");if(A){var B=new Request({async:false,onSuccess:function(E,F){this.build(E)}.bind(this)});B.get(A)}else{this.build(D)}},build:function(C){content_box=new Element("div",{html:C});if($chk(content_box.getElement("div[id=infobox2-title]"))){headline_box=new Element("div");headline_box.grab(content_box.getElement("div[id=infobox2-title]"));headline=headline_box.get("html")}else{headline=null}C=content_box.get("html");var D=new Element("div",{id:"bg-dimmer","class":"fixed-layer"});var B=new Element("div",{id:"infobox_main2","class":"fixed-layer-center "+(headline?"infobox-headline-exists":"infobox-headline-exists-not")});B.setStyles({"margin-left":-parseInt(this.options.width/2),"margin-top":-parseInt(this.options.height/2),width:this.options.width,height:this.options.height});var A='<div class="main-content" style="width: '+this.options.width+"px; height: "+this.options.height+'px;">';if(headline){A+='	<div class="infobox-head-headline">';A+='		<div class="lt"></div>';A+='		<div class="rt"></div>';A+='		<div class="ct">';A+='			<div class="h-top"></div>';A+='			<div class="h-content">'+headline+"</div>";A+="		</div>";A+="	</div>"}else{A+='	<div class="infobox-head-no-headline">';A+='		<div class="lt"></div>';A+='		<div class="rt"></div>';A+='		<div class="ct">';A+='			<div class="h-content"></div>';A+="		</div>";A+="	</div>"}A+='	<div class="infobox-foot">';A+='		<div class="lb"></div>';A+='		<div class="rb"></div>';A+='		<div class="cb">';A+='			<div class="f-content"></div>';A+="		</div>";A+="	</div>";A+='	<div class="l-bg"></div>';A+='	<div class="r-bg"></div>';A+='	<div class="content-center">';A+='		<div class="cc-l-bg"></div>';A+='		<div class="cc-r-bg"></div>';A+='		<img id="backgroundGradientBox" src="/images/website/global/infobox/std/gradient.png" alt="" />';A+='		<div id="infobox-content-pane">'+C+"</div>";A+="	</div>";A+="</div>";B.set("html",A);D.injectInside($(document.body));B.injectInside($(document.body))},readESCKey:function(A){if(A.key=="esc"){Infobox2.dispose()}}};var Infobox={options:{duration:300,display:"block",top:"0px",left:"0px",zindex:5000,backgroundcolor:"#333",opacity:0.8,modalize:true,button:true,width:400,height:400,top:"50%",transparent:false},initialize:function(B){this.options.pos="fixed";if(Browser.Engine.trident4){this.options.pos="absolute";var D=document.body.scrollTop;var A=window.getHeight();var C=(D+A/2)+"px";this.options.top=C}this.options=$merge(this.options,B)},assign:function(A){A.each(function(B){B.addEvent("click",function(E){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","none")}new Event(E).stop();var C=B.getProperty("href");var D=B.getProperty("rel");D=JSON.decode(D);return !Infobox.fromElement(this,D,C)})})},show:function(B,A){if(A){this.options=$merge(this.options,A)}this.initialize();this.build();this.parseOptions();$("infobox_main").set("html",B)},showURL:function(A,B){if(B){this.options=$merge(this.options,B)}B=JSON.decode(B);return !Infobox.fromElement(this,B,A)},load:function(B,A){if(A){this.options=$merge(this.options,A)}return !Infobox.fromElement(this,A,B)},close:function(){$("infobox_main").destroy();$("modalizer").destroy();if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","inline")}if($("uploadTarget")){$("uploadTarget").destroy()}},fromElement:function(C,B,A){this.initialize(B);this.build(A);this.parseOptions()},parseOptions:function(){var A=new Hash();A.extend(this.options);A.each(function(C,B){if(C=="true"){this.buildOptions(B)}}.bind(this))},build:function(B){var E=new Element("div",{id:"infobox_main"});if(this.options.transparent){E.setStyles({position:this.options.pos,"z-index":"5001",opacity:"0",width:this.options.width+"px",height:this.options.height+"px",left:"50%",top:this.options.top,"margin-left":-(this.options.width/2)+"px","margin-top":-(this.options.height/2)+"px",overflow:"auto","overflow-x":"hidden"})}else{E.setStyles({position:this.options.pos,"z-index":"5001",opacity:"0",width:this.options.width+"px",height:this.options.height+"px",left:"50%",top:this.options.top,"margin-left":-(this.options.width/2)+"px","margin-top":-(this.options.height/2)+"px","background-color":"#FFFFFF",overflow:"auto","overflow-x":"hidden"})}if($("infobox_target")){E.inject($("infobox_target"))}else{E.injectInside($(document.body))}E.addEvent("click",function(){return });var F=new Element("div",{id:"modalizer"});F.setStyles({position:this.options.pos,display:"block","background-color":this.options.backgroundcolor,width:window.getScrollWidth()+"px",height:(window.getScrollHeight())+"px",top:"0px",left:"0px",opacity:"0","z-index":this.options.zindex});if($("infobox_target")){F.inject($("infobox_target"))}else{F.injectInside($(document.body))}if($("button_close_upload")){$("button_close_upload").addEvent("click",function(){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","inline")}this.destroy();E.destroy();$("infobox_closer").destroy()})}if(this.options.button=="true"){F.addEvent("click",function(){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","inline")}this.destroy();E.destroy();$("infobox_closer").destroy()})}var A=new Fx.Tween(E,{duration:this.options.duration});A.start("opacity",[0,1]);var D=new Fx.Tween(F,{duration:this.options.duration});D.start("opacity",[0,this.options.opacity]);if(B){var C=new Request({async:false,method:"get",url:B,onSuccess:function(G,H){E.set("html",G)}}).send()}this.content=$("infobox_main")},buildOptions:function(C){switch(C){case"button":var B=new Element("img",{id:"infobox_closer",src:"/images/website/global/"+ctrl.get("country")+"/closebox.gif"});B.setStyles({position:this.options.pos,top:this.options.top,right:"50%",width:"65px",height:"16px","margin-top":-(this.options.height/2+16)+"px","margin-right":-(this.options.width/2)+"px","z-index":"5003",opacity:"0",cursor:"pointer"});if($("infobox_target")){B.inject($("infobox_target"))}else{B.injectInside($(document.body))}B.addEvent("click",function(){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","inline")}$("modalizer").destroy();$("infobox_main").destroy();this.destroy()});var A=new Fx.Tween(B,{duration:this.options.duration});A.start("opacity",[0,1]);break}}};var Errorbox={show:function(A){if($chk($("infobox_main2"))){Infobox2.dispose()}A='<div style="padding: 12px; font-size: 13px; text-align: left;">'+A+"</div>";A+='<div id="infobox2-title">Error!</div>';Infobox2.loadContent(A,{width:"450",height:"70"});Infobox2.addCloseButton();$("infobox_main2").addClass("errorbox");Infobox2.show()}};var Alerter={Implements:Options,options:{duration:300,display:"block",top:"0px",left:"0px",zindex:5000,backgroundcolor:"#333",opacity:0.8,modalize:true,button:true,width:400,height:400},initialize:function(A){this.options.pos="fixed";if(Browser.Engine.trident4){this.options.pos="absolute"}if(A){this.options=$merge(this.options,A)}},show:function(B,C,D,A){this.headline=C;this.content=D;this.buttontxt=A;this.initialize(B);this.build()},build:function(){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","none")}this.alert_div=new Element("div",{id:"alerter",styles:{position:this.options.pos,opacity:0}}).inject($(document.body));this.alert_top=new Element("div",{id:"alerter_top"}).inject($(this.alert_div));this.alert_body=new Element("div",{id:"alerter_body"}).inject($(this.alert_div));this.alert_body_content=new Element("p").inject($(this.alert_body));this.alert_bottom=new Element("div",{id:"alerter_bottom"}).inject($(this.alert_div));this.close_button=new Element("div",{id:"alerter_close"}).inject($(this.alert_top));this.h1=new Element("h1").inject($(this.alert_top));this.h1.set("html",this.headline);this.alert_body_content.set("html",this.content);var B=new Fx.Tween(this.alert_div,{duration:this.options.duration});B.start("opacity",[0,1]);if(this.options.modalize&&!$("button_standalone")){var C=new Element("div",{id:"modalizer",styles:{position:this.options.pos,display:"block","background-color":this.options.backgroundcolor,width:window.getScrollWidth()+"px",height:(window.getScrollHeight())+"px",top:"0px",left:"0px",opacity:"0","z-index":this.options.zindex}}).inject($(document.body));var A=new Fx.Tween(C,{duration:this.options.duration});A.start("opacity",[0,this.options.opacity]);if(this.options.button){C.addEvent("click",function(D){this.alert_div.destroy();C.destroy();if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","inline")}}.bind(this))}}if(this.buttontxt){this.userbutton=new Element("div",{id:"alerter_button"}).inject($(this.alert_body));this.userbutton.set("html",this.buttontxt)}this.close_button.addEvent("click",function(D){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","inline")}this.alert_div.destroy();if(this.options.modalize&&!$("button_standalone")){C.destroy()}}.bind(this));if(this.options.draggable){this.alert_div.makeDraggable({container:"body"})}}};var Campaign={subscribe:function(I,G,J,K,H){var A=I;var F=$(G).get("value");var E=$(J).get("value");var C=$(K).get("value");var D=$(H).get("value");var B=new Request.JSON({url:"/php/xxl_campaign.php",method:"post",data:{email:F,campaign:A,action:"subscribe",salutation:E,firstname:C,lastname:D,xxl_session:ctrl.get("session_id")},onComplete:function(L){if(L.ok){$$(".campaign_form").setStyle("display","none");$$(".campaign_error").setStyle("display","none");$$(".campaign_thankyou").setStyle("display","block")}else{$$(".campaign_error").setStyles({width:"100%",color:"#fff","font-weight":"bold","background-color":"#d4021d","border-top":"3px solid #c8c8c8","border-bottom":"3px solid #c8c8c8"});$(G).set("value",F);$(J).set("value",E);$(K).set("value",C);$(H).set("value",D)}}}).send()}};var Newsletter={subscribe:function(B,A){var C=$(B).get("value");var D=new Request.JSON({url:"/ajax/home/newsletter",method:"post",data:{email:C,action:"subscribe",origin:A,xxl_session:ctrl.get("session_id")},onComplete:function(E){if(E.ok){$("nl-state-s").addClass("hide");$("nl-state-t").removeClass("hide")}else{Errorbox.show(E.error);$(B).set("value",C)}}}).send()},unsubscribe:function(A){var B=$(A).get("value");var C=new Request.JSON({url:"/ajax/home/newsletter",method:"post",data:{email:B,action:"unsubscribe",xxl_session:ctrl.get("session_id")},onComplete:function(D){if(D.ok){$("nl-state-s").addClass("hide");$("nl-state-u").removeClass("hide")}else{Errorbox.show(D.error);$(A).set("value",B)}}}).send()},focus:function(){if(ctrl.get("newstmp")==false){$("newsletter_email").set("value","");$("newsletter_email").setStyle("color","#000000");ctrl.set("newstmp",1)}}};var Newsletterext={subscribe:function(A){var B=$(A).get("value");var C=new Request.JSON({url:"/php/xxl_newsletter.php",method:"post",data:{email:B,action:"subscribeext",xxl_session:ctrl.get("session_id")},onComplete:function(D){if(D.ok){var F="/php/xxl_get_req.php?type=newsletter_subscribed_ext&xxl_session="+ctrl.get("session_id");var E=new Request({onComplete:function(G,H){$("newsletterbox_ext").set("html",G)}.bind(this)}).get(F)}else{Alerter.show({duration:150,transition:Fx.Transitions.linear,draggable:false,modalize:true,button:true,backgroundcolor:"#333333"},D.title,D.error);$(A).set("value",B)}}}).send()},focus:function(){if(ctrl.get("newstmpext")==false){$("newsletter_email_ext").set("value","");$("newsletter_email_ext").setStyle("color","#000000");ctrl.set("newstmpext",1)}}};function fileUploadSingle(E,B,D){if($("uploadTarget")){$("uploadTarget").destroy()}var C=new Class({Implements:Chain,initialize:function(){this.chain.apply(this,arguments)}});var A=new C(function(){Infobox.load("/php/xxl_get_req.php?type=upload_single_standalone_new&xxl_session="+ctrl.get("session_id"),{duration:0,height:"500",width:"377",button:false,transparent:true})},function(){new fileUpload($("fileUploadSingle"),$("button_standalone"))},function(){$("product_standalone").set("value",E)},function(){if(B){$("product_border").set("value",B)}},function(){if(D){$("product_frame").set("value",D)}});A.callChain();A.callChain();A.callChain();A.callChain();A.callChain()}function show_flash(G,D,E,A,H,F,C,B){document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+E+'" height="'+A+'" id="'+D+'">');document.write('<param name="movie" value="'+G+'" />');document.write('<param name="FlashVars" value="'+B+'">');document.write('<param name="quality" value="'+H+'" />');document.write('<param name="menu" value="'+F+'" />');document.write('<param name="wmode" value="transparent" />');document.write('<param name="bgcolor" value="'+C+'" />');document.write('<embed src="'+G+'" swLiveConnect="true" menu="'+F+'" FlashVars="'+B+'" quality="'+H+'" bgcolor="'+C+'" width="'+E+'" height="'+A+'" wmode="transparent" name="'+D+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');document.write("</object>")}function doNothing(){}var QUMaterialList={data:null,options:{url:"/ajax/global/quickuploader",material_layer:"layer_material",group_layer:"layer_material_groups",building_layer:"layer_material_buildings",close_button:"button_close_material",back_button:"back-to-groups",group_prefix:"material_group",material_prefix:"material",building_prefix:"material_building",input:"format-output",selector:"format-plus"},init:function(A){this.options.selected_material=A;this.loadList()},loadList:function(){var A=new Request.JSON({url:this.options.url,method:"get",data:{action:"material_list"},onComplete:function(B){this.data=B;this.buildList();this.selectMaterial(this.options.selected_material);$(this.options.selector).addEvent("mousedown",function(C){C.stop();this.show()}.bind(this));$(this.options.input).addEvent("mousedown",function(C){C.stop();this.show()}.bind(this));$(this.options.close_button).addEvent("click",function(C){C.stop();this.hide()}.bind(this));$(this.options.back_button).addEvent("click",function(C){C.stop();this.showGroups()}.bind(this))}.bind(this)}).send()},buildList:function(){var I=new Element("ul");var A=new Element("div");for(var J=0;J<this.data.length;J++){if(this.data[J].materials.length==1){var B=this.options.material_prefix+this.data[J].materials[0].id;var K=this.data[J].materials[0].text;var L="QUMaterialList.loadFormats("+this.data[J].materials[0].id+");"}else{var B=this.options.group_prefix+this.data[J].id;var F=this.options.building_prefix+this.data[J].id;var K=this.data[J].text;var L="QUMaterialList.showBuilding("+this.data[J].id+");";var G=new Element("ul",{id:F,"class":"hide"});for(j=0;j<this.data[J].materials.length;j++){var H=new Element("a",{html:this.data[J].materials[j].text,href:"javascript:QUMaterialList.loadFormats("+this.data[J].materials[j].id+");"});var E=new Element("li",{id:this.options.material_prefix+this.data[J].materials[j].id});H.inject(E);E.inject(G)}G.inject(A)}var C=new Element("a",{html:K,href:"javascript:"+L});var D=new Element("li",{id:B});C.inject(D);D.inject(I)}I.inject($(this.options.group_layer));A.inject($(this.options.building_layer));return },selectMaterial:function(A){$(this.options.input).set("html",$(this.options.material_prefix+A).getElement("a").get("html"));this.setMaterialSelection(A);this.options.selected_material=A},setMaterialSelection:function(C){for(var B=0;B<this.data.length;B++){if(this.data[B].materials.length>1){$(this.options.group_prefix+this.data[B].id).removeClass("selected")}for(var A=0;A<this.data[B].materials.length;A++){if(this.data[B].materials[A].id==C){$(this.options.material_prefix+this.data[B].materials[A].id).addClass("selected");if(this.data[B].materials.length>1){$(this.options.group_prefix+this.data[B].id).addClass("selected")}}else{$(this.options.material_prefix+this.data[B].materials[A].id).removeClass("selected")}}}},setGroupSelection:function(B){for(var A=0;A<this.data.length;A++){if(this.data[A].id==B){$(this.options.group_prefix+this.data[A].id).addClass("selected")}else{if(this.data[A].materials.length>1){$(this.options.group_prefix+this.data[A].id).removeClass("selected")}else{$(this.options.material_prefix+this.data[A].materials[0].id).removeClass("selected")}}}},show:function(){this.showGroups();$(this.options.material_layer).removeClass("hide")},hide:function(){this.selectMaterial(this.options.selected_material);this.hideBuildings();$(this.options.material_layer).addClass("hide")},showBuilding:function(A){this.setGroupSelection(A);(function(){this.hideGroups();$(this.options.building_layer).removeClass("hide");$(this.options.building_prefix+A).removeClass("hide")}).delay(250,this)},hideBuildings:function(){$(this.options.building_layer).addClass("hide");for(var A=0;A<this.data.length;A++){if(this.data[A].materials.length>1){$(this.options.building_prefix+this.data[A].id).addClass("hide")}}},showGroups:function(){this.hideBuildings();$(this.options.group_layer).removeClass("hide")},hideGroups:function(){$(this.options.group_layer).addClass("hide")},loadFormats:function(A){this.selectMaterial(A);QUFormatList.loadList(A);this.hide.delay(250,this)}};var QUFormatList={Implements:Options,options:{url:"/ajax/global/quickuploader",productList:"productList",productMan:"productMan",preloader:"format_preloader",formatSelectionTarget:"layer_format",formatSelectionTargetContent:"layer_format_content"},init:function(A){this.requestHash=new Hash();$("button_close_format").addEvent("mousedown",this.toggleFormatList.bind(this));this.loadList(A)},loadList:function(B){var A=new Request.JSON({url:this.options.url,method:"get",data:{action:"format_list",material_id:B},onRequest:function(){$(this.options.productList).empty();$(this.options.preloader).removeClass("hide")}.bind(this),onComplete:function(C){$(this.options.preloader).addClass("hide");this.buildList(C)}.bind(this)}).send()},buildList:function(K){var H=new Array();var I=new Element("table",{cellpadding:"0",cellspacing:"0",summary:"",border:"0",width:"438"});var C=new Element("tbody").inject(I);K.each(function(N,O){if(N.feat>0){H[N.feat]=N}var Q=(O%2==0)?"highlight":"";var P=new Element("tr",{"class":Q}).inject(C);P.addEvent("click",function(){this.formatChoice.set({value:N.products_id,checked:"checked"});$("selectedProduct").set("html",N.name+" &nbsp; "+N.product_price);$("manproductradio").removeEvents("mousedown");this.toggleFormatList()}.bind(this));new Element("td",{html:N.name,width:100,align:"right"}).store("value",N.print_width).inject(P);new Element("td",{html:N.category_name,width:155,align:"center"}).store("value",N.category_id).inject(P);if(N.frame==1){new Element("img",{src:"/images/website/designer/designer_left/ok.gif",height:"10px",width:"9px",alt:""}).store("value",1).inject(new Element("td",{align:"center",width:120}).inject(P))}else{new Element("td",{html:"&nbsp;",width:120}).store("value",0).inject(P)}new Element("td",{html:N.product_price,width:63,align:"right"}).store("value",N.product_value).inject(P);new Element("td",{html:"&nbsp;",width:10,align:"right"}).inject(P)}.bind(this));$(this.options.formatSelectionTargetContent).empty();I.inject($(this.options.formatSelectionTargetContent));var M=new Element("table",{cellpadding:0,cellspacing:0,summary:""});var G=new Element("tbody").inject(M);var B=H.length;for(var F=1;F<B;F++){var E=H[F];var J=new Element("tr").injectInside(G);if(F==1){check="checked"}else{check=""}var L=new Element("input",{type:"radio",name:"product",id:"product"+E.products_id,value:E.products_id,checked:check}).injectInside(new Element("td").inject(J));if(E.marked==1){new Element("label",{"for":"product"+E.products_id,html:E.name}).injectInside(new Element("td").injectInside(J));new Element("label",{"for":"product"+E.products_id,html:'<span style="color: red; font-weight: bold;">'+E.product_price+"</span> &nbsp; <strike>"+E.std_price+"</strike>"}).inject(new Element("td",{align:"right"}).inject(J))}else{new Element("label",{"for":"product"+E.products_id,html:E.name}).injectInside(new Element("td").injectInside(J));new Element("label",{"for":"product"+E.products_id,html:E.product_price}).inject(new Element("td",{align:"right"}).inject(J))}}$(this.options.productList).empty();M.inject($(this.options.productList));this.formatChoice=new Element("input",{name:"product",type:"radio",id:"manproductradio",events:{mousedown:function(N){N.stop();this.toggleFormatList()}.bind(this)}});var J=new Element("tr").injectInside(G);var D=new Element("td").injectInside(J);this.formatChoice.injectInside(D);var A=new Element("div",{"class":"input-container"});new Element("div",{type:"text","class":"more-formats",id:"selectedProduct",html:$("more-formats-dummy").get("html"),events:{mousedown:this.toggleFormatList.bind(this)}}).inject(A);new Element("a",{"class":"plus",events:{mousedown:this.toggleFormatList.bind(this)}}).inject(A);var D=new Element("td").injectInside(J);D.set("colspan",2);A.injectInside(D)},toggleFormatList:function(){var A=ctrl.get("material_id")||22;if($(this.options.formatSelectionTarget).getStyle("display")=="none"){$$(".format_filter_head").each(function(C){C.addEvent("click",function(E){E.stop();var D=C.getParent();if(D.hasClass("selected")){$$(".format_filter_footer").getElement("p").set("styles",{display:"inline"});D.removeClass("selected");D.getElements(".format_filter_body area").removeEvents()}else{$$(".format_filter_head").getParent().removeClass("selected");$$(".format_filter_footer").getElement("p").set("styles",{display:"none"});D.addClass("selected");D.getElements(".format_filter_body area").each(function(F){F.addEvent("click",this.setFilter.bindWithEvent(D,F.get("alt")))}.bind(this))}}.bind(this))}.bind(this));if(Browser.Engine.name.contains("trident")){var B=this.formatChoice.getCoordinates();$("nav").setStyle("z-index","-1");$$(".quantity_inner").setStyle("display","none")}else{var B=this.formatChoice.getPosition($("content_right"));$(this.options.formatSelectionTarget).setStyle("top",(B.y-293)+"px")}$(this.options.formatSelectionTarget).setStyle("display","block");QUMaterialList.hide()}else{$(this.options.formatSelectionTarget).setStyle("display","none");$$(".format_filter_head").removeEvents();if(Browser.Engine.name.contains("trident")){$$(".quantity_inner").setStyle("display","inline");$("nav").setStyle("z-index","5000")}}$("format_filter_remove").addEvent("click",this.removeAllFilter.bindWithEvent(this))},setFilter:function(E,D){E.stop();var B=JSON.decode(D);var C=$("layer_format_content").getElement("table");var A=0;C.getElements("tbody tr").each(function(J,I){J.removeClass("highlight");var H=J.getElements("td")[B.column];if(B.value<0){J.removeClass("format_filter_hide_"+B.column);if(!J.get("class")){if(A%2!=0){J.addClass("highlight")}A++}$("format_filter_remove").removeClass("format_filter_remove_"+B.column)}else{$("format_filter_remove").addClass("format_filter_remove_"+B.column);var G=H.retrieve("value");var F=B.value;if(B.type&&String(B.type)=="float"){G=parseFloat(G);F=parseFloat(F)}else{if(B.type&&String(B.type)=="string"){G=String(G);F=String(F)}else{G=G.toInt();F=F.toInt()}}if(String(B.opt)=="max"){if(G<=F){J.removeClass("format_filter_hide_"+B.column);if(!J.get("class")){if(A%2!=0){J.addClass("highlight")}A++}}else{J.addClass("format_filter_hide_"+B.column)}}else{if(String(B.opt)=="min"){if(G>=F){J.removeClass("format_filter_hide_"+B.column);if(!J.get("class")){if(A%2!=0){J.addClass("highlight")}A++}}else{J.addClass("format_filter_hide_"+B.column)}}else{if(G==F){J.removeClass("format_filter_hide_"+B.column);if(!J.get("class")){if(A%2!=0){J.addClass("highlight")}A++}}else{J.addClass("format_filter_hide_"+B.column)}}}}});this.getElement(".format_filter_footer p").set("html",B.html);this.getElements(".format_filter_body area").removeEvents();this.removeClass("selected");$$(".format_filter_footer").getElement("p").set("styles",{display:"inline"})},removeAllFilter:function(B){var A=$("layer_format_header").getChildren();A.each(function(D,C){var E=this.setFilter.bind(D);E(B,"{'html':'&nbsp;','value':'-1','column':'"+C+"'}")},this)}};var fileUpload=new Class({Implements:Options,options:{url:"/cgi-bin/xxl_upload.cgi",errorURL:"/php/xxl_error.php",cartUrl:"/cgi-bin/test.cgi?site=konfigurator",requestTimeOut:1000,toMByte:1048576,statusBarWidth:317,toInject:"upload_single",maxFileSizeMB:30},initialize:function(D,G,A,F){this.form=D;this.starter=G;if(ctrl.get("maxFileSizeMB")){var C=parseFloat(ctrl.get("maxFileSizeMB"));if(C&&C>0){this.options.maxFileSizeMB=C}}this.lastUploadId=0;this.starter.addEvent("click",this.startUpload.bind(this));this.form.set("target","uploadTarget");this.iframe=new IFrame({name:"uploadTarget",id:"uploadTarget",styles:{height:"1px",width:"1px",border:"0"}}).inject(document.getElement("body"));this.date=new Date();this.sessionId=ctrl.get("session_id");var B=this.date.getTime().toString();this.uploadId=this.sessionId.substr(0,(this.sessionId.length-B.length))+B;var E=this.options.url;if(E.match(/\?/)){E+="&progress_id="+this.uploadId}else{E+="?progress_id="+this.uploadId}D.set("action",E);this.statusRequest=new Request({url:"/UpdateProgress?progress_id="+this.uploadId,method:"post",enctype:"multipart/form-data",onComplete:this.updateStatus.bind(this)});this.statusRequest.setHeader("Accept","text/x-json; q=1.1")},startStatus:function(){this.statusRequest.send()},startUpload:function(C){if(Browser.Engine.name.contains("trident")){$$("select").setStyle("display","none")}if(!this.iframe||!$("uploadTarget")){this.iframe=new IFrame({name:"uploadTarget",id:"uploadTarget",styles:{height:"1px",width:"1px",border:"0"}}).inject(document.getElement("body"))}var E=new Event(C).stop();var B=this.form.getElement("input[name=userImage]").get("value");if(B.length>0){var D=/\.(?:jpg|jpeg|jpe|tif|tiff)$/i;if(D.test(B)){if($("button_standalone")){$("uploadForm").setStyle("display","none");$("uploadStatusTextProgress").setStyle("display","block");this.options.toInject="upload_single_standalone"}else{Infobox2.loadURL("/php/xxl_get_req.php?rd=no-cache&type=upload_single&xxl_session="+ctrl.get("session_id"),{width:"377",height:"100"});Infobox2.show()}this.form.submit();var F=new Element("div",{"class":"uploadStatusBarWrapper"}).inject($(this.options.toInject));this.statusBar=new Element("div",{"class":"uploadStatusBar",styles:{width:"0px"}}).inject(F);this.receivedSize=new Element("p",{"class":"fileUploadReceivedSize",html:"0"}).inject($(this.options.toInject));this.receivedSizePercent=new Element("div",{"class":"fileUploadReceivedSizePercent",html:""}).inject(F);this.startStatus()}else{var A=new Request.JSON({url:this.options.errorURL,data:{error:"invalid_upload_filetype",xxl_session:ctrl.get("session_id")},onComplete:function(G){Alerter.show({duration:50,transition:Fx.Transitions.linear,draggable:false,modalize:true,button:true,backgroundcolor:"#333333"},G.title,G.error)}}).send()}}else{var A=new Request.JSON({url:this.options.errorURL,data:{error:"missing_upload_file",xxl_session:ctrl.get("session_id")},onComplete:function(G){Alerter.show({duration:50,transition:Fx.Transitions.linear,draggable:false,modalize:true,button:true,backgroundcolor:"#333333"},G.title,G.error)}}).send()}},updateStatus:function(F,I){var C=JSON.decode(F);var H=(C.size/this.options.toMByte).toFixed(2);if((C.size/this.options.toMByte).toFixed(2)>this.options.maxFileSizeMB){this.statusRequest.cancel();if(Browser.Engine.name.contains("trident")){document.execCommand("Stop")}else{window.stop()}this.errorUploading()}else{var D=this.form.getElement("input[name=userImage]").get("value");if(D.match(/.*\\.*/)){var E=/^.*\\(.*)$/;E.exec(D);D=RegExp.$1}else{if(D.match(/.*\/.*/)){var E=/^.*\/(.*)$/;E.exec(D);D=RegExp.$1}}var G=33;if(D.length>G){D=D.substring(0,G)+"..."}var A=(C.received/this.options.toMByte).toFixed(2);this.receivedSize.set("html",A+" MB / "+H+" MB");this.receivedSizePercent.set("html",D+" ("+(C.received/(C.size/100)).toFixed(0)+"%)");var B=(this.options.statusBarWidth/C.size)*C.received;this.statusBar.setStyle("width",B.round()+"px");if(C.size!=C.received){this.statusRequest.send.delay(this.options.requestTimeOut,this.statusRequest)}else{this.uploadFinishedTest=this.isUploadComplete.periodical(1000,this)}}},isUploadComplete:function(){var E=false;var A="";$try(function(){A=frames[this.iframe.get("name")].document.getElementById("uploadResult").innerHTML;E=true}.bind(this));if(E){var B=JSON.decode(A);if(B.status=="OK"&&B.id!=this.lastUploadId){this.lastUploadId=B.id;$clear(this.uploadFinishedTest);if(B.redirect){window.location=B.redirect+"?xxl_session="+this.sessionId}else{if(confirm("Noch ein Bild hochladen?")){this.form.reset()}else{window.location=this.options.cartUrl+"&xxl_session="+this.sessionId}}}else{if(B.status=="ERROR"){$clear(this.uploadFinishedTest);var D="";var C=new Request.JSON({url:this.options.errorURL,data:{error:"saving_upload_image_failed",xxl_session:ctrl.get("session_id")},onComplete:function(F){D=F.error;$("upload_txt").set("html",D)}}).send();$$(".uploadStatusBar").setStyles({width:"273px","background-image":"url(/images/website/content/content_right/uploader/loader_status_bar_red.gif)"})}else{}}}else{}},errorUploading:function(){var A=new Request.JSON({url:this.options.errorURL,data:{error:"invalid_upload_filesize",xxl_session:ctrl.get("session_id")},onComplete:function(B){Alerter.show({duration:50,transition:Fx.Transitions.linear,draggable:false,modalize:false,button:true,backgroundcolor:"#333333"},B.title,B.error)}}).send();$$(".uploadStatusBar").setStyles({width:"273px","background-image":"url(/images/website/content/content_right/uploader/loader_status_bar_red.gif)"})}});var Slide2Delta=new Class({Extends:Fx.Slide,vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;myMargin=this.element.getStyle("margin").toInt();myHeight=this.element.getStyle("height").toInt()},compute:function(D,C,B){var A=[];(2).times(function(E){if(myMargin!=-(myHeight-product_nav.myDelta)){A[E]=Fx.compute(D[E],C[E]+product_nav.myDelta,B)}else{A[E]=Fx.compute(D[E],C[E],B)}});return A},close:function(A,B){this[B||this.options.mode]();this.open=true;if(myMargin==0){return this.set([-(this.offset-A),A])}else{if(myMargin<0){return this.set([-(this.offset-A),A])}}}});var product_nav_slider={duration:350,offsetStart:94,startAnimationWidth:94,list:"product-nav-elements",knob:"product-nav-knob",slider:"product-nav-slider",init:function(C){this.elements=$(this.list).getChildren().length;this.elementWidth=parseInt($(this.list).getElement("li").getStyle("width"));this.listWidth=parseInt($(this.list).getStyle("width"));this.button_difference=this.elementWidth;$(this.list).getElements("li").each(function(G){var F=G.getElement(".flash").get("href");G.getElement(".flash").dispose();var E=new Element("div",{"class":"flash"});new Swiff(F,{width:120,height:90,container:E});E.inject(G,"top")});var B=(this.elements*this.elementWidth)/this.listWidth;var A=Math.round((parseInt($(this.slider).getStyle("width"))/B)*0.5);$(this.knob).setStyle("width",A);var D=new Fx.Transition(Fx.Transitions.Circ);this.knobFX=new Fx.Tween(this.knob,{duration:this.duration,transition:D.easeOut});this.sliderFX=new Fx.Scroll(this.list,{duration:this.duration,transition:D.easeOut});this.scrollRange=(this.elements*this.elementWidth)-this.listWidth;if(C){this.offsetStart=Math.round(parseInt($("pn-"+C).getStyle("left"))+(this.elementWidth)-(this.listWidth/2));if(this.offsetStart>this.scrollRange){this.offsetStart=this.scrollRange}if(this.offsetStart<this.startAnimationWidth){this.offsetStart=0;this.startAnimationWidth*=-1}}this.sliderObject=new Productslider(this.slider,this.knob,{range:[0,this.scrollRange],onSmoothTick:function(F,E){product_nav_slider.setPosition(F,E,"smooth")},onDirectTick:function(F,E){product_nav_slider.setPosition(F,E,"direct")}});this.sliderObject.set(this.offsetStart-this.startAnimationWidth);$(this.list).getElements("li").setStyle("visibility","visible");$("product-nav-arrow-left").addEvent("mousedown",function(E){this.sliderObject.setSmooth(this.sliderObject.step-this.button_difference);E.stop()}.bind(this));$("product-nav-arrow-right").addEvent("mousedown",function(E){this.sliderObject.setSmooth(this.sliderObject.step+this.button_difference);E.stop()}.bind(this))},startAnimation:function(){if(!this.elements){window.setTimeout("product_nav_slider.startAnimation()",100);return }$(this.knob).setStyle("visibility","visible");this.sliderObject.setSmooth(this.offsetStart)},setPosition:function(C,A,B){if(B=="smooth"){this.knobFX.cancel();this.sliderFX.cancel();this.knobFX.start("left",C);this.sliderFX.start(A,0)}else{this.knobFX.cancel();this.sliderFX.cancel();$(this.knob).setStyle("left",C);$(this.list).scrollTo(A,0)}},click:function(A){location.href=$("pn-"+A).getElement(".text").get("href")}};var Productslider=new Class({Implements:[Events,Options],Binds:["clickedElement"],options:{range:false,offset:0,steps:240},initialize:function(E,A,D){this.setOptions(D);this.element=$(E);this.knob=$(A);this.previousChange=this.previousEnd=this.step=-1;var F,B={},C={x:false,y:false};this.axis="x";this.property="left";F="offsetWidth";this.half=this.knob[F]/2;this.full=this.element[F]-this.knob[F]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);C[this.axis]=this.property;B[this.axis]=[-this.options.offset,this.full-this.options.offset];this.bound={clickedElement:this.clickedElement.bind(this),drag:this.drag.bind(this),detachMovement:this.detachMovement.bind(this)};this.attach()},attach:function(){this.element.addEvent("mousedown",this.bound.clickedElement);return this},detach:function(){this.element.removeEvent("mousedown",this.bound.clickedElement);return this},attachMovement:function(){document.addEvent("mousemove",this.bound.drag);document.addEvent("mouseup",this.bound.detachMovement);$("product-blinder").setStyle("display","block");return this},detachMovement:function(){document.removeEvent("mousemove",this.bound.drag);document.removeEvent("mouseup",this.bound.detachMovement);$("product-blinder").setStyle("display","none");this.end();return this},setSmooth:function(A){this.set(A,"smooth")},set:function(A,B){if(!((this.range>0)^(A<this.min))){A=this.min}if(!((this.range>0)^(A>this.max))){A=this.max}this.step=Math.round(A);if(B=="smooth"){this.fireEvent("smoothTick",[this.toPosition(this.step),this.step])}else{this.fireEvent("directTick",[this.toPosition(this.step),this.step])}this.end();return this},clickedElement:function(C){if(C.target!=this.knob){var B=this.range<0?-1:1;var A=C.page[this.axis]-this.element.getPosition()[this.axis]-this.half;A=A.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+B*this.toStep(A));this.fireEvent("smoothTick",[A,this.step]);this.knobOffset=this.half}else{this.knobOffset=C.page[this.axis]-this.knob.getPosition()[this.axis]}this.attachMovement();C.stop()},drag:function(C){var B=this.range<0?-1:1;var A=C.page[this.axis]-this.element.getPosition()[this.axis];A-=this.knobOffset;A=A.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+B*this.toStep(A));this.fireEvent("directTick",[A,this.step]);C.stop()},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"")}},toStep:function(A){var B=(A+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(B-=B%this.stepSize):B},toPosition:function(A){return Math.round((this.full*Math.abs(this.min-A))/(this.steps*this.stepSize)-this.options.offset)}});var product_nav={show_minimized:function(){},show_maximized:function(){},show_medium_sized:function(){},show_none:function(){}};function get_qs(A){hu=window.location.search.substring(1);gy=hu.split("&");for(i=0;i<gy.length;i++){val=gy[i].split("=");if(val[0]==A){return val[1]}}return null}var HistoryManager=new Class({Implements:[Events,Options],options:{delay:500,oldHash:"",triggerOnLoad:false},initialize:function(A){this.setOptions(A);this.start()},start:function(){if(!this.options.triggerOnLoad){this.oldHash=this.getHash()}if(!window.ie6&&!window.ie7){this.checkHash.periodical(this.options.delay,this)}},checkHash:function(B){var C=this.getHash();if(this.oldHash!=C){this.oldHash=C;var A=new Querystring(C);this.fireEvent("triggerEvent",A)}},getHash:function(){url=location.href;var B=new RegExp("[#]([^$]*)");var A=B.exec(url);return(A==null)?"":A[1]},setHash:function(A){this.oldHash=A;if(!A){A="#"}location.hash=A}});function Querystring(A){this.params={};this.get=function(G){var H=this.params[G];return(H!=null)?H:""};this.contains=function(G){var H=this.params[G];return(H!=null)};if(A==null||A.length==0){A=""}A=A.replace(/\+/g," ");var C=A.split("&");for(var D=0;D<C.length;D++){var F=C[D].split("=");var B=decodeURIComponent(F[0]);var E=(F.length==2)?decodeURIComponent(F[1]):B;this.params[B]=E}}Array.prototype.contains=function(B){var A;for(A=0;A<this.length;A++){if(this[A]==B){return true}}return false};var Tabs={options:{defaultTab:"",url:"",data:{}},initialize:function(B){if(B){this.options=$merge(this.options,B)}this.historyManager=new HistoryManager({onTriggerEvent:function(C){this.show(C.get("t"))}.bind(this)});var A=new Querystring(this.historyManager.getHash());if(A&&A.contains("t")){this.show(A.get("t"))}else{Tabs_UI.activateTab(this.options.defaultTab);Tabs_UI.showHideTabContent(true);this.onChange()}},sendRequest:function(A){this.options.data.tab=A;var B=new Request.JSON({url:this.options.url,onComplete:this.getResponse.bind(this)}).post(this.options.data)},getResponse:function(A){Tabs_UI.fill(A.content);Tabs_UI.deactivateTabs();Tabs_UI.activateTab(A.tab);Tabs_UI.showHideTabContent(true);this.onChange()},show:function(A){if(!A){A=this.options.defaultTab}this.historyManager.setHash("t="+A);Tabs_UI.showHideTabContent(false);this.sendRequest(A)},onChange:function(){}};var Tabs_UI={options:{contentElement:"tab-content",contentPreloader:"tab-content-preloader"},Implements:Options,fill:function(A){$(this.options.contentElement).set("html",A)},showHideTabContent:function(A){if(A){$(this.options.contentElement).removeClass("hide-v");$(this.options.contentPreloader).addClass("hide")}else{$(this.options.contentElement).addClass("hide-v");$(this.options.contentPreloader).removeClass("hide")}},deactivateTabs:function(){$$("ul#pt-tabs li").removeClass("active")},deactivateTab:function(A){$("pt-"+A).removeClass("active")},activateTab:function(A){$("pt-"+A).addClass("active")}};