/*
 * 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",closeDelayTimer:3,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,reloadAfterAdd:false,quick_add_location:"",trackerPrefix:CommonTemplatesLang.CartMgr.tracker.orderPrefix,cls:"wse-win-add2cart",trackerCode:"addtocart",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","user_id","dealer","price_unformatted","qty_added","catalog_name"],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>","<div style=\"clear: both;\"></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){if(_7){var _9=_7[0];if(_9&&_9.data.add_title){this.setTitle(_9.data.add_title,this.window_title_cls);}else{this.setTitle();}
this._trackAdds();}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(this.quick_add_location=="shopping_cart"){Ext.Ajax.request({url:this.url+"&method=removeAllQuickAddProductList",params:{remove_all:"true"},scope:this,callback:this.handleDeleteRecord});window.location.reload();}
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;if(this.reloadAfterAdd){this.reloadPage.defer(this.getCloseDelayTimer(),this);}else{this.startCloseDelay();}},reloadPage:function(){try{window.location.reload();}
catch(e){window.location.href=window.location.href;}},getCloseDelayTimer:function(){if(this.closeDelayTimer>0){return this.closeDelayTimer*1000;}
return 3000;},stopCloseDelay:function(){if(this.closeTask){this.closeTask.cancel();delete this.closeTask;}},startCloseDelay:function(){this.closeTask=new Ext.util.DelayedTask({});this.closeTask.delay(this.getCloseDelayTimer(),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();if(this.quick_add_location!="shopping_cart"){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);}},handleDeleteRecord:function(_28,_29,_2a){var _2b=Ext.util.JSON.decode(_2a.responseText);if(_2b.success){this.store.load();}},addBulkIdsToCart:function(_2c,_2d){if(_2c){var _2e={method:this.add_bulk_method};var _2f=false;for(var i=0;i<_2c.length;i++){if(_2c[i].data.quantity>0){_2e["product_data["+_2c[i].data.product_id+"][amount]"]=_2c[i].data.quantity;_2f=true;}}
if(_2f){this.stopCloseDelay();if(this.quick_add_location!="shopping_cart"){this.showAndPosition(this,_2d);}
this.store.load({callback:this.makeDisplayUpdates,scope:this,params:_2e});}else{Ext.MessageBox.show({title:CommonTemplatesLang.CartMgr.title.error,msg:CommonTemplatesLang.CartMgr.message.provideOneValidQuantity,buttons:Ext.MessageBox.OK,animEl:this,modal:false});}}},addBulkToCart:function(_31,_32,_33,_34){var _35=Ext.get(_32);if(_35&&_33){var _36;var i=1;var v=null;var _39=false;var _3a={method:this.add_bulk_method};while(_36=Ext.get(_33+i)){v=_36.getValue(true);if(v){_39=true;_3a[_36.dom.name]=v;}
i++;}
if(_39){this.stopCloseDelay();this.showAndPosition(_31,_34);this.store.load({callback:this.makeDisplayUpdates,scope:this,params:_3a});}else{Ext.MessageBox.show({title:CommonTemplatesLang.CartMgr.title.error,msg:CommonTemplatesLang.CartMgr.message.provideOneValidQuantity,buttons:Ext.MessageBox.OK,animEl:_31,modal:false});}}},tryToHide:function(){if(!this.hidden){try{this.hide();}
catch(e){}}},_getTrackerAddText:function(){return CommonTemplatesLang.CartMgr.tracker.addtocart||"addtocart";},_getTrackerFormatText:function(){return CommonTemplatesLang.CartMgr.tracker.addProdFormat||"";},_trackAdds:function(){try{if(GaTracker&&this.trackerCode){var _3b=this.store.getRange();var i,l=_3b.length;var add=this._getTrackerAddText();var s=this._getTrackerFormatText();var _40=0;for(i=0;i<l;i++){GaTracker.trackVpv({code:this.trackerCode,url:[add,(s?String.format(s,_3b[i].data["product"],_3b[i].data["product_code"]):_3b[i].data["product"])]});var _41=new Date().getTime();var _42=Math.floor(Math.random()*1000001);_40=(this.trackerPrefix?this.trackerPrefix:"")+(_3b[i].data["user_id"]?_3b[i].data["user_id"]:0)+"_"+_41+"_"+_42;var _43=(parseInt(_3b[i].data["qty_added"])||1);var _44=parseFloat(_3b[i].data["price_unformatted"]*_43);GaTracker.trackTrans({"orderId":_40,"dealer":_3b[i].data["dealer"],"total":_44,"tax":"0","shipping":"0","city":"","state":"","country":""},[{"orderId":_40,"sku":_3b[i].data["product_code"],"name":_3b[i].data["product"],"category":_3b[i].data["catalog_name"],"price":_3b[i].data["price_unformatted"],"qty":_43}],{"code":this.trackerCode,"trans":true});}}}
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",trackerPrefix:"",total_field:"wishlist_total",cls:"wse-win-add2cart wse-win-add2wishlst",trackerCode:"addtowishlist",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();},_getTrackerAddText:function(){return CommonTemplatesLang.WishList.tracker.addtocart||"addtowishlist";},_getTrackerFormatText:function(){return CommonTemplatesLang.WishList.tracker.addProdFormat||"";}});
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,displayPrice:true,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)&&this.displayPrice){_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;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,_16){var _17="product_details_form_"+_11;if(document[_17]){var _18="product_data\\["+_11+"]\\[product_options]\\[[0-9]+]";var Exp=new RegExp(_18,"");var _1a="product_data["+_11+"][product_options][";var _1b=[];var _1c=[];var _1d,_1e,_1f;_1f=0;for(i=0;i<document[_17].elements.length;i++){if(Exp.exec(document[_17].elements[i].name)!=null){_1d=document[_17].elements[i].name.substring(_1a.length);_1d=_1d.substring(0,_1d.length-1);_1d=parseInt(_1d);_1e=parseInt(document[_17].elements[i].value);_1b[_1f]=_1d;_1c[_1f]=_1e;_1f++;}}}
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),closeDelayTimer:time_delay_before_closing,displayPrice:add_to_cart_display_price,quick_add_location:_16,reloadAfterAdd:reload_after_cart_add});}
addCartMgr.addToCart(btn,_11,_12,_13,_14,_1b,_1c,_15);}
function addBulkProductIdsToCart(_20,_21,_22){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),closeDelayTimer:time_delay_before_closing,displayPrice:add_to_cart_display_price,quick_add_location:_22,reloadAfterAdd:reload_after_cart_add});}
addCartMgr.addBulkIdsToCart(_20,_21);}
function addBulkProductToCart(btn,_24,_25,_26){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),closeDelayTimer:time_delay_before_closing,displayPrice:add_to_cart_display_price,quick_add_location:quick_add_loc,reloadAfterAdd:reload_after_cart_add});}
addCartMgr.addBulkToCart(btn,_24,_25,_26);}
var addWishlistMgr;function addProductToWishlist(btn,_28,_29,_2a,_2b){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,_28,_29,_2a,_2b);}
function getViewportSize(){var _2c=[0,0];try{if(typeof window.innerWidth!="undefined"){_2c=[window.innerWidth,window.innerHeight];}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){_2c=[document.documentElement.clientWidth,document.documentElement.clientHeight];}else{var b=Ext.getBody();_2c=[b.getWidth(),b.getHeight()];}}}
catch(e){}
return _2c;}
var imageLargeViews={};function viewLargeImage(_2e,_2f,_30,_31){_2f=Number(_2f);_30=Number(_30);_31=Number(_31);if(_2f&&_30&&_31){var _32="image_"+_2f;var _33=null;var _34=getViewportSize();var bw=Math.round(_34[0]*0.75);var bh=Math.round(_34[1]*0.75);if((_30>bw)||(_31>bh)){var _37=bw/_30;var _38=bh/_31;if(_37<=_38){_30=bw;_31=Math.round(_37*_31);}else{_31=bh;_30=Math.round(_38*_30);}}
if(!imageLargeViews[_32]){imageLargeViews[_32]=new Ext.Window({layout:"fit",closable:true,shim:true,bodyStyle:"padding:0;",width:_30+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="+_2f+"\" width=\""+_30+"\" height=\""+_31+"\" alt=\"\" />"}]});}
if(_2e){_33=Ext.get(_2e);}
imageLargeViews[_32].show(_33);}}
function showCompareTab(btn,_3a,_3b,_3c,_3d,_3e,num){if(enableCompare(btn,_3a,_3b,_3c,_3d,_3e+num)){showTab(_3e,num,null,btn);initProdCompareApp(_3a,_3b,_3c);}}
function enableCompare(btn,_41,_42,_43,_44,_45){var _46=Ext.get(_41);if(_46&&_43){var _47;var i=1;var _49=new Array();while(_47=Ext.get(_43+i)){if(_47.dom.checked==true){_49.push(_47.getValue(true));}
i++;}
if(_49.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 _4a;i=2;while(i>0){_4a=Ext.get(_44+i--);if(_4a){try{_4a.removeClass(["disabled","ws-disabled"]);}
catch(e){}
if(_49.length>1&&_42){_4a.dom.style.cursor="pointer";_4a.unmask();}else{_4a.dom.style.cursor="default";_4a.mask();}}}
if(_45){var _4b=Ext.get(_45);}
if(_49.length>1&&_42){if(_4b){_4b.removeClass(["disabled","ws-disabled"]);}
return true;}else{if(_4b){_4b.addClass(["disabled","ws-disabled"]);}
return false;}}}
function compareProducts(btn,_4d,_4e,_4f,_50,_51){var _52=Ext.get(_4d);if(_52&&_4f){var _53;var i=1;var _55=new Array();while(_53=Ext.get(_4f+i)){if(_53.dom.checked==true){_55.push(_53.getValue(true));}
i++;}
if(_55.length>1&&_4e){_52.dom.elements[_4e].value=_55.join("|");_52.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(_56){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),displayPrice:add_to_cart_display_price});}
makeOfferWin.show(_56);}
var checkDealerPriceInventoryWin;function checkDealerPriceInventory(_57,_58,_59){if(!checkDealerPriceInventoryWin){checkDealerPriceInventoryWin=new RequireDealerCheckPriceWin({user_id:_58,dealer_locator_choice:_59,lang:CommonTemplatesLang.RequireDealerCheckPriceWinLang});}
checkDealerPriceInventoryWin.show(_57);}
var emailFriendWin;function sendToFriend(_5a){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(_5a);}
var addBookmarkWin;function addBookmark(_5b,_5c,_5d,_5e,_5f,_60){var _61={bookmark_namespace_id:_5b,obj_handle:_5c,obj_id:_5d,obj_value:_5e,label:_5f,formId:_60};if(!addBookmarkWin){addBookmarkWin=new AddBookmarkWin({lang:CommonTemplatesLang.AddBookmarkWin,url:"json.php?area=C&target=bookmarks_gateway",addMethod:"&method=addBookmark"});}
addBookmarkWin.setTitle(CommonTemplatesLang.AddBookmarkWin.label.title);addBookmarkWin.setValues(_61);addBookmarkWin.show();}
function sendWishlistToFriend(_62){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(_62);}
var termsWin;function openTermsWin(_63){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(_63);}
var globalConditionsWin;function openGlobalConditionsWin(_64){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(_64);}
var privacyWin;function openPrivacyWin(_65){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(_65);}
var contactUsWin;function openContactUsWin(_66){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(_66);}
var contactFinanceWin;function openContactFinanceWin(_67){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(_67);}
var myMachineWin;var globalMachineSearchWin;function showMyMachineWin(_68,_69){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(_68,_69);}
function initManufacturerMenu(){try{var _6a=Ext.get("topmenu_manufacturer_holder");var _6b=Ext.get("topmenu_manufacturer_link");var _6c=Ext.get("topmenu_manufacturer_submenu");if(_6a&&_6b&&_6c){_6b.dom.href="#";_6b.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 _6e=Ext.get(btn);_6e.blur();}
catch(e){}}}
var catExpandMgr;function initCategoryExpander(){try{var _6f=Ext.get("sideboxes_categorytree_expand");if(_6f&&!catExpandMgr){catExpandMgr=new CategoryExpandManager();catExpandMgr.init("sideboxes_categorytree_link_","sideboxes_categorytree_expander_",["expanded","ws-expanded"]);}}
catch(e){}}
function generateStdButtonHtml(_70,_71){return"<div class=\"buttons ws-btngrp\">"+"<div class=\"products-stdbutton ws-btn\" >"+"<div class=\"buttonHolder ws-wrap ws-wrap-btn\" onclick=\""+_70+"\"  onmouseover=\"citBttnDown(this); return true;\" onmouseout=\"citBttnUp(this); return true;\">"+"<div class=\"topCap ws-tcap\"></div>"+"<span>"+_71+"</span>"+"<div class=\"bottomCap ws-bcap\"></div>"+"</div>"+"</div>"+"</div>";}
function filterCompareProduct(_72,_73,_74,_75){prodCompareApp.filterProduct(_72,_73,_74,_75);}
function removeCompareProduct(_76,_77,_78,_79){prodCompareApp.removeProduct(_76,_77,_78,_79);}
var prodCompareApp;function initProdCompareApp(_7a,_7b,_7c){try{var _7d=Ext.get("product_comparison_app");if(_7d&&!prodCompareApp){prodCompareApp=new ProductComparisonApplication({renderTo:"product_comparison_app",includeDealerDetails:false,includeDealerPrice:true,displayPrices:add_to_cart_display_price});}
prodCompareApp.showApp(_7a,_7b,_7c,true);}
catch(e){alert(CommonTemplatesLang.General.title.error+": "+e);}}
function setItemImageToolTip(_7e,_7f,_80,_81,_82){if(_7e){_7e.onmouseover=null;if(Number(_7f)&&Number(_80)){var _83={trackMouse:true,target:_7e,showDelay:100,autoWidth:true,autoHeight:true,html:"<img src=\"image.php?object_type="+_82+"&amp;image_id="+_7f+"\" width=\""+_80+"\" height=\""+_81+"\" />",cls:"image-tool-tip"};if(Ext.isIE6){_83["shadow"]=false;_83["width"]=_80+2;_83["autoWidth"]=false;}
var _84=new Ext.ToolTip(_83);try{_84.showAt([mouseX,mouseY]);}
catch(e){}}}}
function autoSizeSelect(_85,_86){if(_85&&Ext.isIE){try{_85=Ext.get(_85);if(_86=="on"){var w=_85.getWidth();var nW=0;var oW=0;var c=_85.first();while(c!=null){oW=c.getTextWidth();if((oW>w)&&(oW>nW)){nW=oW;}
c=c.next();}
if(nW){_85.setStyle("width",nW+10);_85.focus();}}else{_85.setStyle("width","");}}
catch(e){}}}
function submitFormById(id){if(id){try{Ext.get(id).dom.submit();}
catch(e){}}}
function resizeImgIfNeeded(el,_8d){try{var img=Ext.get(el);var _8f=img.up(_8d);var cW=_8f.getWidth();var w=img.getWidth();if(cW&&w>cW){var _92=cW/w;var h=img.getHeight();img.setSize(cW,Math.round(_92*h));}}
catch(e){}}
function chooseDealer(el,_95,_96,_97){try{if(!this.dealerWin){this.dealerWin=new dealerlocator.Window({title:DealerLocatorLang.title.window,redirect_url:DealerLocatorConfig.redirectUrl,forcePopup:DealerLocatorConfig.forcePopup,allow_redirect:_95==undefined?true:_95,replacement_div_id:_96?_96:""});}
if(_97!=undefined){if(_97.length>0){this.dealerWin.setRedirectUrl(_97);}}else{this.dealerWin.setRedirectUrl(DealerLocatorConfig.redirectUrl);}
this.dealerWin.show();}
catch(e){}}
function checkDealerNeededForCheckout(_98){if(require_dealer_to_view_prices_inventory=="Y"&&dealer_user_id=="0"){if(dealer_locator_choice==1){chooseDealer(this,true,"",_98);}else{if(find_a_dealer_link_href.length>0){window.location=find_a_dealer_link_href;}}}else{window.location=_98;}}
function print_r(arr,_9a){var _9b="";if(!_9a){_9a=0;}
var _9c="";for(var j=0;j<_9a+1;j++){_9c+="    ";}
if(typeof(arr)=="object"){for(var _9e in arr){var _9f=arr[_9e];if(typeof(_9f)=="object"){_9b+=_9c+"'"+_9e+"' ...\n";_9b+=print_r(_9f,_9a+1);}else{_9b+=_9c+"'"+_9e+"' => \""+_9f+"\"\n";}}}else{_9b="===>"+arr+"<===("+typeof(arr)+")";}
return _9b;}
function lookUpProductPriceAndInventory(_a0,_a1,_a2,_a3,_a4,_a5,_a6,_a7,_a8,_a9,_aa){if(_a0){Ext.Ajax.request({url:json_index+"?target=products&method=lookUpProductPrice",params:{product_id:_a0},timeout:4500,callback:function(_ab,_ac,_ad){receiveProductLookupPriceAndInventory(_ab,_ac,_ad,_a0,_a1,_a2,_a3,_a4,_a5,_a6,_a7,_a8,_a9,_aa);}});}}
function receiveProductLookupPriceAndInventory(_ae,_af,_b0,_b1,_b2,_b3,_b4,_b5,_b6,_b7,_b8,_b9,_ba,_bb){var _bc,_bd,_be,_el;try{_b0=Ext.util.JSON.decode(_b0.responseText);}
catch(e){_b0={};}
_bc=(_b0&&_b0.price)?_b0.price:_b2;if(_bc){Ext.Ajax.request({url:json_index+"?target=products&method=lookUpProductInventory",params:{product_id:_b1},timeout:4500,callback:function(_c0,_c1,_c2){try{_c2=Ext.util.JSON.decode(_c2.responseText);}
catch(e){_c2={};}
_bd=(_c2&&_c2.success)?_c2.inventory:_b3;_b4=(_b4=="Y")?true:false;if((_bd&&_bd>0)||_b4){try{_be=Ext.get(_b5);_be.update(_bc);if(_b0.original_price&&_b6){_be=Ext.get(_b6);_be.update(_b0.original_price);_el=Ext.get(_b7);try{_el.child("li.ws-price-ret").setDisplayed(true);}
catch(e){}}
if(_b9){_el=Ext.get(_b9);_el.setDisplayed(true);try{_el.child("li.ws-trakng-amt").setDisplayed(true);_el.child("div.ws-btngrp-ordr-add").setDisplayed(true);}
catch(e){}}}
catch(e){hideLivePriceWrapper(_b7,_b8);}}else{hideLivePriceWrapper(_b7,_bb);if(_b9&&!_b4){_el=Ext.get(_b9);_el.setDisplayed(false);try{_el.child("li.ws-trakng-amt").setDisplayed(false);_el.child("div.ws-btngrp-ordr-add").setDisplayed(false);}
catch(e){}}}}});}else{hideLivePriceWrapper(_b7,_b8);}}
function lookUpProductPrice(_c3,_c4,_c5,_c6,_c7,_c8,_c9){if(_c3){Ext.Ajax.request({url:json_index+"?target=products&method=lookUpProductPrice",params:{product_id:_c3},timeout:6500,success:function(_ca,_cb){receiveProductLookupPrice(_ca,_cb,_c4,_c5,_c6,_c7,_c8,_c9);},failure:function(_cc,_cd){hideLivePriceWrapper(_c6,_c7);}});}}
function receiveProductLookupPrice(_ce,_cf,_d0,_d1,_d2,_d3,_d4,_d5){if(_ce&&_ce.responseText){_ce=Ext.util.JSON.decode(_ce.responseText);}else{_ce={success:false};}
if(_ce.success){var _d6;var _el;if(_ce.price){try{_d6=Ext.get(_d0);_d6.update(_ce.price);if(_ce.original_price&&_d1){_d6=Ext.get(_d1);_d6.update(_ce.original_price);_el=Ext.get(_d2);try{_el.child("li.ws-price-ret").setDisplayed(true);}
catch(e){}}
if(_d4){_el=Ext.get(_d4);_el.setDisplayed(true);try{_el.child("li.ws-trakng-amt").setDisplayed(true);_el.child("div.ws-btngrp-ordr-add").setDisplayed(true);}
catch(e){}}}
catch(e){hideLivePriceWrapper(_d2,_d3);}}else{hideLivePriceWrapper(_d2,_d3);if(!_d5&&_d4){_el=Ext.get(_d4);_el.setDisplayed(false);try{_el.child("li.ws-trakng-amt").setDisplayed(false);_el.child("div.ws-btngrp-ordr-add").setDisplayed(false);}
catch(e){}}}}else{hideLivePriceWrapper(_d2,_d3);}}
function hideLivePriceWrapper(_d8,_d9){try{Ext.get(_d8).setDisplayed(false);Ext.get(_d9).setDisplayed(true);}
catch(e){}}
function lookUpProductInventory(_da,_db,_dc,_dd,_de,_df,_e0,_e1){if(_da){Ext.Ajax.request({url:json_index+"?target=products&method=lookUpProductInventory",params:{product_id:_da},timeout:4500,success:function(_e2,_e3){receiveProductLookupInventory(_e2,_e3,_db,_dc,_dd,_de,_df,_e0,_e1);},failure:function(_e4,_e5){hideLiveInventoryWrapper(_de,_df);}});}}
function receiveProductLookupInventory(_e6,_e7,_e8,_e9,_ea,_eb,_ec,_ed,_ee){_e6=Ext.util.JSON.decode(_e6.responseText);if(_e6.success){try{var _ef;if(_e6.inventory&&_e6.inventory>0){try{_ef=Ext.get(_e8);_ef.update(_e6.inventory);Ext.get(_e9).setDisplayed(true);if(_ee&&_ed){_el=Ext.get(_ed);_el.setDisplayed(true);try{_el.child("li.ws-trakng-amt").setDisplayed(true);_el.child("div.ws-btngrp-ordr-add").setDisplayed(true);}
catch(e){}}}
catch(e){hideLiveInventoryWrapper(_eb,_ec);}}else{try{Ext.get(_ea).setDisplayed(true);}
catch(e){hideLiveInventoryWrapper(_eb,_ec);}}}
catch(e){hideLiveInventoryWrapper(_eb,_ec);}}else{hideLiveInventoryWrapper(_eb,_ec);}}
function hideLiveInventoryWrapper(_f0,_f1){try{Ext.get(_f0).setDisplayed(false);Ext.get(_f1).setDisplayed(true);}
catch(e){}}
function validate_simple_search_form(_f2){with(_f2){if(q.value==null||q.value.length<3){alert(invalid_search_length);q.focus();return false;}
return true;}}
function addDefaultTextToTextField(_f3,_f4,_f5){try{var _f6=Ext.get(_f3);var _f7=Ext.get(_f6.dom.form);_f6.dom.readOnly=true;if(_f6.dom.value==""){_f6.dom.value=_f4;_f6.addClass(_f5);}
_f6.on("focus",function(){if(this.dom.value==_f4&&this.dom.className.indexOf(_f5)!=-1){this.dom.value="";this.removeClass(_f5);}});_f6.on("blur",function(){if(this.dom.value==""){this.dom.value=_f4;this.addClass(_f5);}});_f7.on("submit",function(_f8){if(_f6.dom.value==_f4&&_f6.dom.className.indexOf(_f5)!=-1){_f6.dom.value="";}});_f6.dom.readOnly=false;return true;}
catch(e){return false;}}
function submitConditionValue(_f9,_fa,_fb,_fc,_fd,_fe){if(_fe>0&&_fd>0){var _ff=String.format("{0}?{1}=products&product_id={2}&{3}_id={4}&manufacturer_id={5}",_f9,_fa,_fb,_fc,_fd,_fe);window.location=_ff;}else{if(_fd>0){var _ff=String.format("{0}?{1}=products&product_id={2}&{3}_id={4}",_f9,_fa,_fb,_fc,_fd);window.location=_ff;}else{var _ff=String.format("{0}?{1}=products&product_id={2}",_f9,_fa,_fb);window.location=_ff;}}}
webStore.displayConfirmMessageFromForm=function(form,_101){if(_101&&_101.result&&_101.result.confirm_message){if(_101.result.confirm_title){webStore.displayMessage(_101.result.confirm_message,_101.result.confirm_title,_101.result.confirm_type,_101.result.redirect);}else{webStore.displayMessage(_101.result.confirm_message,null,_101.result.confirm_type,_101.result.redirect);}}else{if(_101&&_101.result){webStore.displayMessage();}}};webStore.displayConfirmMessageFromAjax=function(_102,_103,_104){var _105=Ext.util.JSON.decode(_104.responseText);if(_104&&_104.responseText){if(_105.skip_message){return;}else{if(_105.confirm_title){webStore.displayMessage(_105.confirm_message,_105.confirm_title,_105.confirm_type,_105.redirect);}else{if(_105.confirm_type){webStore.displayMessage(_105.confirm_message,null,_105.confirm_type,_105.redirect);}else{webStore.displayMessage(_105.confirm_message,null,null,_105.redirect);}}}}else{if(!_103&&_104.status!=200&&!_104.responseText){webStore.displayMessage("The connection request timed out.",null,"error");}else{webStore.displayMessage();}}};webStore.displayMessage=function(_106,_107,type,_109){var _10a=Ext.Msg.INFO;switch(type){case"error":_10a=Ext.Msg.ERROR;if(!_107){_107="Error";}
break;case"warning":_10a=Ext.Msg.WARNING;break;case"question":_10a=Ext.Msg.QUESTION;break;default:break;}
if(!_107){_107="Webstore";}
if(_106){Ext.Msg.show({title:_107,buttons:Ext.Msg.OK,fn:webStore.messageButtonClickHandler.createDelegate(this,[_109],0),msg:_106,icon:_10a});}};webStore.messageButtonClickHandler=function(_10b){if(_10b){_10b=Ext.util.Format.htmlDecode(_10b);if(location.href==_10b){location.reload();}else{if(_10b.substr(0,1)=="#"){location.href=_10b;location.reload();}else{location.href=_10b;}}}};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){}}});
var AddBookmarkWin=Ext.extend(Ext.Window,{autoScroll:false,modal:true,autoHeight:true,widthSimple:550,fieldWidth:300,positionFieldWidth:100,labelWidth:100,textAreaHeight:150,closeAction:"hide",closable:true,buttonAlign:"center",flagColorBtmClass:"flags-text-color-panel",lang:{},bookmarkInfo:null,addMethod:" ",group:" ",initComponent:function(){this.items=[{xtype:"form",bodyCssClass:"flags-window-simple",width:this.widthSimple-15,labelWidth:this.labelWidth,items:[{xtype:"hidden",id:this.id+"-bookmark_namespace_id",name:"data[bookmark_namespace_id]"},{xtype:"textfield",id:this.id+"-name",name:"data[name]",fieldLabel:this.lang.label.name_label,width:this.fieldWidth,allowBlank:false}]}];this.buttons=[{xtype:"button",text:this.lang.button.save,handler:this.saveForm,scope:this},{xtype:"button",text:this.lang.button.cancel,handler:this.hideWindow,scope:this}];AddBookmarkWin.superclass.initComponent.call(this);},initEvents:function(){this.on("show",this.checkForm,this);AddBookmarkWin.superclass.initEvents.call(this);},checkForm:function(){this.setWindowProperties();this.getComponent(0).getForm().clearInvalid();},clearValues:function(){try{Ext.getCmp(this.id+"-name").setValue();}
catch(e){}},setValues:function(_1){if(_1){this._genBookmarkItems(_1);}
if(this.bookmarkInfo){try{Ext.getCmp(this.id+"-bookmark_namespace_id").setValue(this.bookmarkInfo.bookmark_namespace_id);switch(this.bookmarkInfo.obj_handle){case"query":Ext.getCmp(this.id+"-name").setValue(String.format(this.lang.label.bkmrk_search_format,this.bookmarkInfo.obj_value));break;case"product_id":Ext.getCmp(this.id+"-name").setValue(String.format(this.lang.label.bkmrk_product_format,this.bookmarkInfo.label));break;case"category_id":Ext.getCmp(this.id+"-name").setValue(String.format(this.lang.label.bkmrk_category_format,this.bookmarkInfo.label));break;}}
catch(e){}}},setWindowProperties:function(){this.setWidth(this.widthSimple);var _2=Ext.get(this.id).getCenterXY();this.setPosition(_2[0],_2[1]);},saveForm:function(){var _3=this.getComponent(0).getForm();if(_3.isValid()){_3.waitMsgTarget=true;_3.submit({url:this.url+this.addMethod,discardUrl:false,success:this.formSuccessHandler,failure:webStore.displayConfirmMessageFromForm,scope:this,waitMsg:this.lang.load,timeout:45,scripts:false,params:this._genBookmarkItemParams()});}else{this.requiredFieldsNotFilled();}},formSuccessHandler:function(_4,_5){Ext.Msg.alert("Bookmarks","Bookmark Saved.");this.hideWindow();},hideWindow:function(){this.hide();},requiredFieldsNotFilled:function(){webStore.displayRequiredFieldsNotFilledMessage();},_genBookmarkItems:function(_6){if(Ext.type(_6)=="object"){this.bookmarkInfo=Ext.apply({"items":[]},_6);if(this.bookmarkInfo["formId"]){try{var _7=new Ext.form.BasicForm(this.bookmarkInfo["formId"]);var i,_9=_7.getValues();for(i in _9){this.bookmarkInfo["items"].push({"obj_handle":i,"obj_id":0,"obj_value":_9[i],"label":"","is_primary":"N"});}}
catch(e){this.bookmarkInfo["items"]=[];}}
if(this.bookmarkInfo["obj_handle"]){this.bookmarkInfo["items"].push({"obj_handle":this.bookmarkInfo["obj_handle"],"obj_id":this.bookmarkInfo["obj_id"],"obj_value":this.bookmarkInfo["obj_value"],"label":this.bookmarkInfo["label"],"is_primary":"Y"});}}},_genBookmarkItemParams:function(){var o={};if(this.bookmarkInfo&&this.bookmarkInfo["items"]){var i,bk,l=this.bookmarkInfo["items"].length;for(i=0;i<l;i++){bk=this.bookmarkInfo["items"][i];o["data[bookmark_objects]["+i+"][obj_handle]"]=bk["obj_handle"];o["data[bookmark_objects]["+i+"][obj_id]"]=bk["obj_id"];o["data[bookmark_objects]["+i+"][obj_value]"]=bk["obj_value"];o["data[bookmark_objects]["+i+"][label]"]=bk["label"];o["data[bookmark_objects]["+i+"][is_primary]"]=bk["is_primary"];}}
return o;}});
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",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});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,displayPrices:true,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>"+"<tpl if=\""+this.displayPrices+"\">"+"<p class=\"price wse-price\"><span class=\"label wse-lbl\">"+this.lang.label.price+"</span>&nbsp;<span class=\"wse-val\">{price}</span></p>"+"</tpl>"+"<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{var _b=this._inputEl.up("form");this._hiddenEl=this._inputEl.insertSibling({tag:"input",type:"hidden",name:"search_by"},"before",true);this._hiddenEl.value="sku";}
catch(e){}
try{this._inputEl.up("form").dom.submit();}
catch(e){}},_createHiddenField:function(){try{var _c=this._inputEl.up("form");var _d=this._inputEl.dom.name?this._inputEl.dom.name:"q";var _e=this._inputEl.getValue();if(!_e){_e="";}
var id=Ext.id()+"-q";this._hiddenEl=this._inputEl.insertSibling({tag:"input",type:"hidden",name:_d,id:id},"before",true);this._hiddenEl.value=_e;this._inputEl.dom.name="new_q";}
catch(e){}},_fillValue:function(_10,_11){if(this._updateCompId){try{Ext.getCmp(this._updateCompId).setValue(_11.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);}
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}],keys:[{key:[10,13],fn:this.setOrderName,scope:this}]});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;}}});
