var ShippingProfile=function(){return{cancelEvent:function(A){if(!A){A=window.event}A.cancelBubble=true;if(A.stopPropagation){A.stopPropagation()}},sCurMod:"",initPage:function(){var D=getObj("where_we_ship");var B=getObj("chat_text");var C=getObj("warning_chat_text");var A="";if(D){ShippingProfile.activateModule(D.getAttribute("data-defaultCountry"))}},activateModule:function(G){var D=getObj("container_"+G);var C=getObj("currency_container_"+G);var B=getObj("currency_"+G);var A=getObj("language_container_"+G);var E=getObj("language_"+G);var F=getObj("link_"+G);if(D&&C&&B&&F){D.className="active_module";C.style.display="block";F.style.display="inline";B.disabled=false;if(A&&E){A.style.display="block";E.disabled=false;F.setAttribute("data-baseServer",E.value)}F.setAttribute("data-submitUrl",F.getAttribute("data-baseServer")+F.getAttribute("data-basePage")+"curr="+B.value+"&pre_context="+F.getAttribute("data-preferredContext"));ShippingProfile.sCurMod=G}},deactivateModule:function(G){var D=getObj("container_"+G);var C=getObj("currency_container_"+G);var B=getObj("currency_"+G);var A=getObj("language_container_"+G);var E=getObj("language_"+G);var F=getObj("link_"+G);if(D&&C&&B&&F){D.className="inactive_module";C.style.display="none";F.style.display="none";B.disabled=true;if(A&&E){E.disabled=true;A.style.display="none"}}},selectCountry:function(C){var A="";var B=getEventSrc(C);if(B){if(B.id!=ShippingProfile.sCurMod){ShippingProfile.deactivateModule((ShippingProfile.sCurMod));ShippingProfile.activateModule(B.id)}}ShippingProfile.cancelEvent(C)},currencyChange:function(C){var B=getEventSrc(C);var D=null;var A=null;if(B){D=getObj(B.id.replace("currency_","link_"));A=getObj(B.id.replace("currency_","language_"));if(D){if(A){D.setAttribute("data-baseServer",A.value)}D.setAttribute("data-submitUrl",D.getAttribute("data-baseServer")+D.getAttribute("data-basePage")+"curr="+B.value+"&pre_context="+D.getAttribute("data-preferredContext"))}}ShippingProfile.cancelEvent(C)},languageChange:function(C){var B=getEventSrc(C);var E=null;var D=null;var A="";if(B){E=getObj(B.id.replace("language_","link_"));D=getObj(B.id.replace("language_","currency_"));if(D){A="&curr="+D.value}if(E){E.setAttribute("data-baseServer",B.value);E.setAttribute("data-submitUrl",E.getAttribute("data-baseServer")+E.getAttribute("data-basePage")+"&pre_context="+E.getAttribute("data-preferredContext")+A)}}ShippingProfile.cancelEvent(C)},switchCountries:function(D){var C=getEventSrc(D);var B,A,E;if(C){B=C.getAttribute("data-submitUrl");A=C.getAttribute("data-oldProductSet");E=C.getAttribute("data-newProductSet");if(A!=E){ShippingProfile.openProductSetWarning()}else{ShippingProfile.redirectUser(B)}}ShippingProfile.cancelEvent(D)},openProductSetWarning:function(){var C=$("#product_set_warning");var F=getObj("warning_dynamic_text");var J=getObj("background_fade");var G=getObj("container_"+ShippingProfile.sCurMod);var E=getObj("link_"+ShippingProfile.sCurMod);var L=E.getAttribute("data-oldCountryName");var B=E.getAttribute("data-newCountryName");var D=0;var H=null;if(C&&F&&J&&G&&E){F.innerHTML="You will lose the contents of your shopping basket when changing from our "+L+" site to our "+B+" site.";var A=$(window).height();var I=$(document).width();var K=$(document).height();C.css({display:"block",left:I/2-(C.width()/2),top:A/2-(C.height()/2)});H=getBrowserSize();J.style.height=K+"px";J.style.width=I+"px";J.style.display="block";window.scrollTo(0,0)}},changeProductSet:function(B){var A=getObj("currency_"+ShippingProfile.sCurMod);var C=getObj("link_"+ShippingProfile.sCurMod);if(A&&C){ShippingProfile.redirectUser(C.getAttribute("data-baseServer")+"default.jsp?curr="+A.value+"&pre_context="+C.getAttribute("data-preferredContext"))}ShippingProfile.cancelEvent(B)},closeProductSetWarning:function(A){var B=getObj("product_set_warning");var C=getObj("background_fade");if(B&&C){B.style.display="none";C.style.display="none"}ShippingProfile.cancelEvent(A)},redirectUser:function(A){window.location=A},ShippingProfileRules:{"#where_we_ship input.country_radio":function(A){addEvent(A,"click",ShippingProfile.selectCountry,false);A=null},"#where_we_ship .currency_menu":function(A){addEvent(A,"change",ShippingProfile.currencyChange,false);A=null},"#where_we_ship .language_menu":function(A){addEvent(A,"change",ShippingProfile.languageChange,false);A=null},"#where_we_ship img.link_button":function(A){addEvent(A,"click",ShippingProfile.switchCountries,false);A=null},"#product_set_warning div.change_product_set":function(A){addEvent(A,"click",ShippingProfile.changeProductSet,false);A=null},"#product_set_warning div.close_warning, div.background_fade":function(A){addEvent(A,"click",ShippingProfile.closeProductSetWarning,false);A=null}},initShippingProfile:function(){if(Behaviour){Behaviour.registerAndApply(ShippingProfile.ShippingProfileRules);ShippingProfile.initPage()}}}}();if(LoadState.addToLoadQueue){LoadState.addToLoadQueue(ShippingProfile.initShippingProfile,null,"ShippingProfile.initShippingProfile()")};
