/*
 * Common application scripts 0.1
 * Copyright(c) 2008, Conduit IT.
 * 
 */


var AddToCartMgrWin=Ext.extend(Ext.Window,{layout:"fit",closable:true,shim:true,bodyStyle:"padding:0; margin:0;",buttonAlign:"center",width:350,check_out_link_id:null,view_cart_link_id:null,cart_amount_elem_id:null,cart_total_elem_id:null,animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,cannot_buy_text:CommonTemplatesLang.CartMgr.message.cannotBuyProduct,url:"json.php?target=cart_gateway",shadow:false,resizable:false,draggable:false,target_cart:CommonTemplatesLang.CartMgr.label.cart,add_method:"addProductToCart",add_bulk_method:"addBulkProductsToCart",total_field:"cart_total",window_title_cls:"cart-addtocart-window-title wse-hd",displayPrice:false,cls:"wse-win-add2cart",initComponent:function(){this.store=new Ext.data.JsonStore({autoLoad:false,url:this.url,root:"results",pruneModifiedRecords:true,fields:["show_labels","add_title","add_message","cart_amount",this.total_field,"file_size","price_label","price","qty_label","qty","product_label","product","product_code_label","product_code","description","image_src","image_width","image_height","hazmat_type_desc","hazmat_type_icon_src"],baseParams:{}});var _1=new Ext.XTemplate("<div class=\"cart-addtocart wse-add2cart\">","<div class=\"items wse-boxes\">","<tpl for=\".\">","<div class=\"itemBox wse-box\">","<h3 class=\"wse-msg\">{add_message}</h3>","<div class=\"boxImage wse-img\">","<div class=\"wse-wrap\"><img src=\"{image_src}\" width=\"{image_width}\" height=\"{image_height}\" alt=\"\" /></div>","</div>","<div class=\"properties wse-props\">","<tpl if=\"this.hasValue(product_label, show_labels)\">","<p class=\"wse-prod\">","<span class=\"label wse-lbl\">{product_label}:</span>"," <span class=\"value wse-val\">{product}</span>","</p>","</tpl>","<tpl if=\"!this.hasValue(product_label, show_labels)\">","<p class=\"wse-prod\">{product}</p>","</tpl>","<tpl if=\"this.hasValue(product_code_label, show_labels)\">","<p class=\"wse-sku\">","<span class=\"label wse-lbl\">{product_code_label}:</span>"," <span class=\"value wse-val\">{product_code}</span>","</p>","</tpl>","<tpl if=\"this.hasValue(qty_label, show_labels)\">","<p class=\"qty wse-qty\">","<span class=\"label wse-lbl\">{qty_label}:</span>"," <span class=\"value qty wse-val\">{qty}</span>","</p>","</tpl>","<tpl if=\"!this.hasValue(qty_label, show_labels)\">","<p class=\"qty wse-qty\">{qty}</p>","</tpl>","<tpl if=\"this.displayPrice("+this.displayPrice+")\">","<tpl if=\"this.hasValue(price_label, show_labels)\">","<p class=\"price wse-price\">","<span class=\"label wse-lbl\">{price_label}:</span>"," <span class=\"value price wse-val\">{price}</span>","</p>","</tpl>","<tpl if=\"!this.hasValue(price_label, show_labels)\">","<p class=\"price wse-price\">","{price}","</p>","</tpl>","</tpl>","<tpl if=\"this.hasValue(hazmat_type_icon_src, 'Y')\">","<p class=\"wse-hazmat\">","<img src=\"{hazmat_type_icon_src}\" alt=\"{hazmat_type_desc}\" ext:qwidth=\"260\" ext:qtip=\"{hazmat_type_desc}\" />","</p>","</tpl>","</div>","</div>","</tpl>","</div>","<div class=\"status wse-status\" id=\"winStatus"+this.getId()+"\"></div>","</div>",{hasValue:function(_2,_3){if(_2.length>0&&_3=="Y"){return true;}
return false;},displayPrice:function(_4){return(_4)?true:false;}});var _5=new Ext.DataView({store:this.store,tpl:_1,autoHeight:true,autoWidth:true,loadingText:CommonTemplatesLang.CartMgr.label.addingToX.replace("[1]",this.target_cart),itemSelector:"div.itemBox",emptyText:""});this.items=[_5];this.genButtons();AddToCartMgrWin.superclass.initComponent.call(this);},initEvents:function(){this.store.on("load",this.updateLayout,this);AddToCartMgrWin.superclass.initEvents.call(this);},destroy:function(){try{this.store=null;this.view=null;}
catch(e){}
AddToCartMgrWin.superclass.destroy.call(this);},updateLayout:function(_6,_7,_8){var _9=_7[0];if(_9.data.add_title){this.setTitle(_9.data.add_title,this.window_title_cls);}else{this.setTitle();}
this.doLayout();},genButtons:function(){this.buttons=[{xtype:"button",text:CommonTemplatesLang.CartMgr.button.viewCart,cls:"wse-xbtn wse-xbtn-checkout",handler:this.handleViewCartClick},{xtype:"button",text:CommonTemplatesLang.CartMgr.button.ok,cls:"wse-xbtn wse-xbtn-ok",handler:this.tryToHide,scope:this}];},handleViewCartClick:function(){checkDealerNeededForCheckout("index.php?target=cart");},showAndPosition:function(_a,_b){var _c=Ext.get("mainArea");if(_c){var r=_c.getRight();var t=_c.getTop();var b=_c.getBottom();var _10=Ext.getBody();var s=_10.getScroll();var v=_10.getViewSize();if(s["top"]>t){t=s["top"];}
if(_b=="Y"){r=r-this.width;}else{t=t+20;r=(_c.getWidth()/2)+_c.getLeft()-(this.width/2);}
this.setPosition(r,t);}
this.show(_a);},makeDisplayUpdates:function(){var _13;var _14=this.store.getAt(0);if(_14&&_14.data){if(!_14.data.qty&&_14.data.add_message){Ext.MessageBox.show({title:CommonTemplatesLang.CartMgr.title.error,msg:_14.data.add_message,buttons:Ext.MessageBox.OK,animEl:this,modal:false});this.hide();return;}
if(this.check_out_link_id&&(_13=Ext.get(this.check_out_link_id))){_13.removeClass(["inactive","ws-inactive"]);_13=null;}
if(this.view_cart_link_id&&(_13=Ext.get(this.view_cart_link_id))){_13.addClass(["inactive","ws-inactive"]);_13=null;}
if(this.cart_amount_elem_id&&(_13=Ext.get(this.cart_amount_elem_id))){if(_14.data){_13.update(_14.data["cart_amount"]);}
_13=null;}
if(this.cart_total_elem_id&&(_13=Ext.get(this.cart_total_elem_id))){if(_14.data){_13.update(_14.data["cart_total"]);}
_13=null;}
if(_13=Ext.get("winStatus"+this.getId())){if(_14.data){var _15="<span class=\"wse-status-qty\">"+_14.data["cart_amount"]+" items in cart</span>";if(this.displayPrice==true){_15=_15+" <span class=\"wse-status-total\">"+_14.data["cart_total"]+"</span>";}
_13.update(_15);}}}
_14=null;this.startCloseDelay();},stopCloseDelay:function(){if(this.closeTask){this.closeTask.cancel();delete this.closeTask;}},startCloseDelay:function(){this.closeTask=new Ext.util.DelayedTask({});this.closeTask.delay(2000,this.checkIfClose,this);},checkIfClose:function(){this.stopCloseDelay();if(!this.hidden){if(!this.checkIfMouseOver()){this.tryToHide();}else{this.startCloseDelay();}}},checkIfMouseOver:function(e){if(mouseX&&mouseY){var _17=this.getEl();var x=_17.getLeft();var y=_17.getTop();var w=_17.getWidth()+x;var h=_17.getHeight()+y;if((mouseX<=w)&&(mouseX>=x)&&(mouseY<=h)&&(mouseY>=y)){return true;}}
return false;},addToCart:function(_1c,_1d,_1e,_1f,_20,_21,_22,_23){var _24,_25;_24=_25=null;if(_21&&_22){_24=_21.join(",");_25=_22.join(",");}
if(_1d){var qty=1;if(_1f){qty=0;var _27=Ext.get(_1f);if(_27){qty=Number(_27.getValue(true));}
if(!qty){Ext.MessageBox.show({title:CommonTemplatesLang.CartMgr.title.error,msg:CommonTemplatesLang.CartMgr.message.provideValidQuantity,buttons:Ext.MessageBox.OK,animEl:_1c,modal:false});return;}}
this.stopCloseDelay();this.showAndPosition(_1c,_23);this.store.load({callback:this.makeDisplayUpdates,scope:this,params:{method:this.add_method,product_id:_1d,condition_id:_1e,qty:qty,option_ids_s:_24,option_vals_s:_25,include_dealer_price:true}});}else{if(!_20){_20=this.cannot_buy_text;}
alert(_20);}},addBulkIdsToCart:function(_28,_29){if(_28){var _2a={method:this.add_bulk_method};var _2b=false;for(var i=0;i<_28.length;i++){if(_28[i].data.quantity>0){_2a["product_data["+_28[i].data.product_id+"][amount]"]=_28[i].data.quantity;_2b=true;}}
if(_2b){this.stopCloseDelay();this.showAndPosition(this,_29);this.store.load({callback:this.makeDisplayUpdates,scope:this,params:_2a});}else{Ext.MessageBox.show({title:CommonTemplatesLang.CartMgr.title.error,msg:CommonTemplatesLang.CartMgr.message.provideOneValidQuantity,buttons:Ext.MessageBox.OK,animEl:this,modal:false});}}},addBulkToCart:function(_2d,_2e,_2f,_30){var _31=Ext.get(_2e);if(_31&&_2f){var _32;var i=1;var v=null;var _35=false;var _36={method:this.add_bulk_method};while(_32=Ext.get(_2f+i)){v=_32.getValue(true);if(v){_35=true;_36[_32.dom.name]=v;}
i++;}
if(_35){this.stopCloseDelay();this.showAndPosition(_2d,_30);this.store.load({callback:this.makeDisplayUpdates,scope:this,params:_36});}else{Ext.MessageBox.show({title:CommonTemplatesLang.CartMgr.title.error,msg:CommonTemplatesLang.CartMgr.message.provideOneValidQuantity,buttons:Ext.MessageBox.OK,animEl:_2d,modal:false});}}},tryToHide:function(){if(!this.hidden){try{this.hide();}
catch(e){}}}});
var AddToWishListMgrWin=Ext.extend(AddToCartMgrWin,{cannot_buy_text:CommonTemplatesLang.WishList.message.cannotAddProduct,url:"json.php?target=wishlist",target_cart:CommonTemplatesLang.WishList.title.Wishlist,add_method:"addProductToWishlist",add_bulk_method:"addBulkProductsToWishlist",total_field:"wishlist_total",cls:"wse-win-add2cart wse-win-add2wishlst",genButtons:function(){this.buttons=[{xtype:"button",text:CommonTemplatesLang.WishList.button.viewWishList,cls:"wse-xbtn wse-xbtn-view",listeners:{click:function(){window.location.href="index.php?target=wishlist";}}},{xtype:"button",text:CommonTemplatesLang.WishList.button.ok,cls:"wse-xbtn wse-xbtn-ok",handler:this.tryToHide,scope:this}];},showAndPosition:function(_1){this.show(_1);},makeDisplayUpdates:function(){var _2;var _3=this.store.getAt(0);if(_3){if(_2=Ext.get("winStatus"+this.time_id)){if(_3.data){_2.update(_3.data["wishlist_total"]+" items in wish list.");}}}
this.startCloseDelay();}});
var ContactFormWin=Ext.extend(Ext.Window,{lang:CommonTemplatesLang.ContactForm,layout:"fit",closable:true,shim:false,bodyStyle:"padding:1em; margin:0; text-align:left;background-color:#FFF",buttonAlign:"center",width:460,animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,shadow:false,listeners:{beforedestroy:function(w){Ext.destroy(w.mask);}},form_config:"",prefix:"contact_us",id:"contact_us_form",google_gateway_url:"json.php?target=dealer_locater&method=search",formLabelWidth:135,formFieldWidth:225,title:CommonTemplatesLang.ContactForm.title.contactUs,url:"json.php?target=form_gateway",method:"&method=submitForm",response_msg_title:CommonTemplatesLang.ContactForm.title.thankYou,response_msg:CommonTemplatesLang.ContactForm.message.formSubmitted,submit_btn_width:100,show_country:false,sendFormBy:"",siteType:"",leadType:"",formOwner:"",formTitle:"",formName:"",initComponent:function(){Ext.QuickTips.init();formItems=[];this.stateStore=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:"json.php?target=state_list&method=getList"}),reader:new Ext.data.JsonReader({root:"data",fields:[{name:"code"},{name:"state"}]})});this.stateStore.load();this.countryStore=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:"json.php?target=country_list&method=getList"}),reader:new Ext.data.JsonReader({root:"data",fields:[{name:"abbr"},{name:"country"}]})});if(this.show_country){this.countryStore.load();}
this.contactTimeStore=new Ext.data.JsonStore({fields:["contact_time"],data:[{contact_time:this.lang.label.anytime},{contact_time:this.lang.label.morning},{contact_time:this.lang.label.afternoon},{contact_time:this.lang.label.evening}]});this.firstName=new Ext.form.TextField({fieldLabel:this.lang.label.firstName,labelSeparator:this.labelSeparator,name:"data[first_name]",width:this.formFieldWidth});formItems.push(this.firstName);this.lastName=new Ext.form.TextField({fieldLabel:this.lang.label.lastName,labelSeparator:this.labelSeparator,name:"data[last_name]",width:this.formFieldWidth});formItems.push(this.lastName);this.email=new Ext.form.TextField({fieldLabel:this.lang.label.email,labelSeparator:this.labelSeparator,name:"data[email]",width:this.formFieldWidth});formItems.push(this.email);this.phone=new Ext.form.TextField({fieldLabel:this.lang.label.phone,labelSeparator:this.labelSeparator,name:"data[phone]",width:this.formFieldWidth});formItems.push(this.phone);this.contactTime=new Ext.form.ComboBox({fieldLabel:this.lang.label.bestTimeToContact,labelSeparator:this.labelSeparator,name:"data[contact_time]",width:this.formFieldWidth,store:this.contactTimeStore,valueField:"contact_time",displayField:"contact_time",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,forceSelection:false});formItems.push(this.contactTime);this.emailMethod=new Ext.form.Checkbox({fieldLabel:this.lang.label.preferredMethod,labelSeparator:this.labelSeparator,name:"data[email_method]",style:"margin-left: 40px;",boxLabel:this.lang.label.email});this.phoneMethod=new Ext.form.Checkbox({hideLabel:true,name:"data[phone_method]",boxLabel:this.lang.label.phone});this.contactMethodCL=new Ext.Panel({layout:"column",autoWidth:true,border:false,items:[{columnWidth:0.65,layout:"form",border:false,labelWidth:this.formLabelWidth,items:[this.emailMethod]},{columnWidth:0.35,layout:"form",border:false,hideLabel:true,items:[this.phoneMethod]}]});formItems.push(this.contactMethodCL);this.zip=new Ext.form.TextField({fieldLabel:this.lang.label.zipCode,labelSeparator:this.labelSeparator,name:"data[zip]",width:this.formFieldWidth});formItems.push(this.zip);this.city=new Ext.form.TextField({fieldLabel:this.lang.label.city,id:this.prefix+"cityTF",labelSeparator:this.labelSeparator,name:"data[city]",width:this.formFieldWidth});formItems.push(this.city);this.state=new Ext.form.ComboBox({fieldLabel:this.lang.label.state,id:this.prefix+"stateCB",labelSeparator:this.labelSeparator,name:"data[state]",width:this.formFieldWidth,store:this.stateStore,valueField:"code",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",emptyText:this.lang.emptyText.selectState,selectOnFocus:true,forceSelection:true});formItems.push(this.state);this.country=new Ext.form.ComboBox({fieldLabel:this.lang.label.country,labelSeparator:this.labelSeparator,name:"data[country]",width:this.formFieldWidth,store:this.countryStore,valueField:"country",displayField:"country",typeAhead:true,mode:"local",triggerAction:"all",emptyText:this.lang.emptyText.selectCountry,selectOnFocus:true,forceSelection:true});if(this.show_country){formItems.push(this.country);}
this.subject=new Ext.form.TextField({fieldLabel:this.lang.label.subject,labelSeparator:this.labelSeparator,name:"data[subject]",width:this.formFieldWidth});this.message=new Ext.form.TextArea({fieldLabel:this.lang.label.message,labelSeparator:this.labelSeparator,name:"data[message]",width:this.formFieldWidth});formItems.push(this.message);this.sendBy=new Ext.form.TextField({hidden:true,value:this.sendFormBy,name:"data[send_by]"});this.sentSiteType=new Ext.form.TextField({hidden:true,value:(this.siteType?this.siteType:"store"),name:"data[site_type]"});this.sentLeadType=new Ext.form.TextField({hidden:true,value:this.leadType,name:"data[lead_type]"});this.sentFormOwner=new Ext.form.TextField({hidden:true,value:this.formOwner,name:"data[form_owner]"});this.sentFormTitle=new Ext.form.TextField({hidden:true,value:this.formTitle,name:"data[form_title]"});this.sentFormName=new Ext.form.TextField({hidden:true,value:this.formName,name:"data[form_name]"});this.hiddenFields=new Ext.form.FieldSet({hidden:true,border:false,frame:false,items:[this.sendBy,this.sentSiteType,this.sentLeadType,this.sentFormOwner,this.sentFormTitle,this.sentFormName]});formItems.push(this.hiddenFields);this.formPanel=new Ext.FormPanel({autoHeight:true,border:false,bodyBorder:false,labelWidth:this.formLabelWidth,labelAlign:"right",items:formItems});this.items=[this.formPanel];this.submitButton=new Ext.Button({text:this.lang.button.submit,minWidth:this.submit_btn_width});this.buttons=[this.submitButton];ContactFormWin.superclass.initComponent.call(this);},initEvents:function(){this.zip.on("blur",this.getAddressFromGoogle,this);this.submitButton.on("click",this.submitForm,this);ContactFormWin.superclass.initEvents.call(this);},prepareToHide:function(){var _2=new Ext.util.DelayedTask({});_2.delay(250,this.hide,this);},destroy:function(){try{this.formPanel=null;this.sendButton=null;}
catch(e){}
ContactFormWin.superclass.destroy.call(this);},getAddressFromGoogle:function(_3){var _4=this.id;var _5=new GClientGeocoder();_5.getLocations(_3.getValue(),function(_6){Ext.getCmp(_4).receiveAddressFromGoogle(_6);});},receiveAddressFromGoogle:function(_7){var _8=this.prefix+"stateCB";var _9=this.prefix+"cityTF";if(!_7||_7.Status.code!=200){Ext.getCmp(_8).clearValue();Ext.getCmp(_9).setValue();}else{place=_7.Placemark[0];if(place.AddressDetails.Country){country=place.AddressDetails.Country;if(place.AddressDetails.Country.CountryNameCode){country_code=place.AddressDetails.Country.CountryNameCode;}
if(place.AddressDetails.Country.AdministrativeArea){if(place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName){state=place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;Ext.getCmp(_8).setValue(state);}else{Ext.getCmp(_8).clearValue();}
if(place.AddressDetails.Country.AdministrativeArea.Locality){city=place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName;Ext.getCmp(_9).setValue(city);}else{Ext.getCmp(_9).setValue();}}else{Ext.getCmp(_8).clearValue();Ext.getCmp(_9).setValue();}}else{Ext.getCmp(_8).clearValue();Ext.getCmp(_9).setValue();}}},submitForm:function(){var _a=this.formPanel.getForm();if(_a.isValid()){_a.waitMsgTarget=true;_a.submit({url:this.url+this.method,clientValidation:false,scope:this,success:this.showThankYou,failure:this.showErrorMsg,discardUrl:false,nocache:false,waitMsg:this.lang.mask.sendingForm,timeout:45,scripts:false});}else{Ext.MessageBox.show({title:this.lang.title.incompleteForm,msg:this.lang.message.formIncomplete,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:150});}},showThankYou:function(_b,_c){var _d;if(_c.result&&_c.result.message){_d=_c.result.message;}else{_d=this.response_msg;}
Ext.MessageBox.show({title:this.response_msg_title,msg:_d,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:150});this.formPanel.getForm().reset();this.prepareToHide();},showErrorMsg:function(){Ext.MessageBox.show({title:this.lang.title.error,msg:this.lang.msg.anErrorOccured,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:250});this.formPanel.getForm().reset();this.prepareToHide();}});
var MakeOfferWin=Ext.extend(Ext.Window,{lang:CommonTemplatesLang.MakeOffer,layout:"fit",closable:true,shim:false,bodyStyle:"padding:1em; margin:0; text-align:left;",buttonAlign:"center",_labelWidth:140,numberWidth:110,width:500,user_email:"",user_name:"",product_display_name:"",product_code:"",product_name:"",product_price:0,currency:"",amount:1,animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,shadow:false,title:CommonTemplatesLang.MakeOffer.title.makeOffer,current_url:null,url:"json.php?target=form_gateway&method=submitMakeAnOfferForm",intro_text:CommonTemplatesLang.MakeOffer.message.bestOfferDisclaimer,listeners:{beforedestroy:function(w){Ext.destroy(w.mask);}},_anchorSize:"90%",initComponent:function(){Ext.QuickTips.init();this.closeButton=new Ext.Button({text:this.lang.button.close,cls:"wse-xbtn wse-xbtn-minor"});this.sendButton=new Ext.Button({text:this.lang.button.send,cls:"wse-xbtn"});var _2=[{border:false,html:this.intro_text+"&nbsp;<b>"+this.product_display_name+"</b><br/><br/>"},{xtype:"hidden",name:"redirect_url",value:this.current_url},{xtype:"hidden",name:"data[product_code]",value:this.product_code},{xtype:"hidden",name:"data[product]",value:this.product_name}];if(product_price&&product_price>0){_2.push({xtype:"textfield",name:"data[price]",readOnly:true,fieldLabel:this.lang.label.currentPrice+"("+this.currency+")",value:this.product_price,width:this.numberWidth});}
_2.push({xtype:"numberfield",name:"data[requested_quantity]",minValue:1,allowNegative:false,allowDecimals:false,decimalPrecision:0,allowBlank:false,fieldLabel:this.lang.label.quantityRequested,value:this.amount,width:this.numberWidth},{xtype:"numberfield",name:"data[offer_price]",minValue:0,allowNegative:false,decimalPrecision:2,allowBlank:false,fieldLabel:this.lang.label.totalOfferPrice+"("+this.currency+")",width:this.numberWidth},{xtype:"textfield",id:this.id+"send_data_from_name",name:"data[from_name]",allowBlank:false,fieldLabel:this.lang.label.name,anchor:this._anchorSize,validator:validateInput_NoSpaces.createDelegate(this,this.id+"send_data_from_name",true)},{xtype:"textfield",id:this.id+"send_data_from_email",name:"data[from_email]",allowBlank:false,fieldLabel:this.lang.label.email,anchor:this._anchorSize,plugins:[Ext.ux.plugins.RemoteValidator],rvOptions:{url:"json.php?target=common&method=validateEmailAddress"}},{xtype:"PhoneField",id:this.id+"-phone",fieldLabel:this.lang.label.phone,name:"data[phone]",anchor:this._anchorSize,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-phone",true)},{xtype:"combo",fieldLabel:this.lang.label.bestTimeToContact,name:"data[contact_time]",anchor:this._anchorSize,store:new Ext.data.JsonStore({fields:["contact_time"],data:[{contact_time:this.lang.label.anytime},{contact_time:this.lang.label.morning},{contact_time:this.lang.label.afternoon},{contact_time:this.lang.label.evening}]}),valueField:"contact_time",displayField:"contact_time",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,forceSelection:false},{layout:"column",anchor:this._anchorSize,border:false,items:[{columnWidth:0.65,layout:"form",border:false,labelWidth:this._labelWidth,width:"99%",items:[{xtype:"checkbox",fieldLabel:this.lang.label.preferredMethod,name:"data[email_method]",boxLabel:this.lang.label.email}]},{columnWidth:0.35,layout:"form",border:false,hideLabel:true,items:[{xtype:"checkbox",hideLabel:true,name:"data[phone_method]",boxLabel:this.lang.label.phone}]}]},{xtype:"textarea",name:"data[comments]",id:this.id+"send_data_comments",allowBlank:true,fieldLabel:this.lang.label.comments,anchor:this._anchorSize,validator:validateInput_NoSpaces.createDelegate(this,this.id+"send_data_comments",true)});this.formPanel=new Ext.FormPanel({autoHeight:true,border:false,bodyBorder:false,labelWidth:this._labelWidth,labelAlign:"right",items:_2});this.items=[this.formPanel];this.buttons=[this.closeButton,this.sendButton];MakeOfferWin.superclass.initComponent.call(this);},initEvents:function(){if(this.user_name){Ext.getCmp(this.id+"send_data_from_name").setValue(this.user_name);}
if(this.user_email){Ext.getCmp(this.id+"send_data_from_email").setValue(this.user_email);}
this.closeButton.on("click",this.prepareToHide,this);this.sendButton.on("click",this.sendEmail,this);MakeOfferWin.superclass.initEvents.call(this);},prepareToHide:function(){var _3=new Ext.util.DelayedTask({});_3.delay(250,this.hide,this);},destroy:function(){try{this.formPanel=null;this.closeButton=null;this.sendButton=null;}
catch(e){}
MakeOfferWin.superclass.destroy.call(this);},sendEmail:function(){var _4=this.formPanel.getForm();if(_4.isValid()){_4.waitMsgTarget=true;_4.submit({url:this.url,params:{set_user:this.user_email},clientValidation:false,scope:this,success:this.showThankYou,failure:this.showErrorMsg,discardUrl:false,nocache:false,waitMsg:this.lang.mask.sending,timeout:45,scripts:false});}},showThankYou:function(_5,_6){var _7;if(_6.result&&_6.result.message){_7=_6.result.message;}else{_7=this.lang.message.emailSentToFriend;}
Ext.MessageBox.show({title:this.lang.title.thankYou,msg:_7,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:150});this.formPanel.getForm().reset();this.prepareToHide();},showErrorMsg:function(){Ext.MessageBox.show({title:this.lang.title.error,msg:this.lang.message.anErrorOccured,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:250});this.formPanel.getForm().reset();this.prepareToHide();}});
var EmailFriendWin=Ext.extend(Ext.Window,{lang:CommonTemplatesLang.EmailFriend,layout:"fit",closable:true,shim:false,bodyStyle:"padding:1em; margin:0; text-align:left;",buttonAlign:"center",width:400,user_email:"",user_name:"",animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,shadow:false,title:CommonTemplatesLang.EmailFriend.title.sendToFriend,current_url:null,url:"json.php?target=send_to_friend&method=sendPageToFriend",intro_text:CommonTemplatesLang.EmailFriend.message.fillOutForm,listeners:{beforedestroy:function(w){Ext.destroy(w.mask);}},initComponent:function(){Ext.QuickTips.init();this.closeButton=new Ext.Button({text:this.lang.button.close,cls:"wse-xbtn wse-xbtn-minor"});this.sendButton=new Ext.Button({text:this.lang.button.send,cls:"wse-xbtn"});this.formPanel=new Ext.FormPanel({autoHeight:true,border:false,bodyBorder:false,labelWidth:150,labelAlign:"right",items:[{border:false,html:this.intro_text+"<br/><br/>"},{xtype:"hidden",name:"redirect_url",value:this.current_url},{xtype:"textfield",id:"send_data_from_name",name:"send_data[from_name]",allowBlank:false,fieldLabel:this.lang.label.yourName,anchor:"90%",validator:validateInput_NoSpaces.createDelegate(this,"send_data_from_name",true)},{xtype:"textfield",id:"send_data_from_email",name:"send_data[from_email]",allowBlank:false,fieldLabel:this.lang.label.yourEmail,anchor:"90%",plugins:[Ext.ux.plugins.RemoteValidator],rvOptions:{url:"json.php?target=common&method=validateEmailAddress"}},{xtype:"textfield",name:"send_data[to_name]",id:"send_data_to_name",allowBlank:false,fieldLabel:this.lang.label.friendsName,anchor:"90%",validator:validateInput_NoSpaces.createDelegate(this,"send_data_to_name",true)},{xtype:"textfield",name:"send_data[to_email]",allowBlank:false,fieldLabel:this.lang.label.friendsEmail,anchor:"90%",plugins:[Ext.ux.plugins.RemoteValidator],rvOptions:{url:"json.php?target=common&method=validateEmailAddress"}},{xtype:"textarea",name:"send_data[notes]",id:"send_data_notes",allowBlank:true,fieldLabel:this.lang.label.message,anchor:"90%",validator:validateInput_NoSpaces.createDelegate(this,"send_data_notes",true)}]});this.items=[this.formPanel];this.buttons=[this.closeButton,this.sendButton];EmailFriendWin.superclass.initComponent.call(this);},initEvents:function(){if(this.user_name){Ext.getCmp("send_data_from_name").setValue(this.user_name);}
if(this.user_email){Ext.getCmp("send_data_from_email").setValue(this.user_email);}
this.closeButton.on("click",this.prepareToHide,this);this.sendButton.on("click",this.sendEmail,this);EmailFriendWin.superclass.initEvents.call(this);},prepareToHide:function(){var _2=new Ext.util.DelayedTask({});_2.delay(250,this.hide,this);},destroy:function(){try{this.formPanel=null;this.closeButton=null;this.sendButton=null;}
catch(e){}
EmailFriendWin.superclass.destroy.call(this);},sendEmail:function(){var _3=this.formPanel.getForm();if(_3.isValid()){_3.waitMsgTarget=true;_3.submit({url:this.url,params:{set_user:this.user_email},clientValidation:false,scope:this,success:this.showThankYou,failure:this.showErrorMsg,discardUrl:false,nocache:false,waitMsg:this.lang.mask.sending,timeout:45,scripts:false});}},showThankYou:function(_4,_5){var _6;if(_5.result&&_5.result.message){_6=_5.result.message;}else{_6=this.lang.message.emailSentToFriend;}
Ext.MessageBox.show({title:this.lang.title.thankYou,msg:_6,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:150});this.formPanel.getForm().reset();this.prepareToHide();},showErrorMsg:function(){Ext.MessageBox.show({title:this.lang.title.error,msg:this.lang.message.anErrorOccured,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:250});this.formPanel.getForm().reset();this.prepareToHide();}});
var TermsWin=Ext.extend(Ext.Window,{layout:"fit",closable:true,shim:true,bodyStyle:"padding:0; margin:0;background-color:#FFF;",buttonAlign:"center",width:400,height:400,animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,url:"json.php?target=terms_gateway",shadow:false,method:"getTerms",autoScroll:true,print_url:null,initComponent:function(){this.store=new Ext.data.JsonStore({autoLoad:true,url:this.url+"&method="+this.method,root:"results",pruneModifiedRecords:true,fields:["text","title"],baseParams:{}});if(!Ext.isIE){this.shim=false;}
var _1=new Ext.XTemplate("<div class=\"bottom-termswindow wse-terms-win\">","<div class=\"wse-content-block\">","<tpl for=\".\">","<div class=\"itemBox wse-box\">","{text}","</div>","</tpl>","</div>","</div>");var _2=new Ext.DataView({store:this.store,tpl:_1,autoHeight:true,autoWidth:true,loadingText:CommonTemplatesLang.TermsWin.mask.loading,itemSelector:"div.itemBox",emptyText:""});this.items=[_2];if(this.print_url){this.buttons=[{text:CommonTemplatesLang.TermsWin.button.printVersion,listeners:{click:this.openPrintView,scope:this}}];}
TermsWin.superclass.initComponent.call(this);},initEvents:function(){this.store.on("load",this.updateWindow,this);TermsWin.superclass.initEvents.call(this);},destroy:function(){try{this.store=null;}
catch(e){}
TermsWin.superclass.destroy.call(this);},updateWindow:function(){try{var _3=this.store.reader.jsonData;this.setTitle(_3["title"]);}
catch(e){}
this.doLayout();},openPrintView:function(){if(this.print_url){var _4=window.open(this.print_url,"termsWin","toolbar=no,screenx=0,screeny=0,top=0,left=0,location=no,directories=0,status,menubar=no,resizeable,scrollbars,width=640,height=480");_4.focus();}}});
Ext.namespace("webStore");webStore.stateList=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:"json.php?target=state_list&method=getList"}),reader:new Ext.data.JsonReader({root:"data",fields:[{name:"code"},{name:"state"}]})});webStore.countryList=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:"json.php?target=country_list&method=getList"}),reader:new Ext.data.JsonReader({root:"data",fields:[{name:"abbr"},{name:"country"}]})});var mouseX=0;var mouseY=0;var priceArray=new Array();function selectInputText(_1){try{_1.select();}
catch(e){}}
function trackMouse(_2){try{var e=_2.browserEvent;var _4=Ext.getBody().getScroll();if(typeof e=="undefined"){e=window.event;}
if(e){if(typeof e.pageX!="undefined"&&typeof e.x!="undefined"){mouseX=e.pageX;mouseY=e.pageY;}else{mouseX=e.clientX+_4.left;mouseY=e.clientY+_4.top;}}}
catch(e){}}
function citBttnDown(e){try{var _6=Ext.get(e);_6.addClass(["buttonOver","ws-over"]);}
catch(e){}}
function citBttnUp(e){try{elem=Ext.get(e);elem.removeClass(["buttonOver","ws-over"]);}
catch(e){}}
function openPopUpWindow(_8,_9){if(_8){window.open(_8,"_blank",_9);}}
function showTab(_a,_b,_c,el){_b=Number(_b);if(el){try{Ext.get(el).blur();}
catch(e){}}
if(_a&&_b>=0){var _e;var i=0;while(_e=Ext.get(_a+i)){if(i!=_b){_e.removeClass(["selected","ws-selected"]);}else{_e.addClass(["selected","ws-selected"]);}
i++;}
i=0;while(_e=Ext.get(_a+i+"_content")){if(i!=_b){_e.removeClass(["selected","ws-selected"]);}else{_e.addClass(["selected","ws-selected"]);}
i++;}
if(_c&&this[_c]){try{this[_c]();}
catch(e){}}}}
var addCartMgr;function addProductToCart(btn,_11,_12,_13,_14,_15){var _16="product_details_form_"+_11;if(document[_16]){var _17="product_data\\["+_11+"]\\[product_options]\\[[0-9]+]";var Exp=new RegExp(_17,"");var _19="product_data["+_11+"][product_options][";var _1a=[];var _1b=[];var _1c,_1d,_1e;_1e=0;for(i=0;i<document[_16].elements.length;i++){if(Exp.exec(document[_16].elements[i].name)!=null){_1c=document[_16].elements[i].name.substring(_19.length);_1c=_1c.substring(0,_1c.length-1);_1c=parseInt(_1c);_1d=parseInt(document[_16].elements[i].value);_1a[_1e]=_1c;_1b[_1e]=_1d;_1e++;}}}
if(!addCartMgr){addCartMgr=new AddToCartMgrWin({check_out_link_id:"topmenu-cartinfo-checkoutlink",view_cart_link_id:"topmenu-cartinfo-viewcartlink",cart_amount_elem_id:"cartAmount",cart_total_elem_id:"cartSubTotal",url:json_index+"?target=cart_gateway",width:(extjs_win_standard_width?extjs_win_standard_width:AddToCartMgrWin.prototype.width),displayPrice:add_to_cart_display_price});}
addCartMgr.addToCart(btn,_11,_12,_13,_14,_1a,_1b,_15);}
function addBulkProductIdsToCart(_1f,_20){if(!addCartMgr){addCartMgr=new AddToCartMgrWin({check_out_link_id:"checkoutLink",view_cart_link_id:"viewCartLink",cart_amount_elem_id:"cartAmount",cart_total_elem_id:"cartSubTotal",url:json_index+"?target=cart_gateway",width:(extjs_win_standard_width?extjs_win_standard_width:AddToCartMgrWin.prototype.width)});}
addCartMgr.addBulkIdsToCart(_1f,_20);}
function addBulkProductToCart(btn,_22,_23,_24){if(!addCartMgr){addCartMgr=new AddToCartMgrWin({check_out_link_id:"checkoutLink",view_cart_link_id:"viewCartLink",cart_amount_elem_id:"cartAmount",cart_total_elem_id:"cartSubTotal",url:json_index+"?target=cart_gateway",width:(extjs_win_standard_width?extjs_win_standard_width:AddToCartMgrWin.prototype.width)});}
addCartMgr.addBulkToCart(btn,_22,_23,_24);}
var addWishlistMgr;function addProductToWishlist(btn,_26,_27,_28,_29){if(!addWishlistMgr){addWishlistMgr=new AddToWishListMgrWin({url:json_index+"?target=wishlist",width:(extjs_win_standard_width?extjs_win_standard_width:AddToWishListMgrWin.prototype.width)});}
addWishlistMgr.addToCart(btn,_26,_27,_28,_29);}
function getViewportSize(){var _2a=[0,0];try{if(typeof window.innerWidth!="undefined"){_2a=[window.innerWidth,window.innerHeight];}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){_2a=[document.documentElement.clientWidth,document.documentElement.clientHeight];}else{var b=Ext.getBody();_2a=[b.getWidth(),b.getHeight()];}}}
catch(e){}
return _2a;}
var imageLargeViews={};function viewLargeImage(_2c,_2d,_2e,_2f){_2d=Number(_2d);_2e=Number(_2e);_2f=Number(_2f);if(_2d&&_2e&&_2f){var _30="image_"+_2d;var _31=null;var _32=getViewportSize();var bw=Math.round(_32[0]*0.75);var bh=Math.round(_32[1]*0.75);if((_2e>bw)||(_2f>bh)){var _35=bw/_2e;var _36=bh/_2f;if(_35<=_36){_2e=bw;_2f=Math.round(_35*_2f);}else{_2f=bh;_2e=Math.round(_36*_2e);}}
if(!imageLargeViews[_30]){imageLargeViews[_30]=new Ext.Window({layout:"fit",closable:true,shim:true,bodyStyle:"padding:0;",width:_2e+20,buttonAlign:"center",animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,animateTarget:null,shadow:false,resizable:false,items:[{xtype:"panel",border:false,html:"<img src=\"image.php?object_type=detailed&amp;image_id="+_2d+"\" width=\""+_2e+"\" height=\""+_2f+"\" alt=\"\" />"}]});}
if(_2c){_31=Ext.get(_2c);}
imageLargeViews[_30].show(_31);}}
function showCompareTab(btn,_38,_39,_3a,_3b,_3c,num){if(enableCompare(btn,_38,_39,_3a,_3b,_3c+num)){showTab(_3c,num,null,btn);initProdCompareApp(_38,_39,_3a);}}
function enableCompare(btn,_3f,_40,_41,_42,_43){var _44=Ext.get(_3f);if(_44&&_41){var _45;var i=1;var _47=new Array();while(_45=Ext.get(_41+i)){if(_45.dom.checked==true){_47.push(_45.getValue(true));}
i++;}
if(_47.length>3){Ext.MessageBox.show({title:CommonTemplatesLang.General.title.error,msg:CommonTemplatesLang.General.message.compareChoose,buttons:Ext.MessageBox.OK,animEl:btn,modal:false});if(btn){btn.checked=false;}}
var _48;i=2;while(i>0){_48=Ext.get(_42+i--);if(_48){try{_48.removeClass(["disabled","ws-disabled"]);}
catch(e){}
if(_47.length>1&&_40){_48.dom.style.cursor="pointer";_48.unmask();}else{_48.dom.style.cursor="default";_48.mask();}}}
if(_43){var _49=Ext.get(_43);}
if(_47.length>1&&_40){if(_49){_49.removeClass(["disabled","ws-disabled"]);}
return true;}else{if(_49){_49.addClass(["disabled","ws-disabled"]);}
return false;}}}
function compareProducts(btn,_4b,_4c,_4d,_4e,_4f){var _50=Ext.get(_4b);if(_50&&_4d){var _51;var i=1;var _53=new Array();while(_51=Ext.get(_4d+i)){if(_51.dom.checked==true){_53.push(_51.getValue(true));}
i++;}
if(_53.length>1&&_4c){_50.dom.elements[_4c].value=_53.join("|");_50.dom.submit();}else{Ext.MessageBox.show({title:CommonTemplatesLang.General.title.error,msg:CommonTemplatesLang.General.message.compareChoose,buttons:Ext.MessageBox.OK,animEl:btn,modal:false});}}}
var makeOfferWin;function makeAnOffer(_54){if(!makeOfferWin){makeOfferWin=new MakeOfferWin({user_name:user_name,user_email:user_email,current_url:current_url,product_display_name:product_display_name,product_code:product_code,product_name:product_name,currency:currency,product_price:product_price,amount:amount,intro_text:CommonTemplatesLang.MakeOffer.message.bestOfferDisclaimer,width:(extjs_win_standard_width?extjs_win_standard_width:MakeOfferWin.prototype.width)});}
makeOfferWin.show(_54);}
var checkDealerPriceInventoryWin;function checkDealerPriceInventory(_55,_56,_57){if(!checkDealerPriceInventoryWin){checkDealerPriceInventoryWin=new RequireDealerCheckPriceWin({user_id:_56,dealer_locator_choice:_57,lang:CommonTemplatesLang.RequireDealerCheckPriceWinLang});}
checkDealerPriceInventoryWin.show(_55);}
var emailFriendWin;function sendToFriend(_58){if(!emailFriendWin){emailFriendWin=new EmailFriendWin({user_name:user_name,user_email:user_email,current_url:current_url,intro_text:CommonTemplatesLang.General.message.sendProductToFriend,width:(extjs_win_standard_width?extjs_win_standard_width:EmailFriendWin.prototype.width)});}
emailFriendWin.show(_58);}
function sendWishlistToFriend(_59){if(!emailFriendWin){emailFriendWin=new EmailFriendWin({user_name:user_name,user_email:user_email,intro_text:CommonTemplatesLang.General.message.sendWishlistToFriend,url:json_index+"?target=wishlist&method=sendWishlistToFriend",width:(extjs_win_standard_width?extjs_win_standard_width:EmailFriendWin.prototype.width)});}
emailFriendWin.show(_59);}
var termsWin;function openTermsWin(_5a){if(!termsWin){termsWin=new TermsWin({method:"getTerms",url:json_index+"?target=terms_gateway",print_url:index_script+"?target=forms&mode=print_view&terms_src=terms",width:(extjs_win_standard_width?extjs_win_standard_width:TermsWin.prototype.width)});}
termsWin.show(_5a);}
var globalConditionsWin;function openGlobalConditionsWin(_5b){if(!globalConditionsWin){globalConditionsWin=new TermsWin({method:"getGlobalCOS",url:json_index+"?target=terms_gateway",print_url:index_script+"?target=forms&mode=print_view&terms_src=global_cos",width:(extjs_win_standard_width?extjs_win_standard_width:TermsWin.prototype.width)});}
globalConditionsWin.show(_5b);}
var privacyWin;function openPrivacyWin(_5c){if(!privacyWin){privacyWin=new TermsWin({method:"getPrivacy",url:json_index+"?target=terms_gateway",print_url:index_script+"?target=forms&mode=print_view&terms_src=privacy",width:(extjs_win_standard_width?extjs_win_standard_width:TermsWin.prototype.width)});}
privacyWin.show(_5c);}
var contactUsWin;function openContactUsWin(_5d){if(!contactUsWin){contactUsWin=new ContactFormWin({prefix:"contact_us",id:"contact_us_form",title:CommonTemplatesLang.General.title.contactUs,url:"json.php?target=showroom_form_gateway",method:"&method=submitForm",response_msg_title:CommonTemplatesLang.General.title.thankYou,response_msg:CommonTemplatesLang.General.message.formSubmitted,siteType:site_type,leadType:lead_type,formOwner:form_owner,formTitle:CommonTemplatesLang.General.title.contactUs,formName:"contact_us_form",sendFormBy:"salesforce,email",width:(extjs_win_standard_width?extjs_win_standard_width:ContactFormWin.prototype.width)});}
contactUsWin.show(_5d);}
var contactFinanceWin;function openContactFinanceWin(_5e){if(!contactFinanceWin){contactFinanceWin=new ContactFormWin({prefix:"finance",id:"finance_form",title:CommonTemplatesLang.General.title.contactFinance,url:"json.php?target=showroom_form_gateway",method:"&method=submitForm",response_msg_title:CommonTemplatesLang.General.title.thankYou,response_msg:CommonTemplatesLang.General.message.formSubmittedFinance,siteType:site_type,leadType:lead_type,formOwner:form_owner,formTitle:CommonTemplatesLang.General.title.contactFinance,formName:"contact_finance_form",sendFormBy:"salesforce,email",width:(extjs_win_standard_width?extjs_win_standard_width:ContactFormWin.prototype.width)});}
contactFinanceWin.show(_5e);}
var myMachineWin;var globalMachineSearchWin;function showMyMachineWin(_5f,_60){if(!myMachineWin){myMachineWin=new MyMachineWin({limit:Number(machinePageLimit),userID:user_id,hidePic:hidePic,oneLine:oneLine,noResultsCriteriaStrict:noResultsCriteriaStrict,noResultsCriteria:noResultsCriteria,display_model_number_search:display_model_number_search,display_model_hierarchy_search:display_model_hierarchy_search,lang:MyMachineLang,width:(extjs_win_standard_width?extjs_win_standard_width:MyMachineWin.prototype.width)});}
myMachineWin.showAndPosition(_5f,_60);}
function initManufacturerMenu(){try{var _61=Ext.get("topmenu_manufacturer_holder");var _62=Ext.get("topmenu_manufacturer_link");var _63=Ext.get("topmenu_manufacturer_submenu");if(_61&&_62&&_63){_62.dom.href="#";_62.dom.onclick=function(){toggleManufacturerMenu(this);return false;};}}
catch(e){}}
var manufacturerSubMenu;function toggleManufacturerMenu(btn){try{if(!manufacturerSubMenu){manufacturerSubMenu=new TopMenuSubMenuPanel({renderTo:Ext.getBody(),menuItemId:"topmenu_manufacturer_holder",contentEl:"topmenu_manufacturer_submenu"});}
manufacturerSubMenu.toggleView();}
catch(e){}
if(btn){try{var _65=Ext.get(btn);_65.blur();}
catch(e){}}}
var catExpandMgr;function initCategoryExpander(){try{var _66=Ext.get("sideboxes_categorytree_expand");if(_66&&!catExpandMgr){catExpandMgr=new CategoryExpandManager();catExpandMgr.init("sideboxes_categorytree_link_","sideboxes_categorytree_expander_",["expanded","ws-expanded"]);}}
catch(e){}}
function generateStdButtonHtml(_67,_68){return"<div class=\"buttons ws-btngrp\">"+"<div class=\"products-stdbutton ws-btn\" >"+"<div class=\"buttonHolder ws-wrap ws-wrap-btn\" onclick=\""+_67+"\"  onmouseover=\"citBttnDown(this); return true;\" onmouseout=\"citBttnUp(this); return true;\">"+"<div class=\"topCap ws-tcap\"></div>"+"<span>"+_68+"</span>"+"<div class=\"bottomCap ws-bcap\"></div>"+"</div>"+"</div>"+"</div>";}
function filterCompareProduct(_69,_6a,_6b,_6c){prodCompareApp.filterProduct(_69,_6a,_6b,_6c);}
function removeCompareProduct(_6d,_6e,_6f,_70){prodCompareApp.removeProduct(_6d,_6e,_6f,_70);}
var prodCompareApp;function initProdCompareApp(_71,_72,_73){try{var _74=Ext.get("product_comparison_app");if(_74&&!prodCompareApp){prodCompareApp=new ProductComparisonApplication({renderTo:"product_comparison_app",includeDealerDetails:false,includeDealerPrice:true});}
prodCompareApp.showApp(_71,_72,_73,true);}
catch(e){alert(CommonTemplatesLang.General.title.error+": "+e);}}
function setItemImageToolTip(_75,_76,_77,_78,_79){if(_75){_75.onmouseover=null;if(Number(_76)&&Number(_77)){var _7a={trackMouse:true,target:_75,showDelay:100,autoWidth:true,autoHeight:true,html:"<img src=\"image.php?object_type="+_79+"&amp;image_id="+_76+"\" width=\""+_77+"\" height=\""+_78+"\" />",cls:"image-tool-tip"};if(Ext.isIE6){_7a["shadow"]=false;_7a["width"]=_77+2;_7a["autoWidth"]=false;}
var _7b=new Ext.ToolTip(_7a);try{_7b.showAt([mouseX,mouseY]);}
catch(e){}}}}
function autoSizeSelect(_7c,_7d){if(_7c&&Ext.isIE){try{_7c=Ext.get(_7c);if(_7d=="on"){var w=_7c.getWidth();var nW=0;var oW=0;var c=_7c.first();while(c!=null){oW=c.getTextWidth();if((oW>w)&&(oW>nW)){nW=oW;}
c=c.next();}
if(nW){_7c.setStyle("width",nW+10);_7c.focus();}}else{_7c.setStyle("width","");}}
catch(e){}}}
function submitFormById(id){if(id){try{Ext.get(id).dom.submit();}
catch(e){}}}
function resizeImgIfNeeded(el,_84){try{var img=Ext.get(el);var _86=img.up(_84);var cW=_86.getWidth();var w=img.getWidth();if(cW&&w>cW){var _89=cW/w;var h=img.getHeight();img.setSize(cW,Math.round(_89*h));}}
catch(e){}}
function chooseDealer(el,_8c,_8d,_8e){try{if(!this.dealerWin){this.dealerWin=new dealerlocator.Window({title:DealerLocatorLang.title.window,redirect_url:DealerLocatorConfig.redirectUrl,forcePopup:DealerLocatorConfig.forcePopup,allow_redirect:_8c==undefined?true:_8c,replacement_div_id:_8d?_8d:""});}
if(_8e!=undefined){if(_8e.length>0){this.dealerWin.setRedirectUrl(_8e);}}else{this.dealerWin.setRedirectUrl(DealerLocatorConfig.redirectUrl);}
this.dealerWin.show();}
catch(e){}}
function checkDealerNeededForCheckout(_8f){if(require_dealer_to_view_prices_inventory=="Y"&&dealer_user_id=="0"){if(dealer_locator_choice==1){chooseDealer(this,true,"",_8f);}else{if(find_a_dealer_link_href.length>0){window.location=find_a_dealer_link_href;}}}else{window.location=_8f;}}
function print_r(arr,_91){var _92="";if(!_91){_91=0;}
var _93="";for(var j=0;j<_91+1;j++){_93+="    ";}
if(typeof(arr)=="object"){for(var _95 in arr){var _96=arr[_95];if(typeof(_96)=="object"){_92+=_93+"'"+_95+"' ...\n";_92+=print_r(_96,_91+1);}else{_92+=_93+"'"+_95+"' => \""+_96+"\"\n";}}}else{_92="===>"+arr+"<===("+typeof(arr)+")";}
return _92;}
function lookUpProductPrice(_97,_98,_99,_9a,_9b,_9c){if(_97){Ext.Ajax.request({url:json_index+"?target=products&method=lookUpProductPrice",params:{product_id:_97},timeout:4500,success:function(_9d,_9e){gatherPrices(_9d,_9e,_98,_99,_9a,_9b,_9c);},failure:function(_9f,_a0){hideLivePriceWrapper(_9a,_9b);}});}}
function gatherPrices(_a1,_a2,_a3,_a4,_a5,_a6,_a7){var _a8=new Object();_a8["response"]=_a1;_a8["options"]=_a2;_a8["price_html"]=_a3;_a8["original_price_html"]=_a4;_a8["live_price_wrapper_html"]=_a5;_a8["static_price_wrapper_html"]=_a6;_a8["add_to_cart_btn_grp_id"]=_a7;priceArray.unshift(_a8);}
function displayProductPrices(){while(priceArray.length>=10){for(var i=0;i<10;i++){var _aa=priceArray.shift();receiveProductLookupPrice(_aa.response,_aa.options,_aa.price_html,_aa.original_price_html,_aa.live_price_wrapper_html,_aa.static_price_wrapper_html,_aa.add_to_cart_btn_grp_id);}}
var _ab=priceArray.length;for(var i=0;i<_ab;i++){var _aa=priceArray.shift();receiveProductLookupPrice(_aa.response,_aa.options,_aa.price_html,_aa.original_price_html,_aa.live_price_wrapper_html,_aa.static_price_wrapper_html,_aa.add_to_cart_btn_grp_id);}}
function receiveProductLookupPrice(_ac,_ad,_ae,_af,_b0,_b1,_b2){_ac=Ext.util.JSON.decode(_ac.responseText);if(_ac.success){if(_ac.price){try{var _b3;var _el;if(_ac.price){_b3=Ext.get(_ae);_b3.update(_ac.price);if(_ac.original_price&&_af){_b3=Ext.get(_af);_b3.update(_ac.original_price);_el=Ext.get(_b0);try{_el.child("li.ws-price-ret").setDisplayed(true);}
catch(e){}}
if(_b2){_el=Ext.get(_b2);_el.setDisplayed(true);try{_el.child("li.ws-trakng-amt").setDisplayed(true);_el.child("div.ws-btngrp-ordr-add").setDisplayed(true);}
catch(e){}}}else{if(_b2){_el=Ext.get(_b2);_el.setDisplayed(false);try{_el.child("li.ws-trakng-amt").setDisplayed(false);_el.child("div.ws-btngrp-ordr-add").setDisplayed(false);}
catch(e){}}}}
catch(e){hideLivePriceWrapper(_b0,_b1);}}else{hideLivePriceWrapper(_b0,_b1);}}else{hideLivePriceWrapper(_b0,_b1);}}
function hideLivePriceWrapper(_b5,_b6){try{Ext.get(_b5).setDisplayed(false);Ext.get(_b6).setDisplayed(true);}
catch(e){}}
function lookUpProductInventory(_b7,_b8,_b9,_ba,_bb,_bc){if(_b7){Ext.Ajax.request({url:json_index+"?target=products&method=lookUpProductInventory",params:{product_id:_b7},timeout:4500,success:function(_bd,_be){receiveProductLookupInventory(_bd,_be,_b8,_b9,_ba,_bb,_bc);}});}}
function receiveProductLookupInventory(_bf,_c0,_c1,_c2,_c3,_c4,_c5){_bf=Ext.util.JSON.decode(_bf.responseText);if(_bf.success){try{var _c6;if(_bf.inventory&&_bf.inventory>0){try{_c6=Ext.get(_c1);_c6.update(_bf.inventory);Ext.get(_c2).setDisplayed(true);}
catch(e){hideLiveInventoryWrapper(_c4,_c5);}}else{try{Ext.get(_c3).setDisplayed(true);}
catch(e){hideLiveInventoryWrapper(_c4,_c5);}}}
catch(e){hideLiveInventoryWrapper(_c4,_c5);}}else{hideLiveInventoryWrapper(_c4,_c5);}}
function hideLiveInventoryWrapper(_c7,_c8){try{Ext.get(_c7).setDisplayed(false);Ext.get(_c8).setDisplayed(true);}
catch(e){}}
function validate_simple_search_form(_c9){with(_c9){if(q.value==null||q.value.length<3){alert(invalid_search_length);q.focus();return false;}
return true;}}
webStore.displayConfirmMessageFromForm=function(_ca,_cb){if(_cb&&_cb.result&&_cb.result.confirm_message){if(_cb.result.confirm_title){webStore.displayMessage(_cb.result.confirm_message,_cb.result.confirm_title,_cb.result.confirm_type,_cb.result.redirect);}else{webStore.displayMessage(_cb.result.confirm_message,null,_cb.result.confirm_type,_cb.result.redirect);}}else{if(_cb&&_cb.result){webStore.displayMessage();}}};webStore.displayConfirmMessageFromAjax=function(_cc,_cd,_ce){var _cf=Ext.util.JSON.decode(_ce.responseText);if(_ce&&_ce.responseText){if(_cf.skip_message){return;}else{if(_cf.confirm_title){webStore.displayMessage(_cf.confirm_message,_cf.confirm_title,_cf.confirm_type,_cf.redirect);}else{if(_cf.confirm_type){webStore.displayMessage(_cf.confirm_message,null,_cf.confirm_type,_cf.redirect);}else{webStore.displayMessage(_cf.confirm_message,null,null,_cf.redirect);}}}}else{if(!_cd&&_ce.status!=200&&!_ce.responseText){webStore.displayMessage("The connection request timed out.",null,"error");}else{webStore.displayMessage();}}};webStore.displayMessage=function(_d0,_d1,_d2,_d3){var _d4=Ext.Msg.INFO;switch(_d2){case"error":_d4=Ext.Msg.ERROR;if(!_d1){_d1="Error";}
break;case"warning":_d4=Ext.Msg.WARNING;break;case"question":_d4=Ext.Msg.QUESTION;break;default:break;}
if(!_d1){_d1="Webstore";}
if(_d0){Ext.Msg.show({title:_d1,buttons:Ext.Msg.OK,fn:webStore.messageButtonClickHandler.createDelegate(this,[_d3],0),msg:_d0,icon:_d4});}};webStore.messageButtonClickHandler=function(_d5){if(_d5){_d5=Ext.util.Format.htmlDecode(_d5);if(location.href==_d5){location.reload();}else{if(_d5.substr(0,1)=="#"){location.href=_d5;location.reload();}else{location.href=_d5;}}}};Ext.onReady(function(){try{Ext.getBody().on("mousemove",trackMouse);}
catch(e){}
Ext.QuickTips.init();Ext.form.Field.prototype.msgTarget="side";initManufacturerMenu();initCategoryExpander();try{if(_queFuncAttempts&&Ext.isArray(_queFuncAttempts)){var obj;while(_queFuncAttempts.length){obj=_queFuncAttempts.shift();attemptFuncCall(obj.method,obj.args,obj.obj,true);}}}
catch(e){}
if(Ext.isIE){try{document.execCommand("BackgroundImageCache",false,true);}
catch(e){}}});
Ext.form.TextField.prototype.hide=function(){var _1=this.getEl();if(_1){try{_1.up(".x-form-item").setDisplayed(false);}
catch(e){}}
return Ext.form.TextField.superclass.hide.call(this);};Ext.form.TextField.prototype.show=function(){var _2=this.getEl();if(_2){try{_2.up(".x-form-item").setDisplayed(true);}
catch(e){}}
return Ext.form.TextField.superclass.show.call(this);};Ext.form.Field.prototype.setRequiredIcon=function(){if(this.allowBlank){return;}
if(!this.requiredIcon){var _3=this.getErrorCt();if(!_3){return;}
this.requiredIcon=_3.createChild({cls:"wse-required-icon"});}
this.alignRequiredIcon();this.requiredIcon.show();this.on("resize",this.alignRequiredIcon,this);};Ext.form.Field.prototype.hideRequiredIcon=function(){if(this.requiredIcon){this.requiredIcon.hide();}};Ext.form.Field.prototype.alignRequiredIcon=function(){if(this.requiredIcon){if(this.wrap){this.requiredIcon.alignTo(this.wrap,"tl-tr",[2,0]);}else{this.requiredIcon.alignTo(this.el,"tl-tr",[2,0]);}}};Ext.form.Field.prototype.onDestroy=function(){if(this.requiredIcon){this.requiredIcon.removeAllListeners();this.requiredIcon.remove();}
if(this.errorIcon){this.errorIcon.removeAllListeners();this.errorIcon.remove();}
Ext.form.Field.superclass.onDestroy.call(this);};Ext.form.TextField.prototype.onRender=function(ct,_5){Ext.form.TextField.superclass.onRender.call(this,ct,_5);if(this.msgTarget=="side"){this.setRequiredIcon();}};Ext.form.TextField.prototype.markInvalid=function(_6){if(this.msgTarget=="side"){if(!this.rendered||this.preventMark){return;}
this.el.addClass(this.invalidClass);if(!this.errorIcon){var _7=this.getErrorCt();if(!_7){this.el.dom.title=_6;return;}
this.errorIcon=_7.createChild({cls:"x-form-invalid-icon"});}
this.alignErrorIcon();this.errorIcon.dom.qtip=_6;this.errorIcon.dom.qclass="x-form-invalid-tip";this.errorIcon.dom.qalign="tl-tr?";this.errorIcon.dom.qwidth=150;this.hideRequiredIcon();this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);this.fireEvent("invalid",this,_6);}else{Ext.form.TextField.superclass.markInvalid.call(this,_6);}};Ext.form.TextField.prototype.clearInvalid=function(){if(this.msgTarget=="side"){if(!this.rendered||this.preventMark){return;}
this.el.removeClass(this.invalidClass);if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this);}
this.setRequiredIcon();this.fireEvent("valid",this);}else{Ext.form.TextField.superclass.clearInvalid.call(this);}};
function showPaymentCalculatorForm(_1){try{Ext.getCmp("payment_calculator_form_win").show(_1);}
catch(e){}}
var labelStyle="padding: 4px 3px 4px 3px;";var fieldWidth=260;var payment_calculator_panel=new Ext.Panel({frame:false,border:false,layout:"column",height:200,buttonAlign:"center",defaults:{frame:false,border:false},items:[{layout:"form",labelAlign:"right",width:fieldWidth,items:[{id:"price",xtype:"textfield",regex:/(^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$)|([0-9]+)/,regexText:CommonTemplatesLang.PaymentCalculator.message.enterValidAmount,fieldLabel:CommonTemplatesLang.PaymentCalculator.label.price,allowBlank:false,allowDecimals:true,allowNegative:false}]},{html:CommonTemplatesLang.PaymentCalculator.label.dollars,bodyStyle:labelStyle},{layout:"form",labelAlign:"right",width:fieldWidth,items:[{id:"down_payment",xtype:"textfield",regex:/(^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$)|([0-9]+)/,regexText:CommonTemplatesLang.PaymentCalculator.message.enterValidAmount,fieldLabel:CommonTemplatesLang.PaymentCalculator.label.downPayment,allowBlank:false,allowDecimals:true,allowNegative:false}]},{html:CommonTemplatesLang.PaymentCalculator.label.dollars,bodyStyle:labelStyle},{layout:"form",labelAlign:"right",width:fieldWidth,items:[{id:"loan_term",xtype:"numberfield",fieldLabel:CommonTemplatesLang.PaymentCalculator.label.loanTerm,allowBlank:false,allowDecimals:false,allowNegative:false}]},{html:CommonTemplatesLang.PaymentCalculator.label.months,bodyStyle:labelStyle},{layout:"form",labelAlign:"right",width:fieldWidth,items:[{id:"annual_interest_rate",xtype:"numberfield",fieldLabel:CommonTemplatesLang.PaymentCalculator.label.annualInterestRate,allowBlank:false,allowDecimals:true,allowNegative:false}]},{html:CommonTemplatesLang.PaymentCalculator.label.percent,bodyStyle:labelStyle},{layout:"form",labelAlign:"right",width:fieldWidth,items:[{id:"monthly_payment",xtype:"textfield",fieldLabel:CommonTemplatesLang.PaymentCalculator.label.monthlyPayment,allowBlank:true,readOnly:true}]},{html:CommonTemplatesLang.PaymentCalculator.label.dollars,bodyStyle:labelStyle}],buttons:[{text:CommonTemplatesLang.PaymentCalculator.button.calculate,handler:function(){calculatePayment();}}]});var payment_calculator_form_win=new Ext.Window({layout:"fit",closable:true,resizable:false,id:"payment_calculator_form_win",shim:false,bodyStyle:"padding:1em; margin:0; text-align:left;background-color:#FFF",buttonAlign:"center",width:400,height:400,user_email:"",user_name:"",animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,shadow:true,title:CommonTemplatesLang.PaymentCalculator.title.paymentCalculator,autoHeight:true,items:[payment_calculator_panel]});function calculatePayment(){var _2=dollarToFloat(Ext.getCmp("price").getValue());var _3=dollarToFloat(Ext.getCmp("down_payment").getValue());var _4=Ext.getCmp("loan_term").getValue();var _5=Ext.getCmp("annual_interest_rate").getValue();var _6=getMonthlyPayment(_2,_3,_4,_5);Ext.getCmp("monthly_payment").setValue(intToDollar(_6));}
function dollarToFloat(_7){var _8=_7;var _9=0;if(_8!=""){if(_8.charAt(0)=="$"){_8=_8.substring(1,_8.length);}
var _a=_8.lastIndexOf(",");while(_a!=-1){_8=_8.substring(0,_a)+_8.substring(_a+1,_8.length);_a=_8.lastIndexOf(",",_a);}
_9=parseFloat(_8);}
return _9;}
function intToDollar(_b){var _c=""+Math.round(_b);var _d=_c.length;_d-=4;while(_d>=0){_c=_c.substring(0,_d+1)+","+_c.substring(_d+1,_c.length);_d-=3;}
return _c;}
function getMonthlyPayment(_e,_f,_10,_11){var _12=0;var _13=_e-_f;var _14=_11/(12*100);if(_14==0){_12=_13/_10;}else{var _12=_13*(_14/(1-Math.pow((1+_14),-_10)));}
_12=Math.round(_12);return _12;}
var LoginFormPanel=Ext.extend(Ext.Panel,{lang:CommonTemplatesLang.LoginFormPanel,id:"login",create_as_popup:"N",forget_url:"#",create_url:"#",create_url_javascript:"index.php?target=profiles&mode=add",session_name:null,session_id:null,redirect_url:"",disFormWin:null,autoHeight:true,collapsed:true,collapsible:true,hideCollapseTool:true,cls:"loginwin wse-login-panel",animCollapse:true,width:300,border:false,borderBody:false,floating:true,buttonAlign:"center",bodyStyle:"padding: 5px 5px 0 5px",url:"json.php?target=auth_gateway&method=login",shim:false,mode:"panel",generic_errors:false,restore_cart:true,hidePassword:"N",confirmPassword:"N",hideRememberMe:"N",hideCreateAccount:"N",createAccountAsButton:"N",country:"",emailAsLogin:"N",createAccount:"N",requireDealer:"N",hasDealer:"N",allow_username_transition:false,dealerLocater_javascript:"N",dealerLocater_url:"",created_in_parent:false,in_checkout:false,loginMessage:"",usernameLabel:"",loginButtonText:"",wait_msg:"",hideButtons:false,recvrPassAsPopup:false,initComponent:function(){if(this.loginButtonText==""){this.loginButtonText=this.lang.button.login;}
if(this.wait_msg==""){this.wait_msg=this.lang.mask.loggingIn;}
if(this.mode=="panel"&&Ext.isIE){this.shadow=false;this.border=true;}
var _1=[];_1.push({html:this.loginMessage,border:false,cls:"wse-msg"});if(this.createAccount=="Y"){if(this.emailAsLogin=="Y"){_1.push({xtype:"textfield",vtype:"email",name:"data[email]",id:this.id+"login_form_un",allowBlank:false,fieldLabel:this.lang.label.emailAddress,width:150});}else{_1.push({xtype:"textfield",name:"data[user_login]",id:this.id+"login_form_un",allowBlank:false,fieldLabel:this.lang.label.username,width:150});}
_1.push({xtype:"textfield",name:"data[new_password]",id:"create_account_form_pw",inputType:"password",allowBlank:false,fieldLabel:this.lang.label.password,width:150,validator:this.validatePassword});_1.push({xtype:"textfield",name:"data[retype_password]",id:"create_account_form_pw_confirm",inputType:"password",allowBlank:false,fieldLabel:this.lang.label.confirmPassword,width:150,validator:this.validateRetype});_1.push({xtype:"hidden",name:"data[country]",value:this.country});}else{_1.push({xtype:"hidden",name:"auth_vars["+this.session_name+"]",value:this.session_id});_1.push({xtype:"hidden",name:"auth_vars[hide_password]",value:this.hidePassword});if(this.generic_errors){_1.push({xtype:"hidden",name:"generic_error",value:true});}
if(!this.restore_cart){_1.push({xtype:"hidden",id:"restore_cart_el",name:"restore_cart",value:false});}
if(this.hidePassword=="Y"){_1.push({xtype:"hidden",name:"auth_vars[limited_access]",value:"Y"});}
if(this.usernameLabel!=""){this.loginNameLabel=this.usernameLabel;}else{if(this.emailAsLogin=="Y"){this.loginNameLabel=this.lang.label.emailAddress;}else{this.loginNameLabel=this.lang.label.username;}}
if(this.emailAsLogin=="Y"&&!this.allow_username_transition){_1.push({xtype:"textfield",vtype:"email",name:"user_login",id:this.id+"login_form_un",allowBlank:false,fieldLabel:this.loginNameLabel,anchor:"90%"});}else{_1.push({xtype:"textfield",name:"user_login",id:this.id+"login_form_un",allowBlank:false,fieldLabel:this.loginNameLabel,anchor:"90%"});}
if(this.hidePassword=="N"){_1.push({xtype:"textfield",name:"password",id:this.id+"login_form_pw",ctCls:"wse-fld-hld-pass",inputType:"password",allowBlank:false,fieldLabel:this.lang.label.password,anchor:"90%"});}
if(this.hidePassword=="N"&&this.createAccount!="Y"){var _2=this.recvrPassAsPopup?"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').showRPWin(); return false;\">":"<a href=\""+this.forget_url+"\">";_1.push({border:false,html:"<p class=\"wse-lnk wse-lnk-forgot\">"+_2+this.lang.message.forgotPassword+"</a></p>"});}
if(this.hideRememberMe=="N"){_1.push({xtype:"checkbox",ctCls:"loginwin-rememberme wse-rembrme",name:"auth_vars[remember_me]",inputValue:"1",checked:true,allowBlank:true,hideLabel:true,boxLabel:this.lang.label.rememberMe,style:"overflow: visible"});}
if(this.hideCreateAccount=="N"&&this.createAccountAsButton!="Y"){_1.push({border:false,html:"<p class=\"wse-lnk wse-lnk-new\">"+this.create_url+this.lang.message.createAccount+"</a></p>"});}}
this.formPanel=new Ext.FormPanel({autoHeight:true,border:false,bodyBorder:false,labelWidth:100,labelAlign:"right",hideMode:"visibility",items:_1,keys:[{key:[10,13],fn:this.login,scope:this}]});if(!this.hideButtons){var _3=[];if(this.hideCreateAccount=="N"&&this.createAccountAsButton=="Y"){var _4={xtype:"button",text:this.lang.button.newAccount,cls:"login-secondary-button wse-xbtn wse-xbtn-minor login-secondary-button-red wse-xbtn-new",ctCls:"wse-hld-new",handler:this.createAccountHandler,scope:this};_3.push(_4);}
_3.push({xtype:"button",text:this.lang.button.cancel,cls:"wse-xbtn wse-xbtn-minor wse-xbtn-cancel",handler:this.collapse,scope:this});_3.push({xtype:"button",text:this.loginButtonText,cls:"wse-xbtn wse-xbtn-login",handler:this.login,scope:this});this.buttons=_3;}
if(this.mode!="window"&&!this.created_in_parent){this.formPanel.hide();}
this.items=[this.formPanel];if(this.mode=="window"&&!this.created_in_parent){this.setWindowPosition();}else{if(!this.created_in_parent){this.setPanelPosition();}}
LoginFormPanel.superclass.initComponent.call(this);this.setUpForm.defer(this,1000);},initEvents:function(){this.on("expand",this.setUpForm,this);if(this.created_in_parent){this.on("beforecollapse",this.closeWinParent,this);}
this.on("collapse",this.hideFeatures,this);this.on("clear_required",this.clearRequiredFlags,this);this.on("keep_cart_address",this.setRestoreCart,this);this.on("restore_address",this.unsetRestoreCart,this);LoginFormPanel.superclass.initEvents.call(this);},destroy:function(){try{this.formPanel=null;}
catch(e){}
LoginFormPanel.superclass.destroy.call(this);},validatePassword:function(_5){if(_5==null||_5==""){return this.lang.message.errorBlankPassword;}
var _6=_5.length/6;if(_6>1){_6=1;}
if(_6>=1){return true;}else{return this.lang.message.errorPasswordLength.replace("$X",6);}},validateRetype:function(_7){if(_7==null||_7==""){return this.lang.message.errorBlankPassword;}
var _8=Ext.getCmp("create_account_form_pw");var _9=Ext.getCmp("create_account_form_pw_confirm");if(!_8.getValue()||!_9.getValue()){return this.lang.message.errorBlankPassword;}
if(_8.getValue()!=_9.getValue()){return this.lang.message.errorPasswordsDontMatch;}
return true;},closeWinParent:function(){try{this.findParentByType("window").hide();}
catch(e){}
this.fireEvent("parentwindowclose");},setUpForm:function(){try{if(this.formPanel){if(this.mode=="window"){this.setWindowPosition();}else{this.setPanelPosition();}
this.doLayout();this.show();this.formPanel.show();Ext.getCmp(this.id+"login_form_un").focus();}}
catch(e){}},setPanelPosition:function(){var _a=Ext.get("mainArea");if(_a){var r=_a.getRight();this.setPosition(r-this.width,0);}},setWindowPosition:function(){var _c=Ext.get("mainBody");var _d=Ext.get("mainArea");var _e=_c.getWidth();var _f=_d.getTop();var x=(_e/2);var y=_f+50;this.setPosition(x,y);},hideFeatures:function(){this.formPanel.hide();this.hide();},clearRequiredFlags:function(){var _12=this.formPanel.getForm();_12.clearInvalid();},setRestoreCart:function(){if(!this.restore_cart){this.restore_cart=true;this.add({xtype:"hidden",id:"restore_cart_el",name:"restore_cart",value:false});}},unsetRestoreCart:function(){if(this.restore_cart){this.restore_cart=false;this.remove(Ext.getCmp("restore_cart_el"));}},login:function(){var _13;if(this.createAccount=="Y"&&this.requireDealer=="Y"&&this.hasDealer=="N"){_13=this.showDealerLocator;}else{_13=this.redirect;}
var _14=this.formPanel.getForm();if(_14.isValid()){_14.waitMsgTarget=true;_14.submit({url:this.url,params:{},clientValidation:false,scope:this,success:_13,failure:this.showErrorMsg,discardUrl:false,nocache:false,waitMsg:this.wait_msg,timeout:45,scripts:false});}},createAccountHandler:function(){if(this.created_in_parent){this.closeWinParent();}
if(this.create_as_popup=="N"&&this.create_as_panel=="N"){window.location.href=this.create_url_javascript;}else{if(this.in_checkout){createAccountPopup(true,this.getEl());}else{createAccountPopup(this.getEl());}}},redirect:function(_15,_16){if(this.mode=="window"||this.created_in_parent){this.closeWinParent();}else{this.hide();}
var _17=false;if(_16&&_16.result){if(_16.result.has_dealer=="Y"){_17=true;}}
if(this.fireEvent("beforeredirect",this,_17)===false){return false;}
if(this.redirect_url){window.location.href=this.redirect_url;}},showDealerLocator:function(_18,_19){this.collapse();if(this.dealerLocater_javascript=="Y"){if(_19.result.zipcode){chooseDealer(this,this.redirect_url,zipcode);}else{chooseDealer(this,this.redirect_url);}}else{window.location.href=this.dealerLocater_url;}},switchToEmail:function(){var _1a=new Ext.Window({closeAction:"hide",bodyStyle:"background-color: white; padding: 5px 5px 5px 5px",items:new Ext.form.FormPanel({autoHeight:true,border:false,bodyBorder:false,labelAlign:"right",hideMode:"visibility",width:300,labelWidth:80,labelAlign:"right",id:this.id+"email_form",items:[{html:this.lang.message.loginNeedEmail,border:false},{xtype:"textfield",vtype:"email",align:"center",id:this.id+"new_email",name:"new_email",allowBlank:false,fieldLabel:this.lang.label.emailAddress}],buttons:[{xtype:"button",text:this.lang.button.ok,handler:function(){var _1b=_1a.findById(this.id+"email_form").getForm();if(_1b.isValid()){_1b.waitMsgTarget=true;_1b.submit({url:"json.php?target=auth_gateway&method=setEmail",params:{user_login:this.formPanel.getComponent(this.id+"login_form_un").getValue(),password:this.formPanel.getComponent(this.id+"login_form_pw").getValue()},clientValidation:false,scope:this,success:function(){this.formPanel.getComponent(this.id+"login_form_un").setValue(_1a.findById(this.id+"email_form").findById(this.id+"new_email").getValue());_1a.hide();this.login();},failure:this.showErrorMsg,discardUrl:false,nocache:false,waitMsg:this.lang.mask.updatingEmail,timeout:45,scripts:false});}},scope:this,align:"center"}]})});_1a.show(this);},switchToUsername:function(){var _1c=new Ext.Window({closeAction:"hide",bodyStyle:"background-color: white; padding: 5px 5px 5px 5px",width:320,items:new Ext.form.FormPanel({autoHeight:true,border:false,bodyBorder:false,labelAlign:"right",hideMode:"visibility",width:300,labelWidth:80,labelAlign:"right",id:this.id+"username_form",items:[{html:this.lang.message.loginNeedUsername,border:false},{xtype:"textfield",align:"center",id:this.id+"new_username",name:"new_username",allowBlank:false,fieldLabel:this.lang.label.username}],buttons:[{xtype:"button",text:this.lang.button.ok,handler:function(){var _1d=_1c.findById(this.id+"username_form").getForm();if(_1d.isValid()){_1d.waitMsgTarget=true;_1d.submit({url:"json.php?target=auth_gateway&method=setUsername",params:{user_login:this.formPanel.getComponent(this.id+"login_form_un").getValue(),password:this.formPanel.getComponent(this.id+"login_form_pw").getValue()},clientValidation:false,scope:this,success:function(){this.formPanel.getComponent(this.id+"login_form_un").setValue(_1c.findById(this.id+"username_form").findById(this.id+"new_username").getValue());_1c.hide();this.login();},failure:this.showErrorMsg,discardUrl:false,nocache:false,waitMsg:this.lang.mask.updatingUsername,timeout:45,scripts:false});}},scope:this,align:"center"}]})});_1c.show(this);},showErrorMsg:function(_1e,_1f){if(_1f.result){fail_message="";if(_1f.result.errors){for(var i in _1f.result.errors){fail_message+=_1f.result.errors[i]+"<br/>";}}}else{fail_message=this.lang.message.anErrorOccured;}
Ext.WindowMgr.zseed=50000;if(_1f.result.enter_email){this.switchToEmail();}else{if(_1f.result.enter_username){this.switchToUsername();}else{Ext.MessageBox.show({title:this.lang.title.error,msg:fail_message,buttons:Ext.MessageBox.OK,animEl:this.getEl(),icon:Ext.MessageBox.ERROR,modal:false,width:400});}}
this.setUpForm();},showRPWin:function(){var _21=new RecoverPasswordWin({title:this.lang.recoverpass.title});_21.show();if(this.mode=="window"||this.created_in_parent){this.closeWinParent();}else{this.hide();}}});
var LoginFormWin=Ext.extend(Ext.Window,{layout:"fit",closable:true,shim:true,buttonAlign:"center",width:350,border:false,bodyBorder:false,shadow:false,resizable:false,closeAction:"hide",animateTarget:null,animCollapse:true,loginButtonText:"Login",hideCreateAccount:"N",createAccountAsButton:"N",lang:CommonTemplatesLang.LoginFormWindow,cls:"wse-win-login",initComponent:function(){var _1=this.initialConfig;Ext.apply(_1,{id:this.getId()+"-panel",width:"auto",autoWidth:true,floating:false,mode:"panel",hideButtons:true,created_in_parent:true,collapsed:false,collapsible:false,title:null,listeners:{parentwindowclose:this.hide.createDelegate(this)}});if(!this.loginButtonText){this.loginButtonText=this.lang.button.login;}
this.items=[new LoginFormPanel(_1)];var _2=[];if(this.hideCreateAccount=="N"&&this.createAccountAsButton=="Y"){_2.push({xtype:"button",text:this.lang.button.newAccount,cls:"login-secondary-button wse-xbtn wse-xbtn-minor login-secondary-button-red wse-xbtn-new",ctCls:"wse-hld-new",handler:this.createAccountHandler,scope:this});}
_2.push({xtype:"button",text:this.lang.button.cancel,cls:"wse-xbtn wse-xbtn-minor wse-xbtn-cancel",handler:this.hideWindow,scope:this});_2.push({xtype:"button",text:this.loginButtonText,cls:"wse-xbtn wse-xbtn-login",handler:this.login,scope:this});this.buttons=_2;LoginFormWin.superclass.initComponent.call(this);},initEvents:function(){try{this.relayEvents(this.getComponent(0),["beforeredirect"]);}
catch(e){}
LoginFormWin.superclass.initEvents.call(this);},hideWindow:function(){this.hide();},login:function(){try{this.getComponent(0).login();}
catch(e){}},createAccountHandler:function(){try{this.getComponent(0).createAccountHandler();}
catch(e){}}});
var RecoverPasswordWin=Ext.extend(Ext.Window,{layout:"fit",closable:true,shim:true,buttonAlign:"center",width:350,border:false,bodyBorder:false,shadow:false,resizable:false,closeAction:"close",animateTarget:null,animCollapse:true,eKey:null,usernameLabel:"",url:"json.php?target=auth_gateway&method=recoverPassword",modal:true,lang:CommonTemplatesLang.RecoverPasswordWindow,cls:"wse-win-recvrpass",initComponent:function(){if(!this.usernameLabel){this.usernameLabel=this.lang.label.user;}
var _1=[{border:false,html:"<div class=\"wse-msg\">"+this.lang.message+"</div>"},{xtype:"textfield",name:"user_login",allowBlank:false,anchor:"90%",fieldLabel:this.usernameLabel}];if(this.eKey){_1.push({xtype:"textfield",name:"user_ekey",allowBlank:false,anchor:"90%",value:this.eKey,fieldLabel:this.lang.label.ekey});}
this.items=[{xtype:"form",autoHeight:true,border:false,bodyBorder:false,labelWidth:100,labelAlign:"right",items:_1,keys:[{key:[10,13],fn:this._submit,scope:this}]}];this.buttons=[{xtype:"button",text:this.lang.button.cancel,cls:"wse-xbtn wse-xbtn-minor wse-xbtn-cancel",handler:this.close,scope:this},{xtype:"button",text:this.lang.button.recover,cls:"wse-xbtn wse-xbtn-recvr",handler:this._submit,scope:this}];RecoverPasswordWin.superclass.initComponent.call(this);},_submit:function(){var _2=this.getComponent(0).getForm();if(_2.isValid()){_2.waitMsgTarget=true;_2.submit({url:this.url,params:{},clientValidation:false,scope:this,success:this._submitFinish,failure:this._submitError,discardUrl:false,nocache:false,waitMsg:this.wait_msg,timeout:45,scripts:false});}},_submitError:function(_3,_4){var _5=this.lang.error.title;var _6=this.lang.error.message;if(_4&&_4.result){if(_4.result.title){_5=_4.result.title;}
if(_4.result.message){_6=_4.result.message;}}
Ext.Msg.alert(_5,_6);},_submitFinish:function(_7,_8){var _9=this.lang.error.title;var _a=this.lang.error.message;if(_8&&_8.result){if(_8.result.title){_9=_8.result.title;}
if(_8.result.message){_a=_8.result.message;}}
Ext.Msg.alert(_9,_a);this.close();}});
var TopMenuSubMenuPanel=Ext.extend(Ext.Panel,{cls:"topmenu_submenu_panel",autoHeight:true,border:false,borderBody:false,floating:true,shim:true,collapsible:false,header:false,hidden:true,menuItemId:null,closeTask:null,initComponent:function(){if(!this.contentEl){this.html="NEED CONTENT!!!!";}
if(Ext.isIE6){this.shadow=false;this.width=150;}
TopMenuSubMenuPanel.superclass.initComponent.call(this);},toggleView:function(){if(this.hidden){var x=0;var y=0;var _3=Ext.get(this.contentEl);_3.show();if(this.menuItemId){var _4=Ext.get(this.menuItemId);if(_4){x=_4.getLeft();y=_4.getBottom()-2;}}
this.show();this.setPosition(x,y);this.startCloseDelay();}else{this.hide();}},stopCloseDelay:function(){if(this.closeTask){this.closeTask.cancel();delete this.closeTask;}},startCloseDelay:function(){this.closeTask=new Ext.util.DelayedTask({});this.closeTask.delay(1000,this.checkIfClose,this);},checkIfClose:function(){this.stopCloseDelay();if(!this.hidden){if(!this.checkIfMouseOver()){this.hide();}else{this.startCloseDelay();}}},checkIfMouseOver:function(e){if(mouseX&&mouseY){var _6=this.getEl();var x=_6.getLeft();var y=_6.getTop();var w=_6.getWidth()+x;var h=_6.getHeight()+y;if((mouseX<=w)&&(mouseX>=x)&&(mouseY<=h)&&(mouseY>=y)){return true;}
try{_6=Ext.get(this.menuItemId);x=_6.getLeft();y=_6.getTop();w=_6.getWidth()+x;h=_6.getHeight()+y;if((mouseX<=w)&&(mouseX>=x)&&(mouseY<=h)&&(mouseY>=y)){return true;}}
catch(e){}}
return false;}});
var CategoryExpandManager=function(){this.currentOpenIndex=[];this.aIdString="";this.divIdString="";this.activeCls="";this.expanderMap=[];this.init=function(_1,_2,_3){if(_1&&_2){this.aIdString=_1;this.divIdString=_2;if(_3){this.activeCls=_3;}
try{var _4=this;var _5;var _6;var i=1;var _8;while(_5=Ext.get(_1+i)){if(_5.hasClass("ws-expanded")){this.currentOpenIndex.push(i);}
this.expanderMap[i]={linkId:_1+i,divId:_2+i};_6=Ext.get(_2+i);if(_6){_5.dom.onclick=function(){_4.expand(this);return false;};}
i++;}}
catch(e){}}};this.expand=function(_9){var _a=0;var _b;var _c;var _d=false;try{var _b=Ext.get(_9);var id=_b.dom.id;var _a=id.replace(this.aIdString,"");}
catch(e){return false;}
if(_b){_b.blur();}
if(this.currentOpenIndex){for(i in this.currentOpenIndex){if(this.currentOpenIndex[i]==_a){_a=0;_d={callback:function(){Ext.get(_f).removeClass(["sideboxes-categorytree-expander-show","ws-cattree-menu-on"]);}};}
try{var _f=this.expanderMap[this.currentOpenIndex[i]].divId;_c=Ext.get(_f);_c.removeClass(["sideboxes-categorytree-expander-show","ws-cattree-menu-on"]);if(this.activeCls){_b=Ext.get(this.expanderMap[this.currentOpenIndex[i]].linkId);_b.removeClass(this.activeCls);_b=_b.parent();if(_b){_b.removeClass(this.activeCls);}}}
catch(e){}}
this.currentOpenIndex=[];}
if(_a){try{_c=Ext.get(this.expanderMap[_a].divId);_c.show(true);_c.addClass(["sideboxes-categorytree-expander-show","ws-cattree-menu-on"]);if(this.activeCls){_b=Ext.get(this.expanderMap[_a].linkId);_b.addClass(this.activeCls);_b.focus();_b.blur();_b=_b.parent();if(_b){_b.addClass(this.activeCls);}}}
catch(e){}
this.currentOpenIndex.push(_a);}};};
var ProductComparisonApplication=Ext.extend(Ext.Panel,{defaultImageWidth:85,defaultImageHeight:85,border:false,bodyBorder:false,url:"json.php?target=product_comparison_gateway",method:"getProductDataForCompare",filterMethod:"getRowsForFilter",image_url:"image.php?object_type=product&amp;image_id=",exclude_product_ids:[],includeDealerDetails:false,includeDealerPrice:false,lang:CommonTemplatesLang.PCA,initComponent:function(){this.on("render",this.createMasks,this);this.highlightRadioGroup="<div class=\"compare-radiogroup wse-radios\">"+"<span><input type=\"radio\" name=\"highlight\" onclick=\"filterCompareProduct('off', 'compareProdForm','product_id_list','compare_','compare_but')\" value=\"off\" checked=\"checked\" />"+this.lang.label.off+"</span><br />"+"<span><input type=\"radio\" name=\"highlight\" onclick=\"filterCompareProduct('different', 'compareProdForm','product_id_list','compare_','compare_but')\" value=\"different\" />"+this.lang.label.differentValues+"</span><br />"+"<span><input type=\"radio\" name=\"highlight\" onclick=\"filterCompareProduct('similar', 'compareProdForm','product_id_list','compare_','compare_but')\" value=\"similar\" />"+this.lang.label.similarValues+"</span>"+"</div>";this.template="<div id=\"compare-app\" class=\"compare-app-holder wse-app-comp compare-app-holder-products{product_count} wse-app-comp-{product_count}\">"+"<div class=\"items wse-wrap wse-wrap-tbl\">"+"<table cellspacing=\"0\">"+"<thead>"+"<tr class=\"header wse-hd\">"+"<td>&nbsp</td>"+"<td class=\"compare-label wse-td-lbl\" colspan=\"{product_count}\">"+this.lang.message.youHaveXProductsToDisplay.replace("[1]","{product_count}")+"</td>"+"</tr>"+"<tr class=\"name wse-name\">"+"<tpl for=\"products\">"+"<tpl if=\"this.isFilter(values.filter)\">"+"<tpl if=\"this.hasData(values.features)\">"+"<td class=\"compare-filter wse-td-fltr\">"+"<div class=\"compare-filter wse-fltr\">"+"<span class=\"compare-filter-highlight  wse-hilite\">"+this.lang.title.highlightOptions+"</span>"+this.highlightRadioGroup+"</div>"+"</td>"+"</tpl>"+"</tpl>"+"<tpl if=\"!this.isFilter(values.filter)\">"+"<td class=\"wse-td-item\">"+"<div class=\"itemBox wse-box\">"+"<tpl if=\"this.showRemoveLink(parent.product_count)\">"+"<div class=\"remove-link wse-lnk wse-lnk-del\">"+"<a onclick=\"removeCompareProduct({product_id},'compareProdForm','product_id_list','compare_','compare_but'); return false;\">"+"<span>"+this.lang.button.remove+"</span>"+"</a>"+"</div>"+"</tpl>"+"<tpl if=\"this.hasData(main_pair)\">"+"<div class=\"image wse-img\">"+"<tpl if=\"main_pair\">"+"<tpl for=\"main_pair\">"+"<tpl for=\"image2\">"+"<tpl if=\"parent.image2_id\"><img src=\""+this.image_url+"{parent.image2_id}\" width=\"{image_x}\" height=\"{image_y}\" alt=\"{alt}\" /></tpl>"+"</tpl>"+"</tpl>"+"</tpl>"+"</div>"+"</tpl>"+"<tpl if=\"!this.hasData(main_pair)\">"+"<div class=\"image wse-img\"><img src=\""+this.image_url+"\" width=\""+this.defaultImageWidth+"\" height=\""+this.defaultImageHeight+"\" alt=\""+this.lang.message.noImage+"\" /></div>"+"</tpl>"+"<tpl if=\"price\">"+"<h4>{product}</h4>"+"<p class=\"wse-sku\"><span class=\"label wse-lbl\">"+this.lang.label.sku+"</span> <span class=\"wse-val\">{product_code}</span></p>"+"<p class=\"price wse-price\"><span class=\"label wse-lbl\">"+this.lang.label.price+"</span>&nbsp;<span class=\"wse-val\">{price}</span></p>"+"<div class=\"order wse-ordr\">"+"<div class=\"qty wse-qty\">"+"<span class=\"label wse-lbl\">"+this.lang.label.qty+"</span><input type=\"text\" class=\"inputText amount wse-fld wse-fld-qty\" id=\"amount_of_{product_id}\" name=\"product_data[{product_id}][amount]\" value=\"1\" />"+"</div>"+generateStdButtonHtml("addProductToCart(this, {product_id},{condition_id},'amount_of_{product_id}',cannot_buy, 'Y');",this.lang.button.addToCart)+"</div>"+"</tpl>"+"</div>"+"</td>"+"</tpl>"+"</tpl>"+"</tr>"+"<tr class=\"separate wse-sep\">"+"<td class=\"labels wse-td-lbl\">&nbsp</td>"+"<td class=\"items wse-td-val\" colspan=\"{product_count}\">&nbsp;</td>"+"</tr>"+"</thead>"+"<tbody id=\"feature_body\">"+"<tpl if=\"this.hasData(values.features)\">"+"<tpl for=\"values.feature_values\">"+"<tr id=\"feature_row_{row_id}\">"+"<tpl for=\"vals\">"+"<td class=\"{[xindex == 1 ? \"label wse-td-lbl\" : \"value wse-td-val\"]}\">"+"{.}"+"</td>"+"</tpl>"+"</tr>"+"</tpl>"+"</tpl>"+"</tbody>"+"</table>"+"</div>"+"</div>";this.template=new Ext.XTemplate(this.template,{isFilter:function(_1){return _1=="Y";},showRemoveLink:function(_2){return _2>2;},hasData:function(_3){if(_3){return true;}else{return false;}}});this.template.compile();ProductComparisonApplication.superclass.initComponent.call(this);},initEvents:function(){ProductComparisonApplication.superclass.initEvents.call(this);},createMasks:function(){try{}
catch(e){}},destroy:function(){try{this.template=null;this.exclude_product_ids=null;}
catch(e){}
ProductComparisonApplication.superclass.destroy.call(this);},showApp:function(_4,_5,_6,_7){if(_7==true){this.exclude_product_ids=[];}
var _8=Ext.get(_4);var _9={json_format:true};if(_8&&_6){var _a;var i=1;var _c;while(_a=Ext.get(_6+i)){if(_a.dom.checked==true){_c=_a.getValue(true);if(this.exclude_product_ids.indexOf(_c)==-1){_9["product_ids["+_c+"]"]=_c;}else{_a.dom.checked=false;}}
i++;}
_9["include_dealer_details"]=this.includeDealerDetails;_9["include_dealer_price"]=this.includeDealerPrice;try{this.loadingMask.show();}
catch(e){}
Ext.Ajax.request({method:"POST",url:this.url+"&method="+this.method,params:_9,success:this.receiveCompareData,scope:this});}},filterProduct:function(_d,_e,_f,_10){var _11=Ext.get(_e);var _12={json_format:true,filter_type:_d};if(_11&&_10){var _13;var i=1;var _15;while(_13=Ext.get(_10+i)){if(_13.dom.checked==true){_15=_13.getValue(true);if(this.exclude_product_ids.indexOf(_15)==-1){_12["product_ids["+_15+"]"]=_15;}else{_13.dom.checked=false;}}
i++;}
try{this.filteringMask.show();}
catch(e){}
Ext.Ajax.request({method:"POST",url:this.url+"&method="+this.filterMethod,params:_12,success:this.receiveFilterRows,scope:this});}},removeProduct:function(_16,_17,_18,_19){this.exclude_product_ids.push(_16);this.showApp(_17,_18,_19);},receiveCompareData:function(_1a,_1b){try{this.loadingMask.hide();}
catch(e){}
this.compare_data=Ext.util.JSON.decode(_1a.responseText);if(this.rendered){this.body.update(this.template.apply(this.compare_data));}else{this.html=this.template.apply(this.compare_data);}},receiveFilterRows:function(_1c,_1d){try{this.filteringMask.hide();}
catch(e){}
this.filter_data=Ext.util.JSON.decode(_1c.responseText);var i,j;for(i=0;i<this.filter_data.total;i++){Ext.get("feature_row_"+i).removeClass("highlighted");}
for(j=0;j<this.filter_data.rows.length;j++){Ext.get("feature_row_"+this.filter_data.rows[j]).addClass("highlighted");}}});
Ext.QuickTips.init();Ext.form.Field.prototype.msgTarget="side";Ext.namespace("contactForm");
contactForm.Window=Ext.extend(Ext.Window,{layout:"fit",closable:true,closeAction:"hide",shadow:true,shim:false,animateTarget:null,animCollapse:true,buttonAlign:"center",border:false,bodyBorder:false,bodyStyle:"padding:1em; margin:0; text-align:left;",autoScroll:false,autoHeight:true,width:420,formLabelWidth:130,submitButtonWidth:100,title:"",lang:"",listeners:{beforedestroy:function(w){Ext.destroy(w.mask);}},google_gateway_url:"json.php?target=dealer_locater&method=search",url:"json.php?target=form_gateway",method:"&method=submitContactForm",sendFormBy:"",siteType:"",leadType:"",formOwner:"",formTitle:"",formName:"",displayConfig:"",requiredFieldsConfig:"",initialValues:"",initComponent:function(){this.items=[{xtype:"contactForm.Form",formUrl:this.url,formMethod:this.method,labelWidth:this.formLabelWidth,submitButtonWidth:this.submitButtonWidth,lang:this.lang,displayConfig:this.displayConfig,requiredFieldsConfig:this.requiredFieldsConfig,initialValues:this.initialValues,sendFormBy:this.sendFormBy,siteType:this.siteType,leadType:this.leadType,formOwner:this.formOwner,formTitle:this.formTitle,formName:this.formName,listeners:{"form_complete":{fn:this.prepareToHide,scope:this}}}];contactForm.Window.superclass.initComponent.call(this);},initEvents:function(){contactForm.Window.superclass.initEvents.call(this);},prepareToHide:function(){var _2=new Ext.util.DelayedTask({});_2.delay(250,this.hide,this);},destroy:function(){contactForm.Window.superclass.destroy.call(this);}});Ext.reg("contactForm.Window",contactForm.Window);
contactForm.Panel=Ext.extend(Ext.Panel,{layout:"fit",border:false,bodyBorder:false,bodyStyle:"padding:1em; margin:0; text-align:left;",autoScroll:false,autoHeight:true,width:"auto",formLabelWidth:130,submitButtonWidth:100,lang:"",listeners:{beforedestroy:function(w){Ext.destroy(w.mask);}},google_gateway_url:"json.php?target=dealer_locater&method=search",url:"json.php?target=form_gateway",method:"&method=submitContactForm",sendFormBy:"",siteType:"",leadType:"",formOwner:"",formTitle:"",formName:"",displayConfig:"",requiredFieldsConfig:"",initialValues:"",initComponent:function(){this.items=[{xtype:"contactForm.Form",formUrl:this.url,formMethod:this.method,labelWidth:this.formLabelWidth,submitButtonWidth:this.submitButtonWidth,lang:this.lang,displayConfig:this.displayConfig,requiredFieldsConfig:this.requiredFieldsConfig,initialValues:this.initialValues,sendFormBy:this.sendFormBy,siteType:this.siteType,leadType:this.leadType,formOwner:this.formOwner,formTitle:this.formTitle,formName:this.formName}];contactForm.Panel.superclass.initComponent.call(this);},initEvents:function(){contactForm.Panel.superclass.initEvents.call(this);},destroy:function(){contactForm.Panel.superclass.destroy.call(this);}});Ext.reg("contactForm.Panel",contactForm.Panel);
contactForm.Form=Ext.extend(Ext.FormPanel,{buttonAlign:"center",animateTarget:null,border:false,bodyBorder:false,bodyStyle:"padding: 5px",autoScroll:false,autoHeight:true,formAnchorWidth:"90%",labelWidth:130,labelAlign:"right",labelSeparator:":",defaultType:"textfield",submitButtonWidth:100,lang:"",google_gateway_url:"json.php?target=dealer_locater&method=search",formUrl:"json.php?target=form_gateway",formMethod:"&method=submitContactForm",sendFormBy:"",siteType:"",leadType:"",formOwner:"",formTitle:"",formName:"",productSku:"",displayConfig:"",requiredFieldsConfig:"",initialValues:"",fileUpload:true,enctype:"multipart/form-data",cls:"contactform-form wse-contact-form",initComponent:function(){var _1=[];if(this.displayConfig.contact_form_config.address_display_state){webStore.stateList.load();}
if(this.displayConfig.contact_form_config.address_display_country){webStore.countryList.load();}
if(this.displayConfig.contact_form_config.include_best_time_to_contact){this.contactTimeStore=new Ext.data.JsonStore({fields:["contact_time"],data:[{contact_time:this.lang.contact_time.anytime},{contact_time:this.lang.contact_time.morning},{contact_time:this.lang.contact_time.afternoon},{contact_time:this.lang.contact_time.evening}]});}
if(this.displayConfig.top_disclaimer){var _2="<div class=\"contactform-topinfo\">"+"<div class=\"contactform-topinfo-topcap\"></div>"+"<div class=\"contactform-topinfo-wrapper\">"+this.displayConfig.top_disclaimer+"</div>"+"<div class=\"contactform-topinfo-bottomcap\"></div>"+"</div>";_1.push({xtype:"panel",border:false,width:this.width,html:_2});}
_1.push({xtype:"textfield",id:this.id+"-first-name",fieldLabel:this.lang.label.firstName,labelSeparator:this.labelSeparator,name:"data[first_name]",value:this.initialValues.first_name,anchor:this.formAnchorWidth,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-first-name",true),allowBlank:false},{xtype:"textfield",id:this.id+"-last-name",fieldLabel:this.lang.label.lastName,labelSeparator:this.labelSeparator,name:"data[last_name]",value:this.initialValues.last_name,anchor:this.formAnchorWidth,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-last-name",true),allowBlank:false},{xtype:"textfield",id:this.id+"-email",fieldLabel:this.lang.label.email,labelSeparator:this.labelSeparator,name:"data[email]",value:this.initialValues.email,anchor:this.formAnchorWidth,plugins:[Ext.ux.plugins.RemoteValidator],rvOptions:{url:"json.php?target=common&method=validateEmailAddress"},allowBlank:false},{xtype:"PhoneField",fieldLabel:this.lang.label.phone,labelSeparator:this.labelSeparator,name:"data[phone]",value:this.initialValues.phone,anchor:this.formAnchorWidth,allowBlank:this.requiredFieldsConfig.require_phone});if(this.displayConfig.contact_form_config.include_best_time_to_contact){_1.push({xtype:"combo",id:this.id+"-best-time-to-contact",fieldLabel:this.lang.label.bestTimeToContact,labelSeparator:this.labelSeparator,name:"data[contact_time]",anchor:this.formAnchorWidth,store:this.contactTimeStore,valueField:"contact_time",displayField:"contact_time",mode:"local",selectOnFocus:true,editable:true,triggerAction:"all",forceSelection:true,typeAhead:true},{xtype:"panel",layout:"column",autoWidth:true,border:false,items:[{columnWidth:0.65,layout:"form",border:false,labelWidth:this.labelWidth,items:[{xtype:"checkbox",fieldLabel:this.lang.label.preferredMethod,labelSeparator:this.labelSeparator,name:"data[email_method]",boxLabel:this.lang.label.email,checked:true}]},{columnWidth:0.35,layout:"form",border:false,hideLabel:true,items:[{xtype:"checkbox",hideLabel:true,name:"data[phone_method]",boxLabel:this.lang.label.phone}]}]});}
if(this.displayConfig.contact_form_config.address_display_zip){_1.push({xtype:"textfield",id:this.id+"-zip",fieldLabel:this.lang.label.zip,labelSeparator:this.labelSeparator,name:"data[zip]",anchor:this.formAnchorWidth,allowBlank:this.requiredFieldsConfig.require_zipcode,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-zip",true),listeners:{"blur":{fn:this.getAddressFromGoogle,scope:this}}});}
if(this.displayConfig.contact_form_config.address_display_city){_1.push({xtype:"textfield",id:this.id+"-city",fieldLabel:this.lang.label.city,labelSeparator:this.labelSeparator,name:"data[city]",anchor:this.formAnchorWidth,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-city",true),allowBlank:this.requiredFieldsConfig.require_city});}
if(this.displayConfig.contact_form_config.address_display_state){_1.push({xtype:"combo",id:this.id+"-state",fieldLabel:this.lang.label.state,labelSeparator:this.labelSeparator,hiddenName:"data[state]",anchor:this.formAnchorWidth,store:webStore.stateList,valueField:"code",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",emptyText:this.lang.label.stateEmptyText,forceSelection:true,allowBlank:this.requiredFieldsConfig.require_state});}
if(this.displayConfig.contact_form_config.address_display_country){_1.push({xtype:"combo",fieldLabel:this.lang.label.country,id:this.id+"-country",labelSeparator:this.labelSeparator,hiddenName:"data[country]",anchor:this.formAnchorWidth,store:webStore.countryList,valueField:"abbr",displayField:"country",typeAhead:true,mode:"local",triggerAction:"all",emptyText:this.lang.label.countryEmptyText,forceSelection:true,allowBlank:this.requiredFieldsConfig.require_country,listeners:{"select":{fn:this.reloadStates,scope:this}}});}
_1.push({xtype:"textfield",id:this.id+"-subject",fieldLabel:this.lang.label.subject,labelSeparator:this.labelSeparator,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-subject",true),name:"data[subject]",anchor:this.formAnchorWidth},{xtype:"textarea",id:this.id+"-message",fieldLabel:this.lang.label.message,labelSeparator:this.labelSeparator,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-message",true),name:"data[message]",anchor:this.formAnchorWidth,allowBlank:false});if(this.displayConfig.contact_form_config.attachment){var _3=this.lang.label.attachment;if(this.displayConfig.contact_form_config.size_Limit>0){_3=_3+"("+this.lang.label.upTo+" "+this.displayConfig.contact_form_config.size_Limit+" "+this.lang.label.mb+")";}
_1.push({xtype:"textfield",inputType:"file",id:this.id+"-attachment",fieldLabel:_3,labelSeparator:this.labelSeparator,validator:validateInput_NoSpaces.createDelegate(this,this.id+"-attachment",true),name:"attachment",anchor:this.formAnchorWidth,allowBlank:true});}
_1.push({xtype:"fieldset",hidden:true,border:false,frame:false,items:[{xtype:"textfield",hidden:true,value:this.sendFormBy,name:"data[send_by]"},{xtype:"textfield",hidden:true,value:(this.siteType?this.siteType:"store"),name:"data[site_type]"},{xtype:"textfield",hidden:true,value:this.leadType,name:"data[lead_type]"},{xtype:"textfield",hidden:true,value:this.formOwner,name:"data[form_owner]"},{xtype:"textfield",hidden:true,value:this.formTitle,name:"data[form_title]"},{xtype:"textfield",hidden:true,value:this.formName,name:"data[form_name]"},{xtype:"textfield",hidden:true,value:this.lang.label.productSku,name:"data[product_code]"},{xtype:"textfield",hidden:true,value:this.lang.label.productName,name:"data[product_name]"}]});this.items=_1;this.buttons=[{xtype:"button",text:this.lang.button.submit,minWidth:this.submitButtonWidth,handler:this.submitForm,scope:this}];contactForm.Form.superclass.initComponent.call(this);},initEvents:function(){try{Ext.getCmp(this.id+"-best-time-to-contact").setValue(this.lang.contact_time.anytime);}
catch(e){}
contactForm.Form.superclass.initEvents.call(this);},destroy:function(){contactForm.Form.superclass.destroy.call(this);},reloadStates:function(_4,_5,_6,_7){if(this.displayConfig.contact_form_config.address_display_state){var _8=Ext.getCmp(this.id+"-state");var cc;if(_7){cc=_7;}else{if(_5.data){cc=_5.data.abbr;}}
if(cc){_8.store.reload({params:{country_code:cc}});}}},getAddressFromGoogle:function(_a){var _b=new GClientGeocoder();_b.getLocations(_a.getValue(),this.receiveAddressFromGoogle.createDelegate(this));},receiveAddressFromGoogle:function(_c){if(this.displayConfig.contact_form_config.address_display_state||this.displayConfig.contact_form_config.address_display_city){if(this.displayConfig.contact_form_config.address_display_city){var _d=Ext.getCmp(this.id+"-city");}
if(this.displayConfig.contact_form_config.address_display_state){var _e=Ext.getCmp(this.id+"-state");}
if(this.displayConfig.contact_form_config.address_display_country){var _f=Ext.getCmp(this.id+"-country");}
if(!_c||_c.Status.code!=200){if(this.displayConfig.contact_form_config.address_display_city){_d.setValue();}
if(this.displayConfig.contact_form_config.address_display_state){_e.clearValue();}
if(this.displayConfig.contact_form_config.address_display_country){_f.clearValue();}}else{place=_c.Placemark[0];if(place.AddressDetails.Country){country=place.AddressDetails.Country;if(place.AddressDetails.Country.CountryNameCode){country_code=place.AddressDetails.Country.CountryNameCode;if(this.displayConfig.contact_form_config.address_display_state){this.reloadStates(null,null,null,country_code);}
if(this.displayConfig.contact_form_config.address_display_country){_f.setValue(country_code);}}
if(place.AddressDetails.Country.AdministrativeArea){if(this.displayConfig.contact_form_config.address_display_city){if(place.AddressDetails.Country.AdministrativeArea.Locality){city=place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName;_d.setValue(city);}else{_d.setValue();}}
if(this.displayConfig.contact_form_config.address_display_state){if(place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName){state=place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;_e.setValue(state);}else{_e.clearValue();}}}else{if(this.displayConfig.contact_form_config.address_display_city){_d.setValue();}
if(this.displayConfig.contact_form_config.address_display_state){_e.clearValue();}
if(this.displayConfig.contact_form_config.address_display_country){_f.clearValue();}}}else{if(this.displayConfig.contact_form_config.address_display_city){_d.setValue();}
if(this.displayConfig.contact_form_config.address_display_state){_e.clearValue();}
if(this.displayConfig.contact_form_config.address_display_country){_f.clearValue();}}}}},submitForm:function(){var _10=this.getForm();if(_10.isValid()){_10.waitMsgTarget=true;try{_10.submit({url:this.formUrl+this.formMethod,scope:this,success:this.showThankYou,failure:this.showErrorMsg,waitMsg:this.lang.waitMsg.sending,timeout:45,scripts:false});}
catch(e){alert(e);}}else{Ext.MessageBox.show({title:this.lang.message.incompleteTitle,msg:this.lang.message.incomplete,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:150});}},showThankYou:function(_11,_12){var msg;if(_12.result&&_12.result.message){msg=_12.result.message;}else{msg=this.lang.message.response;}
Ext.MessageBox.show({title:this.lang.message.responseTitle,msg:msg,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:150});this.getForm().reset();this.fireEvent("form_complete");},showErrorMsg:function(_14,_15){var msg;if(_15.result&&_15.result.message){msg=_15.result.message;}else{msg=this.lang.message.error;}
Ext.MessageBox.show({title:this.lang.message.errorTitle,msg:msg,buttons:Ext.MessageBox.OK,animEl:this.animateTarget,modal:false,maxWidth:250});}});Ext.reg("contactForm.Form",contactForm.Form);
Ext.namespace("ProdSearch");
ProdSearch.DynMenuHelper=Ext.extend(Ext.util.Observable,{_inputEl:null,_checkEl:null,_hiddenEl:null,_inputFocus:false,_resizer:null,_menu:null,_dataCount:0,_menuConfig:null,_updateCompId:null,initMenu:function(_1,_2){if(_1&&!this._inputEl){var el=Ext.get(_1);if(!el){return;}
if(!_2){_2={};}
if(_2.checkBoxFieldId){try{this._checkEl=Ext.get(_2.checkBoxFieldId);}
catch(e){}}
this._menuConfig=_2;this._inputEl=el;if(!_2.updateCompId){this._createHiddenField();}else{this._updateCompId=_2.updateCompId;this._menuConfig.moreLinkText=null;}
if(Ext.isGecko){this._inputEl.dom.setAttribute("autocomplete","off");}
this._inputEl.on("focus",this._triggerMenu,this);this._inputEl.on("click",this._triggerMenu,this);this._inputEl.on("keydown",this._triggerMenu,this);this._inputEl.on("blur",this._setBlurStatus,this);}},removeMenu:function(){if(this._menu){this._menu.destroy();}
this._inputEl=null;},_triggerMenu:function(){if(!this._allowMenu()){return;}
this._inputFocus=true;if(this._menu==null){Ext.apply(this._menuConfig,{width:this._inputEl.getWidth()+2,inputField:this._inputEl,doRedirect:(this._updateCompId?false:true),listeners:{"dataloaded":this._setResultCount.createDelegate(this),"morerequested":this._submitForm.createDelegate(this),"valuechange":this._updateFormValue.createDelegate(this),"productselect":this._fillValue.createDelegate(this)}});this._menu=new ProdSearch.Menu(this._menuConfig);delete(this._menuConfig);}
this._validateMenuShow();},_setBlurStatus:function(){this._inputFocus=false;},_setResultCount:function(_4,_5){this._dataCount=_5;this._validateMenuShow(_4);},_validateMenuShow:function(_6){if(this._dataCount>0&&this._inputFocus){try{this._menu.getEl().setStyle("height","auto");this._menu.show(this._inputEl,"tl-bl?");if(this._resizer){this._resizer.purgeListeners();this._resizer.destroy();}
this._resizer=new Ext.Resizable(this._menu.getEl(),{pinned:false,handles:"se",listeners:{beforeresize:this._constrainResize.createDelegate(this)}});}
catch(e){}}else{this._menu.hide();}},_constrainResize:function(_7,e){if(_7){_7.minWidth=this._inputEl.getWidth()+2;_7.minHeight=this._menu.getEl().getHeight();_7.maxHeight=_7.minHeight;}},_updateFormValue:function(_9,_a){if(this._hiddenEl){this._hiddenEl.value=_a;}},_submitForm:function(){try{this._inputEl.up("form").dom.submit();}
catch(e){}},_createHiddenField:function(){try{var _b=this._inputEl.up("form");var _c=this._inputEl.dom.name?this._inputEl.dom.name:"q";var _d=this._inputEl.getValue();if(!_d){_d="";}
var id=Ext.id()+"-q";this._hiddenEl=this._inputEl.insertSibling({tag:"input",type:"hidden",name:_c,id:id},"before",true);this._hiddenEl.value=_d;this._inputEl.dom.removeAttribute("name");}
catch(e){}},_fillValue:function(_f,_10){if(this._updateCompId){try{Ext.getCmp(this._updateCompId).setValue(_10.name);}
catch(e){}}},_allowMenu:function(){if(this._checkEl){if(!this._checkEl.dom.checked){return false;}}
return true;}});
ProdSearch.Menu=function(_1){ProdSearch.Menu.superclass.constructor.call(this,_1);this.plain=true;if(_1.width){this.width=_1.width;delete(_1.width);}
var mi=new ProdSearch.MenuItem(_1);this.add(mi);this.relayEvents(mi,["productselect","dataloaded","morerequested","valuechange"]);};Ext.extend(ProdSearch.Menu,Ext.menu.Menu,{cls:"prodsearch-dyn-menu wse-srch-dynmenu",shadow:"drop",showAt:function(xy,_4,_e){this.parentMenu=_4;if(!this.el){this.render();}
if(_e!==false){this.fireEvent("beforeshow",this);xy=this.el.adjustForConstraints(xy);}
this.el.setXY(xy);this.el.show();this.hidden=false;this.el.unselectable="on";this.fireEvent("show",this);}});
ProdSearch.MenuItem=function(_1){if(!_1){_1={};}
ProdSearch.MenuItem.superclass.constructor.call(this,new ProdSearch.ListPanel(_1),_1);this.relayEvents(this.component,["productselect","dataloaded","morerequested","valuechange"]);};Ext.extend(ProdSearch.MenuItem,Ext.menu.Adapter);
ProdSearch.ListPanel=Ext.extend(Ext.Panel,{inputField:null,gatewayUrl:"json.php?target=products&area=C",detailUrl:"index.php",maxMenuItems:5,moreLinkText:CommonTemplatesLang.ProdSearch.button.more,minQueryLength:2,whereFoundEnabled:"N",allowWhiteSpace:false,manufacturerId:0,categoryId:0,doRedirect:true,border:false,cls:"prodsearch-dyn-menu-list wse-lst wse-lst-dynmenu",autoHeight:true,_currentValue:"",initComponent:function(){this.addEvents("dataloaded","productselect","morerequested","valuechange");var _1=this.getId();var _2=new Ext.XTemplate("<ul>","<tpl for=\".\">","<li class=\"prodsearch-dyn-menu-item wse-lnk{[xindex == 1 ? \" first wse-first\" : \"\"]}{[xindex == xcount ? \" last wse-last\" : \"\"]}\"><span>{name}</span></li>","</tpl>","</ul>","<tpl if=\"this.needMoreLink()\">",(this.moreLinkText?"<div class=\"prodsearch-dyn-menu-more wse-more\"><a href=\"#\" onclick=\"Ext.getCmp('"+_1+"').showMore(); return false;\">"+this.moreLinkText+"</a></div>":""),"</tpl>",{needMoreLink:function(){try{var _3=Ext.getCmp(_1);if(_3.store.getTotalCount()>_3.maxMenuItems){return true;}}
catch(e){}
return false;}});this.store=new Ext.data.JsonStore({url:this.gatewayUrl,baseParams:{method:"getProductSearchRecommendations","filter[manufacturer_id]":this.manufacturerId,"filter[category_id]":this.categoryId,"filter[allow_query_white_space]":(this.allowWhiteSpace?1:0),start:0,limit:this.maxMenuItems},id:"guid",root:"results",fields:["guid","supercession","product_id","product_code","vendor","catalog","name","url"],successProperty:"success",totalProperty:"total",autoLoad:false,listeners:{load:this._checkAfterLoad.createDelegate(this),clear:this._checkAfterLoad.createDelegate(this)}});this.items=[{xtype:"dataview",itemSelector:"li.wse-lnk",overClass:"prodsearch-dyn-menu-item-over wse-over",autoHeight:true,store:this.store,tpl:_2,listeners:{click:this._selectNode.createDelegate(this)}}];if(this.inputField){this.inputField.on("keyup",this._sendForResults,this);this._sendForResults();}
ProdSearch.ListPanel.superclass.initComponent.call(this);},showMore:function(){this.fireEvent("morerequested",this);},_checkAfterLoad:function(){this.fireEvent("dataloaded",this,this.store.getCount());},_sendForResults:function(e){var _5=this.inputField.getValue();_5=this.allowWhiteSpace?_5:Ext.util.Format.trim(this.inputField.getValue());if(_5!=this._currentValue){this._currentValue=_5;if(_5&&(_5.length>=this.minQueryLength)){this.store.load({params:{query:_5}});}else{this.store.removeAll();}}
this.fireEvent("valuechange",this,_5);},_selectNode:function(dv,_7){try{var _8=this.store.getAt(_7);if(this.doRedirect){if(_8.data.url){window.location.href=_8.data.url;}else{if(_8.data.product_id>0){window.location.href=this.detailUrl+"?"+Ext.urlEncode({target:"products",product_id:_8.data.product_id});}else{if(_8.data.supercession){window.location.href=this.detailUrl+"?"+Ext.urlEncode({target:"products",mode:"supercession",product_code:_8.data.product_code,vendor:_8.data.vendor,catalog:_8.data.catalog,supercession:_8.data.supercession});}else{if(_8.data.product_code&&this.whereFoundEnabled=="Y"){window.location.href=this.detailUrl+"?"+Ext.urlEncode({target:"products",mode:"epc_where_found",product_code:_8.data.product_code,vendor:_8.data.vendor,catalog:_8.data.catalog});}else{window.location.href=this.detailUrl+"?"+Ext.urlEncode({target:"products",mode:"search",q:_8.data.product_code});}}}}}else{this.fireEvent("productselect",this,_8.data);}}
catch(e){}}});
var ElemChildHoverMgr=function(){this.defaultChildSelector=".ws-box";this.hoverCls="ws-over";this._childRefs;this.init=function(_1,_2,_3){if(!_1){return;}
if(!_2){_2=this.defaultChildSelector;}
if(_3){this.hoverCls=_3;}
var _4=Ext.DomQuery.select(_1);var _5;var _6=this;this._childRefs=[];for(var i in _4){try{_5=Ext.fly(_4[i]).select(_2);_5.each(function(el){el.dom.onmouseover=function(){_6.showHover(this);};el.dom.onmouseout=function(){_6.hideHover.defer(150,_6,[this]);};_6._childRefs.push(el.dom);});delete(_5);}
catch(e){}}};this.showHover=function(_9){try{this._cleanOutRogues();Ext.get(_9).addClass(this.hoverCls);}
catch(e){}};this.hideHover=function(_a){try{var _b=Ext.get(_a);var _c=false;var x=_b.getLeft();var y=_b.getTop();var w=_b.getWidth()+x;var h=_b.getHeight()+y;if((mouseX<w)&&(mouseX>x)&&(mouseY<h)&&(mouseY>y)){_c=true;}
if(!_c){_b.removeClass(this.hoverCls);}}
catch(e){}};this._cleanOutRogues=function(){if(this._childRefs){for(var i in this._childRefs){try{Ext.fly(this._childRefs[i]).removeClass(this.hoverCls);}
catch(e){}}}};};
var DiscountDisplayWin=Ext.extend(Ext.Window,{layout:"fit",autoHeight:true,autoScroll:true,modal:true,height:400,width:650,resizable:false,shadow:false,closeAction:"close",title:CommonTemplatesLang.DiscountDisplayWindow.title.yourDiscounts,lang:CommonTemplatesLang.DiscountDisplayWindow,displayArea:"",discountIdString:"",includeEmailBtn:false,includeApplyBtn:false,userEmail:"",gatewayUrl:"json.php?target=cart_gateway",emailMethod:"emailDiscounts",applyMethod:"applyDiscount",language:"EN",forceSiteOwnerId:false,initComponent:function(){this.autoLoad="index.php?target=discount_displays&discount_display_area="+this.displayArea+"&discount_id_string="+this.discountIdString+"&ext_action_comp_id="+this.getId();this.buttons=[];if(this.includeApplyBtn){this.buttons.push({text:this.lang.button.apply,cls:"wse-xbtn",handler:this.applyDiscount.createDelegate(this,[0])});}
if(this.includeEmailBtn&&this.userEmail){this.buttons.push({text:this.lang.button.email,cls:"wse-xbtn",handler:this._emailDiscounts.createDelegate(this)});}
this.buttons.push({text:this.lang.button.close,handler:this.close.createDelegate(this),cls:"wse-xbtn wse-xbtn-minor"});this.on("show",this._setWindowProperties,this);DiscountDisplayWin.superclass.initComponent.call(this);},applyDiscount:function(_1){_1=Number(_1);if(!_1){if(this.discountIdString){var a=this.discountIdString.split(",");if(a&&a[0]){_1=a[0];}}}
if(_1){var _3={method:this.applyMethod,discount_id:_1};Ext.Msg.wait(this.lang.mask.applying,null);Ext.Ajax.request({url:this.gatewayUrl,params:_3,timeout:4500,success:this._finishApplyDiscounts.createDelegate(this),failure:this._finishApplyDiscounts.createDelegate(this)});}},_finishApplyDiscounts:function(_4){this._finishEmailDiscounts(_4);},_setWindowProperties:function(){var cp=this.getEl().getCenterXY();this.setPosition(cp[0],25);},_emailDiscounts:function(){var _6={method:this.emailMethod,"data[user_email]":this.userEmail,"data[display_area]":this.displayArea,"data[discount_id_string]":this.discountIdString,"data[force_site_owner_id]":(this.forceSiteOwnerId?1:0),"data[language]":this.language};Ext.Msg.wait(this.lang.mask.emailing,null);Ext.Ajax.request({url:this.gatewayUrl,params:_6,timeout:4500,success:this._finishEmailDiscounts.createDelegate(this),failure:this._finishEmailDiscounts.createDelegate(this)});},_finishEmailDiscounts:function(_7){Ext.Msg.hide();var _8=Ext.util.JSON.decode(_7.responseText);if(_8&&_8["success"]){Ext.Msg.alert(this.lang.title.success,_8["message"]);}else{if(_8&&_8["message"]){Ext.Msg.alert(this.lang.error.title,_8["message"]);}else{Ext.Msg.alert(this.lang.error.title,this.lang.error.message);}}}});
var CheckAvailMgr=function(){this.gateWayUrl="json.php?target=cart_gateway";this.method="getProductAvailable";this.targetId="check-avail-value";this.productId=0;this.conditionId=0;this.interval=0;this.loadingText="Loading...";this.init=function(_1,_2,_3,_4){if(_1){this.targetId=_1;}
if(_3){this.conditionId=_3;}
if(_2){this.productId=_2;}
_4=Number(_4);if(_4){this.interval=_4;}
if(this.targetId&&this.productId){try{Ext.get(this.targetId).update(this.loadingText);}
catch(e){}
this._getAvailable.defer(250,this);}};this._getAvailable=function(){if(this.productId&&this.targetId){try{Ext.Ajax.request({url:this.gateWayUrl,success:this._receiveAvailable.createDelegate(this),failure:this._receiveAvailable.createDelegate(this),params:{product_id:this.productId,condition_id:this.conditionId,method:this.method}});}
catch(e){}}};this._receiveAvailable=function(_5){try{var _6=Ext.util.JSON.decode(_5.responseText);Ext.get(this.targetId).update(_6["available"]);}
catch(e){}
if(this.interval){this._getAvailable.defer(this.interval,this);}};};
var OrderNameWin=Ext.extend(Ext.Window,{width:400,modal:true,shadow:false,autoScroll:true,autoHeight:true,buttonAlign:"center",closeAction:"close",order_id:0,saveAction:"event",cls:"wse-ordername-win",url:"json.php?target=order&area=C",title:"Order Name",lang:{labels:{order_name:"Order Name"},buttons:{set_name:"Set Name"},default_values:{order_name:"Order Name"}},initComponent:function(){this.form=new Ext.form.FormPanel({border:false,bodyBorder:false,autoScroll:false,autoHeight:true,width:"auto",items:[{xtype:"textfield",fieldLabel:this.lang.labels.order_name,anchor:"85%",allowBlank:false,name:"order_name",id:this.getId()+"-order_name",value:this.lang.default_values.order_name}]});this.items=[this.form];this.buttons=[{xtype:"button",text:this.lang.buttons.set_name,handler:this.setOrderName,scope:this}];OrderNameWin.superclass.initComponent.call(this);},initEvents:function(){this.on("show",this.setWindowProperties,this);OrderNameWin.superclass.initEvents.call(this);},setWindowProperties:function(){var _1=Ext.get(this.id).getCenterXY();this.setPosition(_1[0],_1[1]);},setOrderNameValue:function(_2){try{if(_2.length>0){Ext.getCmp(this.getId()+"-order_name").setValue(_2);}}
catch(e){}},setOrderId:function(_3){this.order_id=_3;},setOrderName:function(){var _4=this.form.getForm();var _5=_4.getValues();if(this.saveAction=="save"&&this.order_id){Ext.Ajax.request({url:this.url+"&method=saveOrderName",callback:this.handleSaveOrderName,params:{order_id:this.order_id,order_name:_5.order_name},scope:this});}else{this.fireEvent("orderNameChoice",_5.order_name);this.close();}},handleSaveOrderName:function(_6,_7,_8){var _9=Ext.util.JSON.decode(_8.responseText);if(_9.success){this.fireEvent("orderNameSaved");}
webStore.displayConfirmMessageFromAjax(_6,_7,_8);this.close();}});
var RequireDealerCheckPriceWin=Ext.extend(Ext.Window,{width:400,modal:true,shadow:false,autoScroll:true,autoHeight:true,buttonAlign:"center",closeAction:"hide",user_id:0,dealer_locator_choice:0,url:"json.php?area=A&target=common",lang:{button:{login:"Login",create_account:"Create an Account",select_dealer:"Select a Dealer"},messages:{get_create_options_error:"There was an error with creating an account",error_title:"Error"},display_message:"display message"},initComponent:function(){this.items=[{html:this.lang.display_message,border:false,frame:false}];this.buttons=[];if(this.user_id==0){this.buttons.push({xtype:"button",text:this.lang.button.login,handler:this.loginHandler,scope:this},{xtype:"button",text:this.lang.button.create_account,handler:this.createAccountHandler,scope:this});}
this.buttons.push({xtype:"button",text:this.lang.button.select_dealer,handler:this.selectDealerHandler,scope:this});RequireDealerCheckPriceWin.superclass.initComponent.call(this);},initEvents:function(){this.on("show",this.setWindowProperties,this);RequireDealerCheckPriceWin.superclass.initEvents.call(this);},setWindowProperties:function(){var _1=Ext.get(this.id).getCenterXY();this.setPosition(_1[0],_1[1]);},loginHandler:function(){try{displayLoginPanel(this,current_url);}
catch(e){}},createAccountHandler:function(){Ext.Ajax.request({url:this.url+"&method=getCreateAccountLink",success:this.handleCreateAccountOptionsSuccess,failure:this.handleCreateAccountOptionsFailure,scope:this});},handleCreateAccountOptionsSuccess:function(_2,_3){var _4=Ext.util.JSON.decode(_2.responseText);if(_4.success&&_4.data.javascript_location){window.location=_4.data.javascript_location+"&redirect_url="+current_url;}else{Ext.Msg.alert(this.lang.messages.error_title,this.lang.messages.get_create_options_error);}},handleCreateAccountOptionsFailure:function(_5,_6){Ext.Msg.alert(this.lang.messages.error_title,this.lang.messages.get_create_options_error);},selectDealerHandler:function(){if(this.dealer_locator_choice==1){this.dealerWin1=new dealerlocator.Window({title:DealerLocatorLang.title.window,redirect_url:current_url,forcePopup:DealerLocatorConfig.forcePopup,closeAction:"close"});this.dealerWin1.show();}else{window.location="index.php?target=dealer_locater&passed_redirect_url="+current_url;}}});