var ApplicationContext,NavigationService,ImageLoaderService,TrafficTrackerService,ShopService,LocaleMessageResolverService,PayPalPaymentProcessorService,CheckPaymentProcessorService,Panel,ToolTipPanel,HelpPanel,InteractiveHelpPanel,DialogPanel,WaitingServerReplyPanel,FormManager,FormElement,MultipleSelectFormElement,ProxyFormElement,RequiredCheckboxElement,CheckboxFormElement,SelectFormElement,RadioFormElement,UserCart,ShopItem,ShippingPolicy,ShopCategory,CustomizationPanel,ColorPicker,ReferenceItem,ShippingPolicyRule,ShippingPolicyEditor,AccountController,AuthenticationController,ContactController,HelpPanelController,LocaleSwitcherController,ShippingController,ShopBrowsingController,ShopCategoryController,ShopItemController,UserCartController,DecorationController,ShopCategoryEditorController,ShopEditorController,ShopEditorItemController,payPalPaymentProcessor,checkPaymentProcessor,imageLoaderService,trafficTrackerService,localeMessageResolverService;ApplicationContext={initializeFromAdminDomain:function(a){var b=a.evalJSON();this.initializeTrafficTrackerService(undefined);this.environment=b.environment;this.initializeNavigationService(true);NavigationService.processNavigationStateChange()},initializeFromPresentationDomain:function(){this.initializeTrafficTrackerService(undefined);this.initializeNavigationService(true)},initializeFromJSONData:function(a){var b=a.evalJSON();this.environment=b.environment;this.initialData=b.initialData;this.initializeLocaleService(b.locale,b.messages);imageLoaderService=new ImageLoaderService();this.createPrototypeTemplates(b);ShopCategoryController.createHierarchy(b.categoriesData);if(!b.createCategoryTemplate){ShopBrowsingController.initialize(b)}else{this.createPrototypeEditorTemplates(b);this.initializeEditor(b)}this.initializePaymentProcessors();this.initializeTrafficTrackerService(b.trackingCode);this.initializeNavigationService(false);this.initializeHistoryService()},initializeEditor:function(a){ShopEditorController.initialize(a);DecorationController.initialize(a.availableDecorations);ShopCategoryController.insertControls();if(a.helpTutorialContentsTemplate){ShopEditorController.helpTutorialContentsTemplate=a.helpTutorialContentsTemplate}},initializePaymentProcessors:function(){payPalPaymentProcessor=new PayPalPaymentProcessorService();checkPaymentProcessor=new CheckPaymentProcessorService()},initializeLocaleService:function(a,b){localeMessageResolverService=new LocaleMessageResolverService(a);localeMessageResolverService.addMessages(b)},initializeTrafficTrackerService:function(a){trafficTrackerService=new TrafficTrackerService(a)},initializeNavigationService:function(a){NavigationService.setup(a);NavigationService.updateGlobalNavigationListeners()},initializeHistoryService:function(){dhtmlHistory.create({toJSON:function(a){return Object.toJSON(a)},fromJSON:function(a){return a.evalJSON()},blankSource:"/support/rsh/blank.html"});dhtmlHistory.initialize();dhtmlHistory.addListener(NavigationService.processNavigationStateChange.bind(NavigationService))},createPrototypeTemplates:function(a){ShopCategory.template=a.categoryTemplate;ShopItem.previewTemplate=a.itemPreviewTemplate;ShopItem.detailTemplate=a.itemDetailTemplate;ShopItem.fullTemplate=a.itemFullTemplate;ShopItem.itemCartDetailTemplate=a.itemCartDetailTemplate;ShopBrowsingController.currentPageNavigationTemplate=a.currentPageNavigationTemplate;ShopBrowsingController.pageNavigationTemplate=a.pageNavigationTemplate},createPrototypeEditorTemplates:function(a){ReferenceItem.previewTemplate=a.referenceItemPreviewTemplate;ReferenceItem.detailTemplate=a.referenceItemDetailTemplate;ShopCategoryController.createCategoryTemplate=a.createCategoryTemplate;InteractiveHelpPanel.arrowImageSources=a.arrowImageSources;ShopCategoryController.deleteCategoryNode=$$(".EmbeddedTemplateNode.DeleteCategory").first().remove()},getBean:function(a){return window[a]}};var urlRegularExpression=/http:\/\/.*?\/(.*)/;var relativeURLRegularExpression=/http:\/\/.*\/(.*)/;function retrieveURLFromHRef(a,c){if(Prototype.Browser.IE){var b=a.match(c?relativeURLRegularExpression:urlRegularExpression);if(b){return((c?"":"/")+b[1])}}return a}function updateCSS(c,b,a){if(Prototype.Browser.IE||Prototype.Browser.WebKit){while(true){try{deleteCSSRule(a,0)}catch(d){break}}c.split("}").reverse().each(function(e){if(-1!=e.indexOf("{")){insertCSSRule(a,e+"\n}",0)}})}else{b.update(c)}}function insertCSSRule(a,d,b){var c,e;if(Prototype.Browser.IE){c=d.substr(0,d.indexOf("{"));e=c.split(",");e.each(function(f){document.styleSheets[a].addRule(f,d.substr(d.indexOf("{")),b)})}else{document.styleSheets[a].insertRule(d,b)}}function deleteCSSRule(a,b){if(Prototype.Browser.IE){document.styleSheets[a].removeRule(b)}else{document.styleSheets[a].deleteRule(b)}}function fixRendering(){}function capitalize(a){if(a){return a.charAt(0).toUpperCase()+a.slice(1)}else{return undefined}}FormElement=Class.create({initialize:function(b,a){this.manager=a;this.optional=false;this.element=b;b.up().childElements().each(function(c){if(c.hasClassName("FormFieldStatus")){this.formFieldStatus=c}}.bind(this));if(this.formFieldStatus){this.formFieldStatus.hide()}},setFormFieldStatus:function(a){this.formFieldStatus=a;this.formFieldStatus.hide();return this},disable:function(){this.disabled=true},enable:function(){this.disabled=false},setCheckboxRequired:function(a){this.requiredFormElement=a;return this},setRadioButtonRequired:function(a){this.requiredFormElement=a;return this},setMandatoryConstraint:function(a){this.mandatory=true;if(a){this.mandatoryErrorMessage=a}return this},removeMandatoryConstraint:function(){this.mandatory=false;return this},setPositiveConstraint:function(a){this.positive=true;this.positiveErrorMessage=a;return this},setMinimalConstraint:function(a,c,b){this.minimalNumber=a;this.minimalStrict=c;this.minimalErrorMessage=b;return this},setLengthConstraint:function(b,a,c){this.length=true;this.minLength=b;this.maxLength=a;this.lengthErrorMessage=c;return this},setHexadecimalConstraint:function(a){this.hexadecimal=true;this.hexadecimalErrorMessage=a;return this},setEmailConstraint:function(a){this.email=true;this.emailErrorMessage=a;return this},setRegularExpression:function(a,b){this.regularExpressionConstraint=true;this.regularExpression=a;this.regularExpressionErrorMessage=b;return this},setConfirmationConstraint:function(a,b){a.originConfirmation=true;a.targetConfirmationElement=this;this.confirmation=true;this.confirmationOriginElement=a.element;this.confirmationErrorMessage=b;return this},setServerConstraint:function(a){this.serverConstraint=true;this.serverURL=a;this.validServerConstraint=true;return this},setCustomConstraint:function(b,a){this.customConstraint=true;this.customErrorMessage=a;this.customConstraintCallback=b;return this},setCustomCallback:function(a){this.customCallback=a;return this},setLengthNotification:function(){this.element.observe("keypress",this.onKeyPress.bindAsEventListener(this));return this},setInstantValidation:function(){this.element.observe("change",this.onChange.bindAsEventListener(this));return this},setValidMessage:function(a){this.validMessage=a;return this},setOptional:function(a){this.optional=true;this.optionalName=a},updateErrorMessage:function(a){if(this.formFieldStatus){this.formFieldStatus.show().update(a).removeClassName("ValidFormField").addClassName("InvalidFormField")}},checkMandatoryConstraint:function(){if($F(this.element).empty()){this.updateErrorMessage(this.mandatoryErrorMessage);return false}return true},checkPositiveConstraint:function(){var a=localeMessageResolverService.convertStringToNumber($F(this.element),true);if(a<0){this.updateErrorMessage(this.positiveErrorMessage);return false}return true},checkMinimalConstraint:function(){var a=localeMessageResolverService.convertStringToNumber($F(this.element),true);if((a>this.minimalNumber)||(a==this.minimalNumber)&&!this.minimalStrict){return true}else{this.updateErrorMessage(this.minimalErrorMessage);return false}},checkLengthConstraint:function(){var a=$F(this.element).length;if((0!=a)&&((a<this.minLength)||(a>this.maxLength))){this.updateErrorMessage(this.lengthErrorMessage);return false}return true},checkHexadecimalConstraint:function(){var a=/^[0-9A-Fa-f]*$/;if(!a.test($F(this.element))){this.updateErrorMessage(this.hexadecimalErrorMessage);return false}return true},checkEmailConstraint:function(){var a=/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/;if(!a.test($F(this.element))){this.updateErrorMessage(this.emailErrorMessage);return false}return true},checkRegularExpressionConstraint:function(){if(!this.regularExpression.test($F(this.element))){this.updateErrorMessage(this.regularExpressionErrorMessage);return false}return true},checkConfirmationConstraint:function(){if(($F(this.element)!=$F(this.confirmationOriginElement))){this.updateErrorMessage(this.confirmationErrorMessage);return false}return true},checkServerConstraint:function(){var a=new Hash();a.set(this.element.readAttribute("name"),$F(this.element));new Ajax.Request(this.serverURL,{method:"get",onSuccess:this.receiveCheckServerConstraint.bind(this),parameters:a.toObject()})},receiveCheckServerConstraint:function(b){var a=b.responseJSON;if(a.result){this.validServerConstraint=true;this.setValid()}else{this.validServerConstraint=false;this.updateErrorMessage(a.resultMessage)}},checkCustomConstraint:function(){if(this.customConstraintCallback(this.element)){return true}this.updateErrorMessage(this.customErrorMessage);return false},onChange:function(a){this.validate(false);if(this.customCallback){this.customCallback()}},onKeyPress:function(b){var a=$F(this.element).length;this.formFieldStatus.update(a+" characters / "+this.maxLength+" allowed.").show();if(a>this.maxLength){this.formFieldStatus.removeClassName("ValidFormField").addClassName("InvalidFormField")}else{this.formFieldStatus.removeClassName("InvalidFormField").addClassName("ValidFormField")}},validate:function(b){var a=true;if(this.disabled){return}if(this.requiredFormElement){if(!this.requiredFormElement.isElementPresent(this)){return}}if(this.originConfirmation&&$F(this.targetConfirmationElement.element)){this.targetConfirmationElement.onChange(b)}if(this.mandatory){a=this.checkMandatoryConstraint()}if(a&&this.positive){a=this.checkPositiveConstraint()}if(a&&undefined!=this.minimalNumber){a=this.checkMinimalConstraint()}if(a&&this.length){a=this.checkLengthConstraint()}if(a&&this.hexadecimal){a=this.checkHexadecimalConstraint()}if(a&&this.email){a=this.checkEmailConstraint()}if(a&&this.regularExpressionConstraint){a=this.checkRegularExpressionConstraint()}if(a&&this.confirmation){a=this.checkConfirmationConstraint()}if(a&&this.customConstraint){a=this.checkCustomConstraint()}if(a&&this.serverConstraint){if(!b){this.checkServerConstraint()}else{a=this.validServerConstraint}}else{if(a){this.setValid()}}this.manager.valid=a&&this.manager.valid},setValid:function(){if(this.validMessage){this.formFieldStatus.update(this.validMessage).addClassName("ValidFormField").removeClassName("InvalidFormField").show()}else{if(this.formFieldStatus){this.formFieldStatus.hide()}}},getData:function(a){},setBoundObjectData:function(){var a=this.element.readAttribute("name");if(undefined!=this.manager.boundObject[a]){this.manager.boundObject[a]=$F(this.element)}},setData:function(){var a=this.element.readAttribute("name");if(undefined!=this.manager.boundObject[a]){this.element.setValue(this.manager.boundObject[a])}if(this.optional&&this.manager.boundObject[this.optionalName]){this.element.up().show()}}});ProxyFormElement=Class.create(FormElement,{initialize:function($super,b,a){$super(b,a);this.originElement=$$("input[type=text][name="+this.element.readAttribute("name")+"]").first();this.formFieldStatus=this.originElement.up().down(".FormFieldStatus");this.element=this.originElement},validate:function($super,a){this.getData(new Hash());$super(a)},getData:function(c){var a,b,d;a=this.element.readAttribute("name");b=$$("input[type=checkbox][name="+a+"Activation]");if(0!=b.size()){if(b.first().checked){d=this.originElement.getValue()}else{d=""}}else{d=this.originElement.getValue()}c[a]=d}});MultipleSelectFormElement=Class.create(FormElement,{initialize:function($super,b,a){$super(b,a);this.targetElement=b.down(".MultipleSelectorTarget");this.sourceElement=b.down(".MultipleSelectorSource");this.formFieldStatus=b.down(".FormFieldStatus").hide();b.down(".MultipleSelectorAddButton").observe("click",this.addSelectedElements.bindAsEventListener(this));b.down(".MultipleSelectorRemoveButton").observe("click",this.removeSelectedElements.bindAsEventListener(this))},addToSourceElements:function(b,a){this.sourceElement.insert({bottom:'<option value="'+b+'">'+a+"</option>"})},addSelectedElements:function(){this.sourceElement.select("option").each(function(a){if(a.selected&&(this.targetElement.select("option[value="+a.value+"]").size()==0)){this.targetElement.insert({bottom:'<option value="'+a.value+'">'+a.innerHTML+"</option>"})}}.bind(this))},removeSelectedElements:function(){this.targetElement.select("option").each(function(a){if(a.selected){a.remove()}})},addElement:function(b){var a=this.sourceElement.down("option[value="+b+"]");if(a&&0==this.targetElement.select("option[value="+b+"]").size()){this.targetElement.insert({bottom:'<option value="'+b+'">'+a.innerHTML+"</option>"})}},checkMandatoryConstraint:function(){if(0==this.targetElement.descendants().size()){this.formFieldStatus.show().update(this.mandatoryErrorMessage).removeClassName("ValidFormField").addClassName("InvalidFormField");return false}return true},setBoundObjectData:function(){this.targetElement.descendants().each(function(b){b.selected=true});var a=this.targetElement.readAttribute("name");if(undefined!=this.manager.boundObject[a]){this.manager.boundObject[a]=$F(this.targetElement)}this.targetElement.descendants().each(function(b){b.selected=false})},getData:function(a){this.targetElement.descendants().each(function(b){b.selected=true});a[this.targetElement.readAttribute("name")]=$F(this.targetElement);this.targetElement.descendants().each(function(b){b.selected=false})},setData:function(){var a,b;this.targetElement.update("");a=this.targetElement.readAttribute("name");b=this.manager.boundObject[a];if(undefined!=b){b.each(function(c){this.addElement(c)}.bind(this))}}});SelectFormElement=Class.create(FormElement,{checkMandatoryConstraint:function(){if("NONE"==$F(this.element)){this.updateErrorMessage(this.mandatoryErrorMessage);return false}return true},setupAsElementSelector:function(a){this.elementSelector=true;this.callback=this.defaultCallback.bindAsEventListener(this);if(a){if(a.additionalCallback){this.additionalCallback=a.additionalCallback}if(a.callback){this.callback=a.callback}}this.element.observe("change",this.callback);this.callback();return this},defaultCallback:function(a){this.refreshView();if(this.additionalCallback){this.additionalCallback()}},refreshView:function(a){this.element.select("option").each(function(b){if(b.selected){$(b.value+capitalize(this.element.readAttribute("name"))).show()}else{$(b.value+capitalize(this.element.readAttribute("name"))).hide()}}.bind(this))},setData:function($super){$super();if(this.elementSelector){this.callback()}}});RadioFormElement=Class.create(FormElement,{initialize:function(c,b){var a=c;this.manager=b;if("label"==c.up().tagName.toLowerCase()){a=c.parentNode}this.element=a.nextSiblings().collect(function(d){return d.match("input[type='radio']")?d:d.down("input[type='radio']")});this.element=this.element.without(undefined);this.element.push(c)},setupAsElementSelector:function(a){this.elementSelector=true;this.callback=this.defaultCallback.bindAsEventListener(this);if(a){if(a.additionalCallback){this.additionalCallback=a.additionalCallback}if(a.callback){this.callback=a.callback}}this.element.invoke("observe","click",this.callback);this.callback();return this},defaultCallback:function(a){this.refreshView();if(this.additionalCallback){this.additionalCallback()}},refreshView:function(a){this.element.each(function(b){if(b.checked){$(b.value+capitalize(b.readAttribute("name"))).show()}else{$(b.value+capitalize(b.readAttribute("name"))).hide()}})},isElementPresent:function(b){var a=false;this.element.each(function(c){if(c.checked){if((c.value==b.element.readAttribute("name"))){a=true;return}}});return a},setData:function($super){var a=this.manager.boundObject[this.element.first().readAttribute("name")];this.element.each(function(b){b.checked=(b.readAttribute("value")==a)});if(this.elementSelector){this.callback()}},validate:function(a){}});CheckboxFormElement=Class.create(FormElement,{setupAsElementSelector:function(a){this.elementSelector=true;this.callback=this.defaultCallback.bindAsEventListener(this);if(a){if(a.inverse){this.inverse=true}if(a.inactiveEffect){this.inactiveEffect=a.inactiveEffect}if(a.disable){this.disableDependentElement=true}if(a.additionalCallback){this.additionalCallback=a.additionalCallback}if(a.callback){this.callback=a.callback}}this.element.observe("click",this.callback);this.callback();return this},defaultCallback:function(a){this.refreshView();if(this.additionalCallback){this.additionalCallback()}},refreshView:function(){var c,b,a;a=this.element.readAttribute("name").sub(".*\\.","");b=$$("."+capitalize(a)+"CheckboxLinked");if(this.disableDependentElement){c=this.inverse?(this.element.checked?"disable":"enable"):(this.element.checked?"enable":"disable")}else{c=this.inverse?(this.element.checked?"hide":"show"):(this.element.checked?"show":"hide")}b.invoke(c);if(this.inactiveEffect){if(this.element.checked){this.inactiveEffect.removeClassName("Inactive")}else{this.inactiveEffect.addClassName("Inactive")}}},isElementPresent:function(a){return this.inverse?(!$F(this.element)):$F(this.element)},uncheck:function(){this.element.checked=false;this.callback()},setData:function(){var a=this.element.readAttribute("name");if(undefined!=this.manager.boundObject[a]){this.element.checked=this.manager.boundObject[a]}if(this.elementSelector){this.callback()}},validate:function(a){}});FormManager=Class.create({initialize:function(a){this.waitingPanel=true;this.reset(a)},reset:function(a){this.formElements=new Array();this.boundObject=undefined;this.form=a;this.slaveForms=new Array();this.XMLHTTPRequest=true;if("multipart/form-data"==this.form.enctype||this.form.hasClassName("DirectNavigationState")){this.XMLHTTPRequest=false}this.form.stopObserving().observe("submit",this.validate.bindAsEventListener(this))},obtainFormElement:function(a){return this.formElements.find(function(b){return b.element==a})},addSlaveForm:function(a){this.slaveForms.push(a)},getCorrectElementClass:function(a){if(a.hasClassName("MultipleSelector")){return new MultipleSelectFormElement(a,this)}if(a.hasClassName("Proxy")){return new ProxyFormElement(a,this)}if("select"==a.tagName.toLowerCase()){return new SelectFormElement(a,this)}if("checkbox"==a.readAttribute("type")){return new CheckboxFormElement(a,this)}if("radio"==a.readAttribute("type")){return new RadioFormElement(a,this)}return new FormElement(a,this)},registerElement:function(b){var a=this.getCorrectElementClass(b);this.formElements.push(a);return a},registerElements:function(a){a.each(function(b){this.registerElement(b)}.bind(this))},bindObjectToForm:function(a){this.boundObject=a;this.formElements.invoke("setData")},bindDataToForm:function(a){this.boundObject=a;this.formElements.invoke("setData");this.boundObject=undefined},setAdditionalValidation:function(a){this.additionalValidation=a},setAdditionalDataSubmit:function(a){this.additionalDataSubmit=a},setSuccessCallback:function(a){this.successCallback=a},setFailureCallback:function(a){this.failureCallback=a},setUncaughtFailureCallback:function(a){this.uncaughtFailureCallback=a},setSubmitCallback:function(a){this.submitCallback=a},setNoWaitingPanel:function(){this.waitingPanel=false},getData:function(){var b,a;b=new Hash(Form.serializeElements(this.form.select(".StandardSerialization"),true));this.slaveForms.each(function(c){a=Form.serializeElements(c.select(".StandardSerialization"),true);b=b.update(a)});b=b.toObject();this.formElements.invoke("getData",b);if(this.boundObject){this.formElements.invoke("setBoundObjectData");b.object=this.boundObject.toJSON()}if(this.additionalDataSubmit){this.additionalDataSubmit(b)}return b},validate:function(b){var c,a;b.stop();this.valid=true;this.formElements.invoke("validate",true);this.errorMessage=undefined;if(this.additionalValidation){this.valid=this.valid&&this.additionalValidation()}if(this.valid){c=this.getData();if(this.XMLHTTPRequest){this.submit(c)}else{a=this.form.down("input[name='parametersData']");if(a){a.setValue(Object.toQueryString(c))}this.form.submit()}}else{if(!this.errorMessage){this.errorMessage='<div class="InvalidFormMessage">'+localeMessageResolverService.getMessage("js.errors.general.form.submit")+"</div>"}this.form.firstDescendant().update(this.errorMessage)}},setErrorMessage:function(a){this.errorMessage=a},submit:function(b){var a=this.form.readAttribute("action")+"?ajax=true";if(this.submitCallback){this.submitCallback()}if(this.waitingPanel){NavigationService.showWaitingServerReplyPanel()}new Ajax.Request(a,{method:"post",onSuccess:this.successGenericForm.bind(this),onFailure:this.failureGenericForm.bind(this),parameters:b})},successGenericForm:function(d){var b,c,a;c=d.responseJSON;if(this.waitingPanel){NavigationService.hideWaitingServerReplyPanel()}a=d.getResponseHeader("X-Shoopz-Controller");if(a){NavigationService.successGenericCallback(a,d.getResponseHeader("X-Shoopz-Action"),d);return}this.form.firstDescendant().update(c.resultMessage);if(c.result){if(this.successCallback){this.successCallback(c)}else{b=NavigationService.parseURL(this.form.readAttribute("action"));controller=NavigationService.obtainJavaScriptController(b[0]);action=b[1];callback=controller["success"+capitalize(action)];if(callback){callback.bind(controller)(c)}}}else{if(d.getResponseHeader("X-Shoopz-Exception")){this.failureGenericForm(d)}else{if(this.failureCallback){this.failureCallback(c)}else{b=NavigationService.parseURL(this.form.readAttribute("action"));controller=NavigationService.obtainJavaScriptController(b[0]);action=b[1];callback=controller["failure"+capitalize(action)];if(callback){callback.bind(controller)(c)}}}}},failureGenericForm:function(a){if(this.waitingPanel){NavigationService.hideWaitingServerReplyPanel()}this.form.firstDescendant().update('<div class="InvalidFormMessage">'+localeMessageResolverService.getMessage("js.errors.general.form.internal")+"</div>");if(this.uncaughtFailureCallback){this.uncaughtFailureCallback()}if("development"==ApplicationContext.environment){SystemController.handleServerError(a.responseText)}}});Panel=Class.create({initialize:function(a,b){this.element=a;this.callingElement=b;this.clearOptions();this.verticalMargin=Panel.DEFAULT_TOP_MARGIN;this.horizontalMargin=Panel.DEFAULT_RIGHT_MARGIN},clearOptions:function(){this.topFavored=false;this.bottomFavored=false;this.rightFavored=false;this.leftFavored=false;this.topOrBottomFavored=false;this.forbidScreenCenter=false;this.forbidVertical=false;this.forbidTopOrBottom=false;this.centerVerticalPosition=false;this.bottomVerticalPosition=false;this.cornerPosition=false;this.appearEffect="";this.finalHorizontalPosition="";this.finalVerticalPosition=""},setCallingElement:function(a){this.callingElement=a;return this},setFixedPosition:function(){this.element.setStyle({position:"fixed"});return this},unsetFixedPosition:function(){this.element.setStyle({position:"absolute"});return this},setContent:function(a){this.element.update(a);this.element.cleanWhitespace();return this},setTopPosition:function(){this.topFavored=true;this.topOrBottomFavored=true;return this},setBottomPosition:function(){this.bottomFavored=true;this.topOrBottomFavored=true;return this},setRightPosition:function(){this.rightFavored=true;return this},forbidScreenCentering:function(){this.forbidScreenCenter=true;return this},forbidVerticalMove:function(){this.forbidTopOrBottom=true;this.forbidVertical=true;return this},setCenterVerticalPosition:function(){this.centerVerticalPosition=true;return this},setDisableCallback:function(a){this.disableCallback=a;return this},setCornerPosition:function(){this.topOrBottomFavored=true;this.cornerPosition=true;return this},setHorizontalMargin:function(a){this.horizontalMargin=a;return this},setVerticalMargin:function(a){this.verticalMargin=a;return this},setAppearEffect:function(){this.appearEffect="grow";return this},setFadingAppearEffect:function(){this.appearEffect="fading";return this},setDraggable:function(a){this.draggable=new Draggable(this.element,{handle:a,scroll:window});return this},setupPosition:function(){this.dimensions=this.element.getDimensions();this.callingElementOffset=this.callingElement.cumulativeOffset();this.callingElementDimensions=this.callingElement.getDimensions();this.screenDimensions=document.viewport.getDimensions();this.scrollOffsets=document.viewport.getScrollOffsets()},checkHorizontalPosition:function(a){if((a+this.dimensions.width+Panel.VIEWPORT_RIGHT_MARGIN>this.screenDimensions.width)||(a<Panel.VIEWPORT_LEFT_MARGIN)){return false}return true},checkVerticalPosition:function(a){if((this.topFavored)&&(a>=Panel.VIEWPORT_TOP_MARGIN)){return true}if((a+this.dimensions.height+Panel.VIEWPORT_BOTTOM_MARGIN-this.scrollOffsets.top>this.screenDimensions.height)||(a-this.scrollOffsets.top<Panel.VIEWPORT_TOP_MARGIN)){return false}return true},obtainCenterVerticalPositionTopValue:function(){return Math.round(this.callingElementOffset[1]+(this.callingElementDimensions.height-this.dimensions.height)*0.5)},prepareView:function(){this.setupPosition();var c,h,i,g,a,d,b,e,f;i=false;g=this.rightFavored;a=this.bottomFavored;d=this.topOrBottomFavored;b=this.centerVerticalPosition;e=this.cornerPosition;c=this.callingElementOffset[0]-this.dimensions.width-this.horizontalMargin;this.finalHorizontalPosition="left";if((!this.checkHorizontalPosition(c))||(g)){c=this.callingElementOffset[0]+this.callingElementDimensions.width+this.horizontalMargin;this.finalHorizontalPosition="right";if(!this.checkHorizontalPosition(c)){if(this.forbidTopOrBottom){i=true}else{d=true}}}if(!d){this.finalVerticalPosition="center";h=this.callingElementOffset[1];if(!this.checkVerticalPosition(h)){b=true}if(b){h=this.obtainCenterVerticalPositionTopValue();if(h<Panel.VIEWPORT_TOP_MARGIN){h=Panel.VIEWPORT_TOP_MARGIN}if(!this.checkVerticalPosition(h)){f=true}}if(f){h=this.callingElementOffset[1]+this.callingElementDimensions.height-this.dimensions.height;if(!this.checkVerticalPosition(h)){h=this.callingElementOffset[1]}}}else{if(!e){this.finalHorizontalPosition="center";c=this.callingElementOffset[0];if(!this.checkHorizontalPosition(c)||(g)){c=this.callingElementOffset[0]+this.callingElementDimensions.width-this.dimensions.width;if(!this.checkHorizontalPosition(c)){i=true}}}h=this.callingElementOffset[1]-this.dimensions.height-this.verticalMargin;this.finalVerticalPosition="top";if((!this.checkVerticalPosition(h))||(a)){h=this.callingElementOffset[1]+this.callingElementDimensions.height+this.verticalMargin;this.finalVerticalPosition="bottom";if(!this.checkVerticalPosition(h)){i=true}}}if((!i)||this.forbidScreenCenter){this.element.setStyle({top:h+"px",left:c+"px"});this.elementOffset=[c,h]}else{this.centerOnScreen()}},displayDebugData:function(){console.log(this.element);console.log("Calling element position: "+this.callingElementOffset);console.log("Calling element dimensions: "+this.callingElementDimensions.width+", "+this.callingElementDimensions.height);console.log("Element computed position: "+this.elementOffset);console.log("Vertical Position: "+this.finalVerticalPosition);console.log("Horizontal Position: "+this.finalHorizontalPosition)},centerOnScreen:function(){var b,a;this.finalVerticalPosition="center";this.finalHorizontalPosition="center";b=Math.round(this.screenDimensions.height*0.5-this.dimensions.height*0.5+this.scrollOffsets.top);a=Math.round(this.screenDimensions.width*0.5-this.dimensions.width*0.5);if(b<Panel.VIEWPORT_TOP_MARGIN){b=Panel.VIEWPORT_TOP_MARGIN}if(!this.forbidVertical){this.element.setStyle({top:b+"px",left:a+"px"})}else{this.finalVerticalPosition="unchanged";b=this.element.cumulativeOffset()[0];this.element.setStyle({left:a+"px"})}this.elementOffset=[b,a]},enable:function(){this.prepareView();var a=this.element.down(".CloseButton");if(a){a.stopObserving().observe("click",this.disableEvent.bindAsEventListener(this))}a=this.element.down(".ClosePanel");if(a){a.stopObserving().observe("click",this.disableEvent.bindAsEventListener(this))}this.show();return this},disableEvent:function(a){a.stop();this.disable()},disable:function(a){if(this.disableCallback){this.disableCallback()}else{this.hide()}},show:function(){switch(this.appearEffect){case"grow":new Effect.Grow(this.element);case"fading":new Effect.Fade(this.element,{duration:2.5});default:this.element.show()}},hide:function(){this.element.hide();return this},destroy:function(){this.hide();(this.draggable&&this.draggable.destroy())},toggle:function(){this.element.toggle()}});Panel.DEFAULT_TOP_MARGIN=20;Panel.DEFAULT_BOTTOM_MARGIN=20;Panel.DEFAULT_LEFT_MARGIN=20;Panel.DEFAULT_RIGHT_MARGIN=20;Panel.VIEWPORT_TOP_MARGIN=20;Panel.VIEWPORT_BOTTOM_MARGIN=20;Panel.VIEWPORT_LEFT_MARGIN=20;Panel.VIEWPORT_RIGHT_MARGIN=20;DialogPanel=Class.create(Panel,{enable:function($super){this.forbidVerticalMove();var a=Math.max(document.body.getHeight(),document.viewport.getHeight());$("opacityLayer").setStyle({height:a+"px"});$("opacityLayer").observe("click",this.disable.bindAsEventListener(this));$super();this.hide();Effect.Appear($("opacityLayer"),{from:0,to:0.65,duration:0.4,afterFinish:function(){Effect.BlindDown(this.element,{duration:0.4})}.bind(this)});return this},disable:function($super){$super();$("opacityLayer").stopObserving();Effect.Fade($("opacityLayer"),{from:0.65,to:0,duration:0.4})}});HelpPanel=Class.create(Panel,{initialize:function($super,b,c){var a=c.next(".HelpContent");$super(b,c);b.down(".Content").update(a.innerHTML);b.down(".Title").update(c.next(".HelpTitle").innerHTML);if(a.hasClassName("Standard")){b.removeClassName("Large").addClassName("Standard")}if(a.hasClassName("Large")){b.removeClassName("Standard").addClassName("Large")}},show:function($super){$super();var a=Math.max(document.body.getHeight(),document.viewport.getHeight());$("opacityLayer").setStyle({height:a+"px"}).show().observe("click",this.hide.bindAsEventListener(this));$("opacityLayer").setOpacity(0.5)},hide:function($super){$super();$("opacityLayer").hide();$("opacityLayer").stopObserving()}});ToolTipPanel=Class.create(Panel,{initialize:function($super,a,b){$super(a,b);$("hiddenPanels").insert({bottom:this.element.remove()})},enable:function(){this.callingElement.observe("mouseover",this.show.bindAsEventListener(this));this.callingElement.observe("mouseout",this.hide.bindAsEventListener(this));this.callingElement.observe("mousemove",this.moveToolTip.bindAsEventListener(this));return this},disable:function(a){if(this.disableCallback){this.disableCallback()}else{this.hide();this.callingElement.stopObserving("mouseover").stopObserving("mouseout").stopObserving("mousemove")}},doNotShowUntilMove:function(){this.firstMove=true},setupPosition:function(){this.callingElementOffset=[this.pointerXPosition,this.pointerYPosition];this.callingElementDimensions={width:1,height:1};this.dimensions=this.element.getDimensions();this.screenDimensions=document.viewport.getDimensions();this.scrollOffsets=document.viewport.getScrollOffsets()},moveToolTip:function(a){this.pointerXPosition=a.pointerX();this.pointerYPosition=a.pointerY();this.prepareView();if(this.firstMove){this.firstMove=false;this.show()}},show:function(){if(!this.firstMove){this.element.show()}},destroy:function(){this.element.remove()}});WaitingServerReplyPanel=Class.create(Panel,{pulsateWaitingServerPanel:function(){new Effect.Opacity(this.element.down("span"),{duration:1.5,from:0.5,to:1,afterFinish:function(){new Effect.Opacity(this.element.down("span"),{duration:1.5,from:1,to:0.5})}.bind(this)})},prepareView:function(){if(this.callingElement==document.body){var a=document.viewport.getWidth()*0.5-this.element.getWidth()*0.5;this.element.setStyle({left:a+"px"})}},enable:function($super){$super();this.pulsateWaitingServerPanel();this.periodicalExecuter=new PeriodicalExecuter(this.pulsateWaitingServerPanel.bind(this),3)},disable:function($super){$super();if(this.periodicalExecuter){this.periodicalExecuter.stop()}}});ShippingPolicy=Class.create({initialize:function(d,a,b,c){this.id=d;this.computedCost=c;this.computedCostString=localeMessageResolverService.convertNumberToString(c);this.description=b;this.name=a;this.prepareView()},prepareView:function(){var a=new Template(ShippingPolicy.template);$("shippingPolicySelectorBlock").insert({bottom:a.evaluate(this)});this.element=$$("#shippingPolicySelectorBlock input").last();this.element.observe("change",this.select.bindAsEventListener(this))},select:function(){$$("#checkoutShippingPolicies .ShippingPolicyDescription").first().update(this.description);$("checkoutTotalAmount").update(localeMessageResolverService.convertNumberToString(UserCartController.cart.total+this.computedCost));payPalPaymentProcessor.selectShippingPolicy(this);checkPaymentProcessor.selectShippingPolicy(this)},setChecked:function(){this.element.checked=true;return this}});ShopCategory=Class.create({initialize:function(a,b){this.name=a;this.id=b;this.children=[];this.itemContainer=false;this.parent=undefined},setParent:function(a){this.parent=a;a.children.push(this);return this},remove:function(){this.parent.children=this.parent.children.without(this)},isRoot:function(){if(this.parent==undefined){return true}else{return false}},setCurrentCategoryById:function(a){if(a==this.id){ShopCategoryController.currentCategory=this}else{this.children.invoke("setCurrentCategoryById",a)}},select:function(){if(this.isRoot()){return}this.hideSiblingsChildren();this.getChildrenDiv().show();ShopService.updateMainPanelTitle(this.name);ShopService.showAction()},hideSiblingsChildren:function(){this.parent.children.invoke("hideChildren")},hide:function(){$("category"+this.id).hide()},hideChildren:function(){this.getChildrenDiv().hide()},getElement:function(){return $("category"+this.id)},getChildrenDiv:function(){if(this.parent==undefined){return $("categories")}else{return $("category"+this.id+"Children")}},prepareView:function(){if(!this.isRoot()){var a=new Template(ShopCategory.template);this.parent.getChildrenDiv().insert({bottom:a.evaluate(this)});this.hideChildren();if(this.children.size()==0){this.itemContainer=true}}this.children.invoke("prepareView")}});ShopItem=Class.create({initialize:function(d,c,e,l,k,i,h,g,m,j,b,f,a){this.rank=0;this.id=d;this.name=c;this.shortDescription=e;this.description=l;this.manufacturer=k;this.model=i;this.previewImage=h;this.detailImage=g;this.fullImage=m;this.price=j;this.additionalInformation=b;this.status=f;this.outOfStock=a},obtainStatusDescription:function(){return localeMessageResolverService.getMessage("js.general.shopItem.status.description."+this.status)},displayPreview:function(){var a=new Template(ShopItem.previewTemplate);$("itemListPanel").insert({bottom:a.evaluate(this)});this.itemPreviewElement=$$("#itemListPanel .ItemPreview").last();imageLoaderService.requestPreloadImage(this.previewImage,2);imageLoaderService.requestPreloadImage(this.detailImage,4);if($$("#itemListPanel .ItemPreview").size()%4==1){this.itemPreviewElement.setStyle({clear:"both"})}if($$("#itemListPanel .ItemPreview").size()%4==0){this.itemPreviewElement.setStyle({marginRight:"0px"})}if(this.outOfStock){$$(".ItemPreviewTopRightColumn .AddCartButton").last().hide();$$(".ItemPreviewTopRightColumn .OutOfStockButton").last().show()}},displayDetailPanel:function(c){var b,a;b=new Template(ShopItem.detailTemplate);a=$$("#itemDetailPanel .AddCartAction").first();imageLoaderService.requestPreloadImage(this.fullImage,1);imageLoaderService.startPreloading();if(a){a.stopObserving()}ShopService.showItemDetailPanel();$$("#itemDetailPanelContent").first().update(b.evaluate(this));$("itemDetailPanel").down("img").observe("click",this.displayFullPanel.bindAsEventListener(this));$("itemDetailPanel").down(".ViewFullDetailsAction").observe("click",this.displayFullPanel.bindAsEventListener(this));document.fire("help:displayItemDetailPanel");NavigationService.updateNavigationListeners($("itemDetailPanel"))},displayFullPanel:function(c){var b,a,d;b=new Template(ShopItem.fullTemplate);c.stop();this.statusDescription=this.obtainStatusDescription();$("itemFullPanelContent").update(b.evaluate(this));ShopService.showItemFullPanel();a=$("fullPanelRightBlock");a.setStyle({marginLeft:"0px"});d=$$("img.ItemFullImage").first();d.observe("load",function(){var e=$("itemFullPanelContent").getWidth()-d.width;$("fullPanelRightBlock").setStyle({marginLeft:((e-a.getWidth())*0.5)+"px"})});$$("#itemFullPanelContent .CloseButton").first().observe("click",this.eraseFullPanel.bindAsEventListener(this));document.observe("click",this.eraseFullPanel.bindAsEventListener(this));$$(".ClickProtected").invoke("observe","click",function(e){e.stop()});document.fire("help:displayItemFullPanel");NavigationService.updateNavigationListeners($("itemFullPanel"))},eraseFullPanel:function(b){var a=$$("#itemFullPanelContent .AddCartAction").first();if(a){a.stopObserving()}document.stopObserving();$$(".ClickProtected").invoke("stopObserving");$("itemFullPanelContent").update("");ShopService.hideItemFullPanel()},prepareDetailedCartView:function(){var a=new Template(ShopItem.itemCartDetailTemplate);$("shoppingCartItemList").insert({bottom:a.evaluate(this)});this.cartToolTip=new ToolTipPanel($("shoppingCartItemList").select("div.ToolTip").last(),$("shoppingCartItemList").select("div.CartDetailItem").last()).enable();$("shoppingCartItemList").select("div.CartDetailItem span.Action").last().observe("click",this.displayFullPanel.bindAsEventListener(this))},removeCartToolTip:function(){this.cartToolTip.destroy()}});UserCart=Class.create({initialize:function(){this.items=[];this.total=0},resetItems:function(){this.initialize()},getTotal:function(){return this.total},setTotal:function(a){this.total=a},getItems:function(){return this.items},addItem:function(b){var a=this.items.find(this.findByIdAndVariation.curry(b.id,b.variationConfigurationKey));if(a){++a.quantity}else{b.quantity=1;this.items.push(b)}this.total+=localeMessageResolverService.convertStringToNumber(b.price,false)},removeItem:function(c,b){var a=this.items.find(this.findByIdAndVariation.curry(c,b));this.items.splice(this.items.indexOf(a),1);this.total-=localeMessageResolverService.convertStringToNumber(a.price,false)*a.quantity;return a},findByIdAndVariation:function(c,b,a){return(a.id==c&&(!b||a.variationConfigurationKey==b))},addItemWithQuantity:function(a,b){a.quantity=b;this.items.push(a);this.total+=localeMessageResolverService.convertStringToNumber(a.price,false)*a.quantity},addItemFromCurrentItems:function(c){var b,a;a=function(d){return(d.value.id==c)};b=ShopBrowsingController.items.find(a).value;this.addItem(b)},addItemWithVariation:function(b){var a=new ShopItem(b.id,b.name,b.shortDescription,b.description,b.manufacturer,b.model,b.previewImage,b.detailImage,b.fullImage,b.price,b.additionalInformation,b.status);a.variationConfigurationKey=b.variationConfigurationKey;a.variationDescription=b.variationDescription;this.addItem(a)},setupWithItems:function(a){this.initialize();if(undefined!=a){a.each(function(c){var b=new ShopItem(c.id,c.name,c.shortDescription,c.description,c.manufacturer,c.model,c.previewImage,c.detailImage,c.fullImage,c.price,c.additionalInformation,c.status);b.variationConfigurationKey=c.variationConfigurationKey;b.variationDescription=c.variationDescription;this.addItemWithQuantity(b,c.quantity)}.bind(this))}}});AccountController={readAccount:function(){ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("js.userAccount.edit.title"));NavigationService.processGenericServerCall(true)},successReadAccount:function(b){var a;$$("#mainPanel > .Dialog").first().update(b.resultMessage);ShopService.showOnlyMainPanelDialog();if(this.changeAccountManager){this.changeAccountManager.reset($("registerAccountForm"))}else{this.changeAccountManager=new FormManager($("registerAccountForm"))}this.changeAccountManager.setSuccessCallback(this.successUpdateAccount.bind(this));a=this.changeAccountManager.registerElement($("registerAccountPassword")).setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.password.valid")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.password.mandatory")).setLengthConstraint(7,20,localeMessageResolverService.getMessage("js.errors.userAccount.password.length")).setInstantValidation();this.changeAccountManager.registerElement($("registerAccountConfirmPassword")).setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.confirmPassword.valid")).setConfirmationConstraint(a,localeMessageResolverService.getMessage("js.errors.userAccount.confirmPassword.invalid")).setInstantValidation();this.changeAccountManager.registerElement($("registerAccountEmail")).setEmailConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.email.invalid")).setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.email.valid")).setServerConstraint("/account/checkEmail").setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.email.mandatory")).setInstantValidation();this.changeAccountManager.registerElement($("registerAccountAddress")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.address.mandatory")).setInstantValidation();this.changeAccountManager.registerElement($("registerAccountCity")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.city.mandatory")).setInstantValidation();this.changeAccountManager.registerElement($("registerAccountPostalCode")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.postalCode.mandatory")).setInstantValidation();this.changeAccountManager.registerElement($("registerAccountCountryCode")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.country.mandatory"))},failureReadAccount:function(a){$$("#mainPanel > .Dialog").first().update(a.resultMessage)},successUpdateAccount:function(a){ShopService.displayMessage(a.resultMessage);ShopService.showOnlyMainPanelDialog()},failureUpdateAccount:function(a){this.successReadAccount()}};AuthenticationController={toggleLoginPanel:function(){if(this.loginPanel){this.loginPanel.toggle()}else{this.loginPanel=new Panel($("loginPanel"),$("accountArea")).setCenterVerticalPosition();this.loginPanel.enable()}},authenticationDomain:function(a){NavigationService.processGenericServerCall(true)},successAuthenticationDomain:function(b){var a,c;a=$$("#mainPanel > .Dialog").first();a.update(b);ShopService.showOnlyMainPanelDialog();c=NavigationService.getQueryParameter("section");if(undefined==c||(undefined==this["authenticationSection"+c])){c="Login"}this["authenticationSection"+c]();document.fire("help:authenticationDomain");NavigationService.updateNavigationListeners(a)},authenticationSectionLogin:function(){$("sectionRegister").hide();$("sectionLogin").show();ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("images.general.account.login"))},authenticationSectionRegister:function(){var a;$("sectionRegister").show();$("sectionLogin").hide();ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("js.userAccount.register.title"));if(this.registerManager){this.registerManager.reset($("registerAccountForm"))}else{this.registerManager=new FormManager($("registerAccountForm"))}this.registerManager.setSuccessCallback(this.successRegister.bind(this));this.registerManager.registerElement($("registerAccountUserName")).setServerConstraint("/account/checkUserName").setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.userName.valid")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.userName.mandatory")).setInstantValidation();a=this.registerManager.registerElement($("registerAccountPassword")).setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.password.valid")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.password.mandatory")).setLengthConstraint(7,20,localeMessageResolverService.getMessage("js.errors.userAccount.password.length")).setInstantValidation();this.registerManager.registerElement($("registerAccountConfirmPassword")).setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.confirmPassword.valid")).setConfirmationConstraint(a,localeMessageResolverService.getMessage("js.errors.userAccount.confirmPassword.invalid")).setInstantValidation();this.registerManager.registerElement($("registerAccountEmail")).setEmailConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.email.invalid")).setValidMessage(localeMessageResolverService.getMessage("js.errors.userAccount.email.valid")).setServerConstraint("/account/checkEmail").setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.email.mandatory")).setInstantValidation();this.registerManager.registerElement($("registerAccountAddress")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.address.mandatory")).setInstantValidation();this.registerManager.registerElement($("registerAccountCity")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.city.mandatory")).setInstantValidation();this.registerManager.registerElement($("registerAccountPostalCode")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.postalCode.mandatory")).setInstantValidation();this.registerManager.registerElement($("registerAccountCountryCode")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.country.mandatory"))},successRegister:function(a){this.successLogin(a)},successRegisterTwo:function(b){var a=$$("#mainPanel > .Dialog").first();a.update(b);ShopService.showOnlyMainPanelDialog()},successLogin:function(c){var b,a;b=$$("#mainPanel > .Dialog").first();if(c.result){if(this.loginPanel){this.loginPanel.hide()}new Panel($("messagePanel"),$(document.body)).setContent(c.resultMessage).setFadingAppearEffect().enable();b.update("");a=$$("#topPanelRegion .ButtonContainer").first();a.update(c.topButtonsTemplate);NavigationService.updateNavigationListeners(a);NavigationService.reloadCurrentNavigationState()}},failureLogin:function(a){var b=$$("#loginForm .GeneralFormMessage").first();$$("#loginPanel .GeneralFormMessage").first().update(a.resultMessage);if(b){b.update(a.resultMessage)}},successLogout:function(b){var a;new Panel($("messagePanel"),$(document.body)).setContent(b.resultMessage).setFadingAppearEffect().enable();a=$$("#topPanelRegion .ButtonContainer").first();a.update(b.topButtonsTemplate);NavigationService.updateNavigationListeners(a);NavigationService.reloadCurrentNavigationState()}};ContactController={displaySendMessageToShopDialog:function(){if($("writeMessageToShopForm")){$$("#mainPanel > .Dialog").first().update()}NavigationService.processGenericServerCall(true)},successDisplaySendMessageToShopDialog:function(b){var a=$("dialogPanel");a.update(b);NavigationService.updateNavigationListeners(a);this.dialogPanel=new DialogPanel(a,$(document.body)).enable();if(this.writeMessageFormManager){this.writeMessageFormManager.reset($("writeMessageToShopForm"))}else{this.writeMessageFormManager=new FormManager($("writeMessageToShopForm"))}this.writeMessageFormManager.registerElement($("writeMessageToShopName")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.general.name.mandatory")).setInstantValidation();this.writeMessageFormManager.registerElement($("writeMessageToShopEmailAddress")).setEmailConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.email.invalid")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.userAccount.email.mandatory")).setInstantValidation();this.writeMessageFormManager.registerElement($("writeMessageToShopEmailMessage")).setMandatoryConstraint(localeMessageResolverService.getMessage("js.errors.contact.message.mandatory")).setInstantValidation()},successSendMessageToShop:function(b){var a=$$("#dialogPanel .Content").first();a.update(b.resultMessage);NavigationService.updateNavigationListeners(a)},closeDialog:function(){if(this.dialogPanel){this.dialogPanel.disable()}$("dialogPanel").update("")}};LocaleSwitcherController={URL_LANGUAGE_REGULAR_EXPRESSION:/^\/[a-z]{2}\//,toggleLocaleList:function(eventElement){if(this.panel){this.panel.toggle()}else{this.panel=new Panel($$(".LocaleList").first(),eventElement).setBottomPosition().setVerticalMargin(5).enable()}},selectLocale:function(locale){var c,b,d,a;a=window.location.pathname.match(this.URL_LANGUAGE_REGULAR_EXPRESSION);if(a){c="/"+locale+window.location.pathname.substr(3)}else{c="/"+locale+window.location.pathname}if(window.location.hash){a=window.location.hash.substr(1).match(this.URL_LANGUAGE_REGULAR_EXPRESSION);if(a){b="#/"+locale+window.location.hash.substr(4)}else{b="#/"+locale+window.location.hash.substr(1)}}else{b=""}d=window.location.protocol+"//"+window.location.hostname+c+window.location.search+b;if(d==window.location){this.toggleLocaleList()}else{window.location.assign(d)}}};HelpPanelController={displayHelp:function(eventElement){new HelpPanel($("helpPanel"),eventElement).enable()}};ShopBrowsingController={defaultAction:"getNewestItems",items:new Hash(),initializeBase:function(a){this.maxFrontItems=a.maxFrontItems;this.currentSort="dateEntered";UserCartController.cart.setupWithItems(a.userCartItems);UserCartController.refreshCartMainView();$("mainPanelAction").update(a.sortingTemplate);$("sortInput").observe("change",this.changeSorting.bindAsEventListener(this))},initialize:function(a){this.initializeBase(a)},resetCurrentItems:function(){this.items=new Hash()},addItem:function(a){this.items.set(a.rank,new ShopItem(a.id,a.name,a.shortDescription,a.description,a.manufacturer,a.model,a.previewImage,a.detailImage,a.fullImage,a.price,a.additionalInformation,a.status,a.outOfStock))},emptyAction:function(){},getNewestItems:function(){this.resetCurrentItems();this.currentPage=0;ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("js.general.front.items.title"));this.displayItems()},setupFromDisplayCategoryPage:function(currentPage,initialData){this.currentPage=parseInt(currentPage);this.receiveItems(initialData.items)},queryCategoryBase:function(c,b,a){if(a){if(a!=this.currentSort){this.resetCurrentItems()}this.currentSort=a}if(!ShopCategoryController.currentCategory||ShopCategoryController.currentCategory.id!=c){ShopCategoryController.rootCategory.setCurrentCategoryById(c);this.resetCurrentItems()}ShopCategoryController.currentCategory.select();ShopService.clearMainPanelDialog();ShopService.showItemListPanel();this.currentPage=b?parseInt(b):0;this.displayItems();document.fire("help:queryCategory")},queryCategory:function(id,currentPage,sort){this.queryCategoryBase(id,currentPage,sort)},searchItems:function(currentPage){ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("general.search.results.title"));this.resetCurrentItems();this.currentPage=parseInt(currentPage);this.displayItems()},displayResultMessage:function(a){ShopService.clearItemListPanel();if(!a.keepNavigation){$("mainPanelNavigation").hide()}if(a.resultMessage){ShopService.displayMessage(a.resultMessage)}else{}},displayMessage:function(){ShopService.clearItemListPanel();ShopService.hideAction()},news:function(){if(!NavigationService.firstLoad){NavigationService.processGenericServerCall(true)}},successNews:function(b){var a;ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("js.general.front.news.title"));a=$$("#mainPanel > .Dialog").first();a.update(b);ShopService.showOnlyMainPanelDialog();NavigationService.updateNavigationListeners(a)},faq:function(){if(!NavigationService.firstLoad){NavigationService.processGenericServerCall(true)}},successFaq:function(b){var a;ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("corporate.faq.header"));a=$$("#mainPanel > .Dialog").first();a.update(b);ShopService.showOnlyMainPanelDialog();NavigationService.updateNavigationListeners(a)},about:function(){if(!NavigationService.firstLoad){NavigationService.processGenericServerCall(true)}},successAbout:function(b){var a;ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("js.general.front.about.title"));a=$$("#mainPanel > .Dialog").first();a.update(b);ShopService.showOnlyMainPanelDialog();NavigationService.updateNavigationListeners(a)},receiveItems:function(a){ShopService.clearMainPanelDialog();if(undefined!=a.itemsData){a.itemsData.each(this.addItem.bind(this))}if(undefined!=a.maxResultPage){this.maxResultPage=a.maxResultPage}if(a.itemsData.size()>0){this.displayItems()}},changeSorting:function(){this.resetCurrentItems();$("sortInputNavigation").writeAttribute("href","currentPage=0&sort="+$F("sortInput"));NavigationService.processNavigationCommand($("sortInputNavigation"))},displayItems:function(){var a,b,c;a=this.currentPage*this.maxFrontItems;if((undefined==this.items.get(a))&&(!NavigationService.hasActiveCallsRunning())){NavigationService.processGenericServerCall(true);return}ShopService.hideItemDetailPanel();ShopService.clearItemListPanel();this.updateItemsNavigation();ShopItemController.currentItem=undefined;for(c=a,b=(this.currentPage+1)*this.maxFrontItems;c<b;++c){if(undefined!=this.items.get(c)){this.items.get(c).displayPreview()}}imageLoaderService.startPreloading();NavigationService.updateNavigationListeners($("itemListPanel"))},updateItemsNavigation:function(){var b,a;if(0==this.maxResultPage){$("nextItems").hide();$("previousItems").hide();$("navigationPages").update("");return}$("mainPanelNavigation").show();if(this.currentPage==this.maxResultPage){$("nextItems").hide()}else{$("nextItems").show();$("nextItems").writeAttribute("href","currentPage="+(this.currentPage+1))}if(0==this.currentPage){$("previousItems").hide()}else{$("previousItems").show();$("previousItems").writeAttribute("href","currentPage="+(this.currentPage-1))}$("navigationPages").update("");for(a=0;a<this.maxResultPage+1;++a){if(a!=this.currentPage){b=new Template(this.pageNavigationTemplate);$("navigationPages").insert({bottom:b.evaluate({page:a,i:a+1})})}else{b=new Template(this.currentPageNavigationTemplate);$("navigationPages").insert({bottom:b.evaluate({i:a+1})})}}NavigationService.updateNavigationListeners($("mainPanelNavigation"))}};ShopCategoryController={createHierarchy:function(a){this.categories=new Array();a.each(this.createCategory.bind(this));var b=new Hash();this.categories.each(function(c){b.set(c.id,c)});a.each(function(c){if(c.parentId!=undefined){b.get(c.id).setParent(b.get(c.parentId))}else{this.rootCategory=b.get(c.id)}}.bind(this));$("categories").update("");this.rootCategory.prepareView()},createCategory:function(b){var a=new ShopCategory(b.name,b.id);if(b.parentCategoryId){this.rootCategory.setCurrentCategoryById(b.parentCategoryId);a.setParent(this.currentCategory)}this.categories.push(a)}};ShopItemController={defaultAction:"prepareDetailView",displayDetailPanel:function(id){isWantedItem=function(a){return(a.value.id==id)};selectedItem=ShopBrowsingController.items.find(isWantedItem).value;if(selectedItem!=this.currentSelectedItem){selectedItem.displayDetailPanel();this.currentSelectedItem=selectedItem}else{this.eraseDetailPanel()}},prepareDetailView:function(initialData){var a=initialData.item;a=new ShopItem(a.id,a.name,a.shortDescription,a.description,a.manufacturer,a.model,a.previewImage,a.detailImage,a.fullImage,a.price,a.additionalInformation,a.status);ShopBrowsingController.items.set(0,a);a.displayDetailPanel()},eraseDetailPanel:function(){var a=$$("#itemDetailPanelContent .AddCartAction").first();if(a){a.stopObserving()}ShopService.hideItemDetailPanel();this.currentSelectedItem=undefined}};SystemController={handleServerError:function(a){if("development"==ApplicationContext.environment){$("debugTrace").show().update(a)}else{}},handleNavigationError:function(b,a,e,f,d){var c;if("development"==ApplicationContext.environment){console.log("A JS callback was not found, control could not be properly restored to the JS framework.");console.log("Origin: "+b+", Controller: "+a+", Action: "+e+", Query string: "+f)}else{c="A JS callback was not found, control could not be properly restored to the JS framework.\n";c+="Origin: "+b+", Controller: "+a+", Action: "+e+", Query string: "+f+"\n";if(d){c+="Data sent by the server: "+Object.toJSON(d)}new Ajax.Request("/system/javaScriptError",{method:"post",parameters:new Hash({errorReport:c})})}}};UserCartController={detailShown:false,cart:new UserCart(),refreshCartDetailedView:function(){var a=$("shoppingCartItemList");a.update("");this.cart.getItems().invoke("prepareDetailedCartView");this.refreshCartMainView();NavigationService.updateNavigationListeners(a)},refreshCartMainView:function(){var b,a;b=localeMessageResolverService.convertNumberToString(this.cart.getTotal());a=this.cart.getItems();$("cartItems").update(a.size()+" "+localeMessageResolverService.getMessage("js.general.cart.items"));$$(".CartTotal").each(function(c){c.update(b)})},displayCartDetailedView:function(){document.fire("help:cartDisplayed");if(this.detailShown){this.hideCartDetailedView()}else{var a=new Panel($("shoppingCartDetail"),$("shoppingCart"));a.setBottomPosition().setDisableCallback(this.hideCartDetailedView.bind(this)).enable();this.detailShown=true;this.refreshCartDetailedView()}},hideCartDetailedView:function(){$$("hiddenPanels > div.ToolTip").invoke("remove");$("shoppingCartDetail").hide();this.detailShown=false},addItem:function(id){ShopService.hideItemFullPanel();document.fire("help:itemAddedToCart");NavigationService.processGenericServerCall()},displayVariationsDialog:function(b){var a=$("dialogPanel");a.update(b.htmlContent);NavigationService.updateNavigationListeners(a);this.dialogPanel=new DialogPanel(a,$(document.body)).enable();if(this.chooseVariationManager){this.chooseVariationManager.reset($("variationsChoiceForm"))}else{this.chooseVariationManager=new FormManager($("variationsChoiceForm"))}$$("#variationsChoiceForm select").each(function(c){this.chooseVariationManager.registerElement(c).setFormFieldStatus($$("#variationsChoiceForm .GeneralFormMessage").first()).setCustomConstraint(this.displayVariationValues.bind(this),localeMessageResolverService.getMessage("js.variations.choice.outOfStock")).setInstantValidation()}.bind(this));this.itemVariationsDataRows=b.itemVariationsDataRows;this.displayVariationValues()},displayVariationValues:function(){var b,a;b=[];$$("#variationsChoiceForm select").each(function(c){b.push(c.getValue())}.bind(this));a=b.join(",");currentRow=this.itemVariationsDataRows.find(function(c){return c.indexKey==a});$$("#variationsChoiceForm .Price").first().update(currentRow.price);return(currentRow.quantity>0)},closeDialog:function(){if(this.dialogPanel){this.dialogPanel.disable()}$("dialogPanel").update("")},successAddItem:function(a){this.cart.addItemFromCurrentItems(a.id);this.refreshCartDetailedView();ShopService.displayMessageAndUpdateNavigationListeners(a.resultMessage)},successAddItemWithVariation:function(a){this.dialogPanel.disable();this.cart.addItemWithVariation(a);this.refreshCartDetailedView();ShopService.displayMessageAndUpdateNavigationListeners(a.resultMessage)},failureAddItem:function(a){ShopService.displayMessage(a.resultMessage)},failureAddItemWithVariation:function(a){this.dialogPanel.disable();ShopService.displayMessage(a.resultMessage)},removeItem:function(id,variationConfigurationKey){var a=this.cart.removeItem(id,variationConfigurationKey);a.removeCartToolTip();this.refreshCartDetailedView();NavigationService.processGenericServerCall()},successRemoveItem:function(a){},checkout:function(){this.hideCartDetailedView();NavigationService.processGenericServerCall(true)},successCheckoutRetrievalStep:function(a){ShopService.showOnlyMainPanelDialog();ShopService.displayMessageAndUpdateNavigationListeners(a.resultMessage)},successCheckoutPaymentStep:function(b){var a=$$("#mainPanel > .Dialog").first();a.update(b.htmlContent);ShopService.updateMainPanelTitle(localeMessageResolverService.getMessage("js.general.checkout.title"));ShopService.showOnlyMainPanelDialog();ShippingPolicy.template=b.shippingPolicyTemplate;this.shippingPolicies=[];this.cart.setupWithItems(b.userCartItems);this.refreshCartMainView();b.shippingPolicies.each(function(c){this.shippingPolicies.push(new ShippingPolicy(c.id,c.name,c.description,c.computedCost))}.bind(this));if(0!=this.shippingPolicies.size()){this.shippingPolicies.first().setChecked().select()}$$("#paymentProcessorForm input[type='radio']").invoke("observe","click",this.selectPaymentProcessor.bindAsEventListener(this));this.selectPaymentProcessor();NavigationService.updateNavigationListeners(a)},failureCheckout:function(a){ShopService.showOnlyMainPanelDialog();ShopService.displayMessage(a.resultMessage)},checkoutPaymentStep:function(){NavigationService.processGenericServerCall(true)},selectPaymentProcessor:function(){var a=$$("#paymentProcessorForm input[type='radio']").find(function(b){return b.checked});$$(".PaymentProcessorCheckout").invoke("hide");$(a.getValue()+"PaymentProcessor").show();ApplicationContext.getBean(a.getValue()+"PaymentProcessor").setup()},addQuantityToCheckout:function(id){var a;a=$$("#checkoutForm input[name='quantity"+id+"']").first();a.setValue(parseInt(a.getValue())+1)},removeQuantityToCheckout:function(id){var a,b;a=$$("#checkoutForm input[name='quantity"+id+"']").first();b=parseInt(a.getValue())-1;if(b<0){b=0}a.setValue(b)},paymentComplete:function(){}};CheckPaymentProcessorService=Class.create({initialize:function(){},selectShippingPolicy:function(a){$("checkPaymentShippingPolicyId").setValue(a.id)},setup:function(){if(this.checkPaymentManager){this.checkPaymentManager.reset($("checkPaymentForm"))}else{this.checkPaymentManager=new FormManager($("checkPaymentForm"))}this.checkPaymentManager.setSuccessCallback(this.treatSuccessCheckout.bind(this))},treatSuccessCheckout:function(a){ShopService.displayMessage(a.resultMessage);UserCartController.cart.resetItems();UserCartController.refreshCartDetailedView()}});ImageLoaderService=Class.create({initialize:function(){this.loadingImages=0;this.images=new Hash()},requestPreloadImage:function(a,b){if(!this.isCurrentlyReady()&&(b<=this.currentPriorityLevel)){this.preloadImage(a)}else{if(this.images.get(b)==undefined){this.images.set(b,[])}this.images.get(b).push(a)}},startPreloading:function(){if(this.isCurrentlyReady()){sortedLevels=this.images.keys().sort();if(sortedLevels.size()!=0){var a=sortedLevels[0];this.preloadImages(a)}}},createImage:function(){var a=$(new Image());++this.loadingImages;a.observe("load",this.decreaseLoadingImages.bindAsEventListener(this));$("hiddenImages").appendChild(a);this.temporaryImages.push(a)},preloadImage:function(a){this.temporaryImages=new Array();this.createImage();this.temporaryImages[0].src=a},preloadImages:function(d){var c,b,a;this.currentPriorityLevel=d;c=this.images.get(d);this.images.unset(d);this.temporaryImages=new Array();c.each(this.createImage.bind(this));for(b=0,a=this.temporaryImages.length;b<a;++b){this.temporaryImages[b].src=c[b]}},decreaseLoadingImages:function(a){--this.loadingImages;if(this.loadingImages==0){sortedLevels=this.images.keys().sort();if(sortedLevels.size()!=0){var b=sortedLevels[0];this.preloadImages(b)}}},isCurrentlyReady:function(){if(this.loadingImages==0){return true}else{return false}}});LocaleMessageResolverService=Class.create({initialize:function(a){this.locale=a;this.messages=new Hash()},addMessages:function(a){this.messages.update(a)},getMessage:function(a){return this.messages.get(a)},getMessageWithArguments:function(c,e){var b,a,d;d=this.messages.get(c);for(b=0,a=e.length;b<a;++b){d=d.replace("{"+b+"}",e[b])}return d},convertStringToNumber:function(a,b){if("fr"==this.locale){a=a.gsub(/\./,"#").gsub(",",".");if(!b){a=a.gsub(/\s/,"")}}else{if(!b){a=a.gsub(",","")}}return Number(a)},convertNumberToString:function(b){var a=b.toFixed(2);if("fr"==this.locale){a=a.replace(".",",")}return a}});NavigationService={DEFAULT_CONTROLLER:"shopBrowsing",setup:function(a){this.waitingServerReplyPanel=new WaitingServerReplyPanel($$("#hiddenPanels .WaitingServerReplyPanel").first(),document.body);this.optionalMode=a;this.serverCallOptions=new Hash();this.currentCalls=0;this.firstLoad=(location.hash.length<1);this.mappings=[[/^\/$/,"shopBrowsing","getNewestItems",true],[/^\/news(\/)?$/,"shopBrowsing","news",false],[/^\/faq(\/)?$/,"shopBrowsing","faq",false],[/^\/about(\/)?$/,"shopBrowsing","about",false],[/^\/editor(\/)?/,"shopEditor"],[/^\/shop(\/)/,"shopEditor"],[/^\/category(\/)/,"shopBrowsing","setupFromDisplayCategoryPage"],[/^\/product(\/)/,"shopItem","prepareDetailView"]];this.domainMappings=new Hash({referenceItem:"shopEditorItem"})},updateGlobalNavigationListeners:function(){this.updateNavigationListeners($(document.body))},updateNavigationListeners:function(a){a.select("a.AbsoluteNavigation").invoke("stopObserving","click",NavigationService.processNavigationEvent);a.select("a.RelativeNavigation").invoke("stopObserving","click",NavigationService.processNavigationEvent);a.select("form.AbsoluteNavigation").invoke("stopObserving","submit",NavigationService.processNavigationEvent);a.select(".NavigationLinkContainer").invoke("stopObserving","click",NavigationService.processNavigationEvent);a.select("a.AbsoluteNavigation").invoke("observe","click",NavigationService.processNavigationEvent);a.select("a.RelativeNavigation").invoke("observe","click",NavigationService.processNavigationEvent);a.select("form.AbsoluteNavigation").invoke("observe","submit",NavigationService.processNavigationEvent);a.select(".NavigationLinkContainer").invoke("observe","click",NavigationService.processNavigationEvent)},processNavigationEvent:function(b){b.stop();var a=b.element();if((!a.hasClassName("RelativeNavigation"))&&(!a.hasClassName("AbsoluteNavigation"))){a=b.findElement(".RelativeNavigation, .AbsoluteNavigation, .NavigationLinkContainer");if(a.hasClassName("NavigationLinkContainer")){a=a.down("a")}}NavigationService.processNavigationCommand(a)},processNavigationCommand:function(e){var c,d,a,b;if("form"==e.tagName.toLowerCase()){c=e.readAttribute("action");a=e.select("input[type='hidden'].Proxy");a.each(function(h){var f,g;f=$$("input[type='checkbox'][name="+h.readAttribute("name")+"Activation]");if(0!=f.size()){if(f.first().getValue()){g=$$("input[type='text'][name="+h.readAttribute("name")+"]").first().getValue()}}else{g=$$("input[type='text'][name="+h.readAttribute("name")+"]").first().getValue()}h.setValue(g)});if("post"==e.readAttribute("method")){parameters=e.serialize()+"&ajax=true";d=true}else{c+="?"+e.serialize()}}else{if(e.hasClassName("AbsoluteNavigation")){c=retrieveURLFromHRef(e.readAttribute("href"),false)}if(e.hasClassName("RelativeNavigation")){c=retrieveURLFromHRef(e.readAttribute("href"),true);c=this.obtainRelativeNavigationURL(c)}}b=c.indexOf("#");c=(b!=-1)?c.substring(b+1):c;if(e.hasClassName("NavigationState")){dhtmlHistory.add(c,undefined);this.processNavigationStateChange(c,undefined);return}this.setupDataFromURL(c);if(e.hasClassName("TransientNavigationState")){this.processTransientNavigationStateChange(c,e);return}if(e.hasClassName("DirectNavigationState")){window.location.assign(window.location.protocol+"//"+window.location.hostname+c);return}if(d){this.showWaitingServerReplyPanel();new Ajax.Request(c,{method:"post",parameters:parameters,onSuccess:this.successGenericCallback.bind(this,this.controller,this.action),onFailure:this.failureGenericCallback.bind(this,this.controller,this.action)})}else{this.showWaitingServerReplyPanel();c+=(c.indexOf("?")!=-1)?"&ajax=true":"?ajax=true";new Ajax.Request(c,{method:"get",onSuccess:this.successGenericCallback.bind(this,this.controller,this.action),onFailure:this.failureGenericCallback.bind(this,this.controller,this.action)})}},setServerCallOption:function(b,a){this.serverCallOptions[b]=a},reloadCurrentNavigationState:function(){this.processNavigationStateChange(this.hashURL)},changeNavigationStateWithRelativeURL:function(a){var b=NavigationService.obtainRelativeNavigationURL(a);dhtmlHistory.add(b,undefined);this.processNavigationStateChange(b,undefined)},setupServerCallData:function(a,b){if(b){b=new Hash(b);a=a+"?"+b.toQueryString()}this.setupDataFromURL(a)},processGenericServerCall:function(a){if(a){this.showWaitingServerReplyPanel()}else{++this.currentCalls}new Ajax.Request(this.obtainServerCallURL(),{method:"get",onSuccess:this.successGenericCallback.bind(this,this.controller,this.action),onFailure:this.failureGenericCallback.bind(this,this.controller,this.action)})},processTransientNavigationStateChange:function(a,b){if(b.hasClassName("Tab")){this.prepareTabView(this.getQueryParameter("section"),b)}this.processControlFlow(this.obtainJavaScriptController(this.controller),this.action,this.section,b)},processNavigationStateChange:function(c,b){var a;if(!c){c=location.pathname+location.search}else{trafficTrackerService.trackEvent(c)}this.hashURL=c;this.setupDataFromURL(c);a=this.obtainJavaScriptController(this.controller);this.processControlFlow(a,this.action,this.section,undefined);this.firstLoad=false},processControlFlow:function(a,e,g,b){var d,h,c,f;if(g){d=this.getQueryParameter("domain")?this.getQueryParameter("domain"):e.replace("Domain","");if($(d+"Domain")){a=this.domainMappings.get(d);a=a?a:d;a=this.obtainJavaScriptController(a);a[d+"Section"+g]();return}}if((!e)&&(a.defaultAction)){this.action=a.defaultAction;e=a.defaultAction}h=a[e];if(h){f=h.argumentNames();c=new Hash(this.queryParameters);f.each(function(i){if(c.get(i)){h=h.curry(c.get(i))}});if("eventElement"==f.last()){h=h.curry(b)}if("initialData"==f.last()){h=h.curry(ApplicationContext.initialData)}h.bind(a)();return}if(!this.optionalMode){SystemController.handleNavigationError("processControlFlow",a,e,this.queryString,undefined)}},commonGenericCallback:function(b,d){var a,c;this.hideWaitingServerReplyPanel();a=d.getResponseHeader("X-Shoopz-Controller");c=d.responseJSON?d.responseJSON:d.responseText;b=a?a:b;return[b,d.getResponseHeader("X-Shoopz-Action"),c]},successGenericCallback:function(a,d,f){var b,c,e;if(f.getResponseHeader("X-Shoopz-Exception")){this.failureGenericCallback(a,d,f);return}b=this.commonGenericCallback(a,f);a=this.obtainJavaScriptController(b[0]);c=b[2];if(b[1]){d=b[1]}else{if(!c.result&&undefined!=c.result){d="failure"+capitalize(d)}else{d="success"+capitalize(d)}}e=a[d];if(e){e.bind(a)(c)}else{SystemController.handleNavigationError("successGenericCallback",b[0],d,this.queryString,c)}},failureGenericCallback:function(a,c,e){var b,d;results=this.commonGenericCallback(a,e);a=this.obtainJavaScriptController(results[0]);b=results[2];if(results[1]){c=results[1]}else{c="uncaughtFailure"+capitalize(c)}d=a[c];if(d){d.bind(a)(b)}else{SystemController.handleServerError(e.responseText)}},extractLanguageFromURL:function(a){if(a.substring(0,4).match(/\/[a-z]{2}\//)){a=a.substring(3)}return a},extractControllerFromURL:function(b){var a=b.indexOf("/",1);if(a!=-1){return b.substring(1,a)}if(b.length>1){return b.substr(1)}return""},extractQueryStringFromURL:function(b){var a=b.indexOf("?");if(a!=-1){return b.substring(a)}return""},parseURL:function(c){var b,d,e,a;c=this.extractLanguageFromURL(c);e=this.extractQueryStringFromURL(c);c=c.replace(e,"");e=e.replace("?","");this.mappings.each(function(f){if(f[0].test(c)){c=(c.indexOf("/",1)!=-1)?c.substr(c.indexOf("/",1)):"";b=f[1];if(f[2]){d=f[2]}if(f[3]){a="/"+b+"/"+d+(e?"?"+e:"")}throw $break}});if(!b){b=this.extractControllerFromURL(c);c=c.replace("/"+b,"")}if(!d){d=c;if("/"==d.charAt(0)){d=d.substr(1)}if(d.lastIndexOf("/")==d.length-1){d=d.substring(0,d.length-1)}if(-1!=d.indexOf("/")){d=""}}return[b,d,e,a]},setupDataFromURL:function(a){var b=this.parseURL(a);this.controller=b[0];this.action=b[1];this.queryString=b[2];this.serverCallURL=b[3]?b[3]:a;this.queryParameters=this.queryString.toQueryParams();this.section=this.getQueryParameter("section")},obtainServerCallURL:function(){var a=this.serverCallURL;a+=(0<this.serverCallOptions.size())?("&"+this.serverCallOptions.toQueryString()):"";this.serverCallOptions=new Hash();a+=(a.indexOf("?")!=-1)?"&ajax=true":"?ajax=true";return a},obtainRelativeNavigationURL:function(b){var d,e,a,c;e=this.extractQueryStringFromURL(this.hashURL);c=this.hashURL.replace(e,"");e=e.replace("?","");d=$H(e.toQueryParams());a=$H(b.toQueryParams());a.each(function(f){d.set(f.key,f.value)});return c+"?"+d.toQueryString()},getQueryParameter:function(a){return this.queryString.toQueryParams()[a]},obtainTabLink:function(a,c){var b;a.select("a").each(function(d){if(-1!=d.readAttribute("href").indexOf("section="+c)){b=d;throw $break}});return b},prepareTabView:function(d,b){var a,c;a=b.up(".TabHeader");a.next().childElements().invoke("hide");a.next().down(".Section"+d).show();a.childElements().invoke("removeClassName","SelectedTab");b.addClassName("SelectedTab");a.select("img").each(function(e){e.writeAttribute("src",e.src.replace("-active","-inactive"))});c=b.down("img");if(c){c.writeAttribute("src",c.src.replace("-inactive","-active"))}},showWaitingServerReplyPanel:function(){if(0==this.currentCalls){this.waitingServerReplyPanel.enable()}++this.currentCalls},hideWaitingServerReplyPanel:function(){--this.currentCalls;if(this.currentCalls<=0){this.waitingServerReplyPanel.disable();this.currentCalls=0}},hasActiveCallsRunning:function(){return(this.currentCalls>0)},obtainJavaScriptController:function(a){var b=capitalize(a)+"Controller";return window[b]}};PayPalPaymentProcessorService=Class.create({initialize:function(){},selectShippingPolicy:function(a){var b;$("paypalHandlingCart").setValue(a.computedCost);b=$("paypalCustom").getValue();$("paypalCustom").setValue(b.substring(0,b.lastIndexOf("%3D")+3)+a.id)},setup:function(){}});ShopService={displayMessage:function(a){$$("#mainPanel > .Dialog").first().update(a)},displayMessageAndUpdateNavigationListeners:function(b){var a=$$("#mainPanel > .Dialog").first();a.update(b);NavigationService.updateNavigationListeners(a)},clearItemListPanel:function(){$("itemListPanel").update("")},hideItemListPanel:function(){$("itemListPanel").hide()},showItemListPanel:function(){$("itemListPanel").show()},clearMainPanelDialog:function(){$$("#mainPanel > .Dialog").first().update("");$$("#mainPanel > .Dialog").last().update("")},showOnlyMainPanelDialog:function(){$$("#mainPanel > .Dialog").last().hide();this.clearItemListPanel();$("mainPanelNavigation").hide();$("mainPanelAction").hide();this.hideItemDetailPanel()},showItemDetailPanel:function(){$("itemListPanel").setStyle({width:"390px"});$("itemDetailPanel").show()},hideItemDetailPanel:function(){$("itemListPanel").setStyle({width:"auto"});$("itemDetailPanel").hide()},showItemFullPanel:function(){$("itemDisplayPanel").hide();$("itemFullPanel").show()},hideItemFullPanel:function(){$("itemFullPanel").hide();$("itemDisplayPanel").show()},updateMainPanelTitle:function(a){$("mainPanelTitle").update(a)},hideNavigation:function(){$("mainPanelNavigation").hide()},hideAction:function(){$("mainPanelAction").hide()},showAction:function(){$("mainPanelAction").show()}};TrafficTrackerService=Class.create({initialize:function(a){this.globalPageTracker=_gat._getTracker("UA-4089888-1");this.globalPageTracker._setDomainName("shoopz.com");this.globalPageTracker._initData();this.globalPageTracker._trackPageview();if(a){this.customerPageTracker=_gat._getTracker(a);this.customerPageTracker._initData();this.customerPageTracker._trackPageview()}},trackEvent:function(a){this.globalPageTracker._trackPageview(a);if(this.customerPageTracker){this.customerPageTracker._trackPageview(a)}}});