var cds=cds||{includes:{},accessManager2:{},textLabels:{"global.unit_english_label":"English","global.unit_metric_label":"Metric","global.ok_button_label":"OK","global.cancel_button_label":"Cancel","attribute_search.advanced_search_button_text":"Advanced Search","attribute_search.advanced_search_dialog_title":"Advanced Search","attribute_search.advanced_search_header_text":"Select all Attributes which you would like to display "
+"within the attributes search table.","attribute_search.record_count_select_label":"Number of records to display","attribute_search.attribute_select_default_text":"Select","attribute_search.attribute_select_none_text":"None","attribute_search.compare_button_text":"Compare","attribute_search.compare_product_limit_text":"Select up to %count% products to compare.","attribute_search.description_column_label":"Description","attribute_search.error_missing_parent_element":"Missing parent element.","attribute_search.error_no_products":"There are no products classified within this category","attribute_search.error_no_filtered_products":"There are no products that match your criteria.&nbsp;&nbsp;<a href=\"javascript:cds.attributeSearchTable.handleResetAll()\">Click here to reset your search</a>.","attribute_search.error_server_response":"Unable to load attribute search table.","attribute_search.error_too_many_compare_products":"You may compare up to %count% products.","attribute_search.error_invalid_min_range_value":"Please enter a number.","attribute_search.error_invalid_max_range_value":"Please enter a number.","attribute_search.image_column_label":"Image","attribute_search.product_column_label":"Product Number","attribute_search.range_max_input_box_text":"Max","attribute_search.range_min_input_box_text":"Min","attribute_search.record_count_text":"Showing records %start-row% to %end-row% of %row-count%","attribute_search.record_page_next_text":"Next","attribute_search.record_page_previous_text":"Previous","attribute_search.record_page_text":"Page: ","attribute_search.reset_button_text":"Reset","attribute_search.reset_link_text":"Reset","attribute_search.sort_link_text":"Sort","product_compare.error_missing_parent_element":"Missing parent element.","product_compare.error_not_enough_products":"Please select two or more products to compare.","product_compare.error_no_products_given":"No products were selected to compare.","product_compare.error_server_response":"Unable to load product compare table.","product_compare.header_text":"Comparing %count% Products.","product_home.download_select_default_text":"Choose a CAD format","product_home.error_no_download_format_selected":"Please select a CAD format to download.","product_home.cad_generating_dialog_title":"Generating CAD Model","product_home.cad_generating_dialog_text":"The model you requested is being generated. This could take up to a minute, please wait...","product_home.cad_complete_dialog_title":"Generation Complete!","product_home.cad_complete_dialog_text":"The model you requested has been successfully generated.","product_home.cad_complete_link_drag_drop":"Drag & Drop into Your CAD System","product_home.cad_complete_link":"Download CAD Model","product_home.cad_complete_link_view":"Click Here to View Model","product_home.cad_error_title":"Error!","product_home.cad_error_text":"There was an error generating the model you have requested.&nbsp;&nbsp;Please wait a few minutes and try again.","product_home.cad_pdf_adobe_help_label":"Adobe 3D PDF help","product_home.cad_attachment_complete_dialog_text":"The document you requested has been successfully generated.","product_home.cad_attachment_complete_dialog_title":"Generation Complete!","product_home.cad_attachment_complete_link":"Download Document","product_home.cad_attachment_error_text":"There was an error generating the document you have requested.&nbsp;&nbsp;Please wait a few minutes and try again.","product_home.cad_attachment_error_title":"Error!","product_home.cad_attachment_generating_dialog_text":"The document you requested is being generated. This could take up to a minute, please wait...","product_home.cad_attachment_generating_dialog_title":"Generating Document","product_home.cart_button_text":"Add to Cart","product_home.download_button_text":"Download CAD","product_home.view_3d_button_text":"View 3D Model","product_home.view_2d_button_text":"View 2D Model","cart.submit_button_text":"Submit RFQ","cart.submit_dialog_title":"Submitting RFQ","cart.submit_dialog_text":"Your request for quote is being submitted.&nbsp;&nbsp;Please wait...","cart.submit_dialog_success_title":"RFQ Submitted","cart.submit_dialog_success_text":"Thank you.&nbsp;&nbsp;Your request has been submitted.","cart.submit_dialog_error_text":"There was an error submitting your RFQ.&nbsp;&nbsp;Please wait a few minutes and try again.","login.dialog_title":"Sign In","login.header_text":"Returning users please sign in.","login.email_label":"Email Address:","login.password_label":"Password:","login.submit_button_text":"Sign In","login.forgot_password_link_text":"Forgot your password?","login.new_user_header_text":"Are you a new user?","login.new_user_link_text":"Click here to create a new sign in profile","login.error_account_does_not_exist":"No account exists for this email address.","confirm.dialog_title":"Add to Cart","confirm.content_text":" product(s) have been added to the cart.","registration.agree_service_text":"You must agree to these terms to use this service.","registration.confirm_read_terms":"I have read and agree to the ","registration.header_text":"New user? Please create your sign in profile.","registration.required_notification_text":"An * indicates a required field.","registration.contact_details_label":"Contact Details","registration.email_label":"Email Address:","registration.first_name_label":"First Name:","registration.last_name_label":"Last Name:","registration.company_label":"Company:","registration.contact_ok_label":"Subscribe to newsletter and/or product update emails","registration.address_details_label":"Address Details","registration.address_1_label":"Address 1:","registration.address_2_label":"Address 2:","registration.address_3_label":"Address 3:","registration.city_label":"City:","registration.state_label":"State/Province:","registration.state_default_selection_text":"Please select a state/province","registration.country_label":"Country:","registration.country_default_selection_text":"Please select a country","registration.postal_code_label":"Postal Code:","registration.phone_label":"Phone:","registration.fax_label":"Fax:","registration.salesperson_label":"Salesperson:","registration.submit_button_text":"Create Account","registration.error_required_field":"Please complete all required fields before submitting.","registration.error_invalid_email":"Please enter a valid email address.","registration.error_account_exists":"An account already exists for this email address.","registration.error_unknown":"There was an error creating this account.  Please try again in a few "
+"minutes.","registration.agree_tos_text_prefix":"Check here to indicate that you have read and agree to the ","registration.agree_tos_text_anchor":"terms of using this service","registration.agree_tos_text_suffix":".","registration.tos_link":"https://www.cdsvisual.com/privacy-policy/","registration.contact_me_text":"I want to be the first to know about the latest products, exclusives and offers. Feel free to contact me.","registration.gdpr_disclaimer_text":"We do not sell your personal information","keyword_search_results.error_no_results":"No results found.","keyword_search_results.product_column_label":"Product","keyword_search_results.category_column_label":"Category","keyword_search_results.description_column_label":"Description","keyword_search_results.product_column_label":"Product Number","keyword_search_results.category_column_label":"Category","keyword_search_results.description_column_label":"Product","keyword_search_results.long_description_column_label":"Description","keyword_search_results.attribute_column_label":"Attribute","keyword_search_results.value_column_label":"Value","search.table_column_label_product":"Product","search.min_max_separator":"to","search.show_more_label":"Show 15 More","search.sort_default_label":"Default","search.sort_low_high_label":"Low to High","search.sort_high_low_label":"High to Low","search.sort_section_label":"Sort by:","search.compare_button_label":"Compare","search.add_to_cart_button_label":"Add to Cart","search.category_browse_label":"Category Browse","search.narrow_results_label":"Narrow Results","search.show_category_hierarchy_label":"Show Category Hierarchy","search.hide_category_hierarchy_label":"Hide Category Hierarchy","search.start_end_total_products_label":"%start%-%end% of %total% Products","search.show_more_categories_label":"+ show more","search.show_less_categories_label":"- show less","search.clear_label":"Clear","search.clear_all_label":"Clear all","search.power_grid_link_label":"Power Grid Search","search.loading_products_text":"Loading products..."},domainId:null,dataDomainId:null,templateDomainId:null,user:null,isInputBlocked:false,cdsu:null,fname:null,lname:null,company:null,address1:null,address2:null,address3:null,city:null,country:null,state:null,zip:null,phone:null,fax:null,agreetos:null,unitSystem:"metric",defaultRegistrationCountry:"United States",useCDSdialogs:false,dialogOverlay:null,productQueue:null,cadViewerBaseURL:"https://www.product-config.net/cadviewer/",setDomain:function(dataDomainId,templateDomainId){cds.dataDomainId=dataDomainId;cds.templateDomainId=(templateDomainId)?templateDomainId:dataDomainId;},getDataDomain:function(){if(!cds.dataDomainId){cds.dataDomainId=cds.domainId;}
if(!cds.templateDomainId){cds.templateDomainId=cds.dataDomainId;}
return cds.dataDomainId;},getTemplateDomain:function(){if(!cds.dataDomainId){cds.dataDomainId=cds.domainId;}
if(!cds.templateDomainId){cds.templateDomainId=cds.dataDomainId;}
return cds.templateDomainId;},getDataDomainURI:function(url){var u=url;if(cds.getTemplateDomain()!==cds.getDataDomain()){if(u&&u.indexOf("?")===-1){u+="?dd="+cds.getDataDomain();}else{u+="&dd="+cds.getDataDomain();}}
if(cds.cdsu){if(u&&u.indexOf("?")===-1){u+="?cdsu="+cds.cdsu;}else{u+="&cdsu="+cds.cdsu;}}
return u;},domainProperties:{},remoteServerBaseURL:"https://www.product-config.net/catalog3",setRemoteServerBaseURL:function(url){cds.remoteServerBaseURL=url;if(cds.remoteServerBaseURL&&cds.remoteServerBaseURL.length){if(cds.remoteServerBaseURL[cds.remoteServerBaseURL.length-1]==="/"){cds.remoteServerBaseURL=cds.remoteServerBaseURL.substring(0,cds.remoteServerBaseURL.length-1);}
if(cds.remoteServerBaseURL.indexOf("/service")==cds.remoteServerBaseURL.length-8){cds.remoteServerBaseURL=cds.remoteServerBaseURL.substring(0,cds.remoteServerBaseURL.length-8);}}},bin2octet:function(s){let buf=new ArrayBuffer(s.length);let view=new Uint8Array(buf);for(let i=0;i<s.length;i++){view[i]=s.charCodeAt(i)&0xFF;}
return buf;},currentProduct:null,loadCurrentProduct:function(id){jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:{"d":cds.getDataDomain(),"o":"product","id":id},context:this,success:function(data){if(data.error){alert(cds.getTextLabel("product_compare.error_server_response"));}else{cds.currentProduct=data;}}});},getCatalogURL:function(baseURL,parameters,values){var i,count,url=baseURL;if(parameters&&values){count=(parameters.length>=values.length)?parameters.length:values.length;for(i=0;i<count;i++){url=url.replace(parameters[i],values[i]);}}
url=cds.getDataDomainURI(url);return url;},isIElt9:function(){var v=3,div=document.createElement("div"),all=div.getElementsByTagName("i");while(div.innerHTML="<!--[if gt IE "+(++v)+"]><i></i><![endif]-->",all[0]);return(v>4&&v<9)?true:false;},loadRemoteScript:function(source,callback){var script=document.createElement("script"),parent=document.getElementsByTagName("script")[0];script.src=source;script.type="application/javascript";if(cds.isIElt9()){script.type="text/javascript";}
script.async=true;script.onerror=function(){script.onload=script.onreadystatechange=null;script=undefined;};parent.parentNode.insertBefore(script,parent);script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){script.onload=script.onreadystatechange=null;script=undefined;if(!isAbort){if(callback){if(cds.isIElt9()){setTimeout(function(){callback();},100);}else{callback();}}}}};},loadRemoteJSONP:function(url,args,callback,callbackOnError,callbackOnTimeout,timeout,excludeUser){var i,qs,to,tof,u,source,callbackName,script=document.createElement("script"),parent=document.getElementsByTagName("script")[0];source=url.replace("callback=?","");qs="";i=source.indexOf("?");if(i!==-1){qs=source.substring(i+1);source=source.substring(0,i);}
for(i in args){if(args.hasOwnProperty(i)&&args[i]!==null){if(qs.length){qs+="&";}
qs+=encodeURIComponent(i)+"="+encodeURIComponent(args[i]);}}
if(!cds._callback_count){cds._callback_count=0;}
cds._callback_count++;callbackName="_cds_callback_"+cds._callback_count;if(qs.length){source+="?"+qs+"&callback="+callbackName;}else{source+="?callback="+callbackName;}
if(!excludeUser){u=cds.getUser();if(u){source+="&cdsu="+encodeURIComponent(u);}}
source+="&_="+Math.floor(Math.random()*1000000000000);script.src=source;script.type="application/javascript";if(cds.isIElt9()){script.type="text/javascript";script.cds_callback_name=callbackName;}
script.async=true;script.onerror=function(){if(callbackOnError){callbackOnError();}
if(tof){window.clearTimeout(tof);}
script.parentNode.removeChild(script);window[callbackName]=undefined;try{delete window[callbackName];}catch(ignored){}
script=undefined;};parent.parentNode.insertBefore(script,parent);if(callbackOnTimeout||callbackOnError){to=timeout||20000;tof=window.setTimeout(function(){if(callbackOnTimeout){callbackOnTimeout();}else{callbackOnError();}
script.parentNode.removeChild(script);window[callbackName]=function(){};script=undefined;},to);}
window[callbackName]=function(data){if(callback){callback(data);}
if(tof){window.clearTimeout(tof);}
script.parentNode.removeChild(script);window[callbackName]=undefined;try{delete window[callbackName];}catch(ignored){}
script=undefined;};},loadXHR:function(method,url,args,callback,callbackOnError,contentType,preventResponseParsing){let data=null;if(args){if(contentType==="application/json"){data=JSON.stringify(args);}else{for(let a in args){if(args.hasOwnProperty(a)){if(data===null){data="";}else{data+="&";}
data+=encodeURIComponent(a)+"="+encodeURIComponent(args[a]);}}}}
xhttp=new XMLHttpRequest();xhttp.onreadystatechange=function(){if(this.readyState===4){if(this.status===200){if(callback){if(preventResponseParsing){callback(xhttp.responseText);}else{callback(JSON.parse(xhttp.responseText));}}}else{if(callbackOnError){callbackOnError(this);}}}};if(method.toUpperCase()==="GET"&&data!==null){xhttp.open(method,url+(url.indexOf("?")===-1?"?":"&")+data,true);}else{xhttp.open(method,url,true);}
if(contentType){xhttp.setRequestHeader("Content-Type",contentType);}else if(method.toUpperCase()!=="GET"&&data!==null){xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}
xhttp.send(data);},isWebGLAvailable:function(){var i,e,canvas,context,names;if(!window.WebGLRenderingContext){return false;}
canvas=document.createElement("canvas");if(!canvas){return false;}
names=["webgl","experimental-webgl","webkit-3d","moz-webgl"];for(i=0;i<names.length;++i){try{context=canvas.getContext(names[i]);}catch(e){}
if(context){return true;}}
return false;},printObject:function(o){var i,s="";for(i in o){if(o.hasOwnProperty(i)&&typeof o[i]!=="function"){if(s.length){s+="\n";}
s+=i+": "+o[i];}}
return s;},getTextLabel:function(key){if(cds.CADRequester.resultCADFormat===cds.CADRequester.attachmentFormat&&key.indexOf("product_home.cad_")==0){if(key==="product_home.cad_complete_dialog_text"){key="product_home.cad_attachment_complete_dialog_text";}else if(key==="product_home.cad_complete_dialog_title"){key="product_home.cad_attachment_complete_dialog_title";}else if(key==="product_home.cad_complete_link"){key="product_home.cad_attachment_complete_link";}else if(key==="product_home.cad_error_text"){key="product_home.cad_attachment_error_text";}else if(key==="product_home.cad_error_title"){key="product_home.cad_attachment_error_title";}else if(key==="product_home.cad_generating_dialog_text"){key="product_home.cad_attachment_generating_dialog_text";}else if(key==="product_home.cad_generating_dialog_title"){key="product_home.cad_attachment_generating_dialog_title";}}
x=cds.textLabels[key];return cds.textLabels[key];},getQueryStringParameter:function(name){var s,reg=new RegExp("[\\?&]"+name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]")+"=([^&#]*)");s=reg.exec(window.location.search);if(s){return decodeURIComponent(s[1].replace(/\+/g," "));}else{s=reg.exec(window.location);if(s){return decodeURIComponent(s[1].replace(/\+/g," "));}}
return"";},sendPost:function(action,data,target,method){var i,inp,f=document.createElement("form");f.method=method||"post";f.action=action;if(target!=null)f.target=target;for(i in data){if(data.hasOwnProperty(i)){inp=document.createElement("input");f.appendChild(inp);inp.setAttribute("name",i);inp.setAttribute("value",data[i]);}}
document.body.appendChild(f);f.submit();document.body.removeChild(f);},setCookie:function(key,value,expireDays){var d,s;s=encodeURIComponent(key)+"="+encodeURIComponent(value);if(expireDays){d=new Date();d.setDate(d.getDate()+expireDays);s+="; expires="+d.toUTCString();}
s+="; path=/; SameSite=None; Secure";cds.clearObsoleteCookies(key);document.cookie=s;},deleteCookie:function(key){document.cookie=encodeURIComponent(key)
+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";},clearObsoleteCookies:function(key){if(location.href.indexOf("catalog3")!==-1){document.cookie=encodeURIComponent(key)
+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT";document.cookie=encodeURIComponent(key)
+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT"
+"; path=/catalog3/";}},getCookie:function(key){var i,j,k=encodeURIComponent(key);cds.clearObsoleteCookies(key);if(document.cookie.length>0){i=document.cookie.indexOf(k+"=");if(i!==-1){i+=k.length+1;j=document.cookie.indexOf(";",i);if(j===-1){j=document.cookie.length;}
return decodeURIComponent(document.cookie.substring(i,j));}}
return null;},setUser:function(user){this.user=user;},getUser:function(){if(this.user){return this.user;}else{let user=cds.getCookie("cds."+cds.getTemplateDomain()+".user");if(user){return user;}}
return null;},emailPage:function(){s="mailto:?subject="+encodeURIComponent(document.title)+"&body="
+encodeURIComponent(document.title+" at: "+location.href);location.href=s;},addBookmark:function(atitle,aurl){var e,title=atitle,url=aurl;if(!url){url=location.href;}
if(!title){title=document.title;}
if(window.sidebar&&window.sidebar.addPanel){window.sidebar.addPanel(title,url,"");}else if(window.external&&window.external.AddFavorite){window.external.AddFavorite(url,title);}else if(window.opera&&window.print){e=document.createElement('a');e.setAttribute('href',url);e.setAttribute('title',title);e.setAttribute('rel','sidebar');e.click();}else{alert("This browser does not support automatic bookmarking.  Please bookmark this page manually.");}},getViewportWidth:function(){var docElement=(document.compatMode==="CSS1Compat")?document.documentElement:document.body;return(window["innerWidth"]>docElement["clientWidth"])?window["innerWidth"]:docElement["clientWidth"];},getViewportHeight:function(){var docElement=(document.compatMode==="CSS1Compat")?document.documentElement:document.body;return(window["innerHeight"]>docElement["clientHeight"])?window["innerHeight"]:docElement["clientHeight"];},addUnitSystemToggle:function(elementId,currentUnitSystem){var ee,e=document.getElementById(elementId),u=currentUnitSystem;if(!u){u=this.getCookie("cds.catalog.unit");if(!u){u="english";}}
if(e){ee=document.createElement("input");ee.setAttribute("type","radio");ee.setAttribute("name","cds-unit-toggle");ee.setAttribute("id","cds-unit-toggle-english");ee.setAttribute("value","english");if(u==="english"){ee.setAttribute("checked","checked");}
e.appendChild(ee);ee=document.createElement("label");ee.setAttribute("for","cds-unit-toggle-english");ee.appendChild(document.createTextNode(cds.getTextLabel("global.unit_english_label")));e.appendChild(ee);ee=document.createElement("input");ee.setAttribute("type","radio");ee.setAttribute("name","cds-unit-toggle");ee.setAttribute("id","cds-unit-toggle-metric");ee.setAttribute("value","metric");if(u==="metric"){ee.setAttribute("checked","checked");}
e.appendChild(ee);ee=document.createElement("label");ee.setAttribute("for","cds-unit-toggle-metric");ee.appendChild(document.createTextNode(cds.getTextLabel("global.unit_metric_label")));e.appendChild(ee);jQuery("input[name='cds-unit-toggle']").change(function(){var url=location.href.replace(/(&)?unit=(english|metric)/,"").replace("?&","?").replace(/\?$/,""),unit=jQuery("input[name='cds-unit-toggle']:checked").val();if(unit){if(url.indexOf("?")===-1){url+="?unit="+unit;}else{url+="&unit="+unit;}
cds.setCookie("cds.catalog.unit",unit,365);location.href=url;}});}},submitCADAttachment:function(url){var format=null,a=/(?:f|format)=([^&]+)/.exec(url);if(a.length<2){alert("Invalid CAD url, no format.");}
format=a[1];cds.CADRequester.attachmentFormat=format;cds.CADRequester.getCAD(format);return false;},makeSameHeight:function(elements,padding,staticHeight){var h=(!isNaN(staticHeight))?staticHeight:-1;if(h===-1){elements.each(function(index,element){if(jQuery(this).height()>h){h=jQuery(this).height();}});if(!isNaN(padding)){h+=padding;}}
elements.each(function(index,element){jQuery(this).height(h);});},makeSameWidth:function(elements,padding,staticWidth){var w=(!isNaN(staticWidth))?staticWidth:-1;if(w===-1){elements.each(function(index,element){if(jQuery(this).width()>w){w=jQuery(this).width();}});if(!isNaN(padding)){w+=padding;}}
elements.each(function(index,element){jQuery(this).width(w);});},access:new(function(){this.registerDialogHeight=680;this.registerDialogWidth=500;this.login=function(callback,cArgs,callbackOnError,coeArgs,callbackURL){if(!cds.accessManager2.loaded){cds.loadRemoteScript(cds.remoteServerBaseURL+"/js/cds-access-2.0-min.js",function(){cds.accessManager2.login(callback,cArgs,callbackOnError,coeArgs,callbackURL);});}else{cds.accessManager2.login(callback,cArgs,callbackOnError,coeArgs,callbackURL);}};this.logout=function(callback,cArgs,callbackOnError,coeArgs,callbackURL){if(!cds.accessManager2.loaded){cds.loadRemoteScript(cds.remoteServerBaseURL+"/js/cds-access-2.0-min.js",function(){cds.accessManager2.logout(callback,cArgs,callbackOnError,coeArgs,callbackURL);});}else{cds.accessManager2.logout(callback,cArgs,callbackOnError,coeArgs,callbackURL);}};this.myaccount=function(callback,cArgs,callbackOnError,coeArgs,callbackURL){if(!cds.accessManager2.loaded){cds.loadRemoteScript(cds.remoteServerBaseURL+"/js/cds-access-2.0-min.js",function(){cds.accessManager2.myaccount(callback,cArgs,callbackOnError,coeArgs,callbackURL);});}else{cds.accessManager2.myaccount(callback,cArgs,callbackOnError,coeArgs,callbackURL);}};this.loadRegistrationProperties=function(callback){if(!cds.accessManager2.loaded){cds.loadRemoteScript(cds.remoteServerBaseURL+"/js/cds-access-2.0-min.js",function(){cds.accessManager2.loadRegistrationProperties(callback);});}else{cds.accessManager2.loadRegistrationProperties(callback);}};})(),authenticationManager:new(function(){this.loginDialog=null;this.registerDialog=null;this.source=null;this.callback=null;this.callbackParameters=null;this.registerDialogWidth=500;this.registerDialogHeight=680;this.isInitialLoginAttempt=true;this.error=null;this.handleSignIn=function(){var e,email,agreedTOS=false,contactOk=false;e=document.getElementById("cds-login-agreedtos-input");if(e&&e.checked){agreedTOS=true;}
if(!agreedTOS){e=document.getElementById("cds-login-agreedtos-error");if(e){e.style.display="block";}
return;}
e=document.getElementById("cds-login-contactok-input");if(e&&e.checked){contactOk=true;}
var email=document.getElementById("cds-login-email").value;jQuery.ajax({url:cds.remoteServerBaseURL+"/access?callback=?",dataType:"jsonp",data:{"c":"agree-tos","agreedtos":agreedTOS,"contactok":contactOk,"d":cds.getTemplateDomain(),"email":email},context:this});cds.setCookie("cds."+cds.getTemplateDomain()+".user",email,365);if(this.loginDialog){this.loginDialog.dialog("close");}
this.isInitialLoginAttempt=false;if(typeof cdsHandlePostLogin==="function"){cdsHandlePostLogin(email);}
if(this.callback!=null){this.callback(this.callbackParameters);}else{if(this.source==="cad"&&cds.CADRequester.resultCADFormat){cds.CADRequester.getCAD(cds.CADRequester.resultCADFormat);}else if(this.source==="spec-sheet"){cds.specSheet.submit();}else if(this.source==="cart-update"){cds.cart.handleUpdate();}else if(this.source==="cart-submit"){cds.cart.handleSubmit();}else if(this.source==="cart-add"){cds.cart.addProduct();}else if(this.source==="cart-load"){cds.cart.load();}else if(this.source==="myaccount"){cds.access.myaccount();}}};this.handleNewUser=function(){jQuery.ajax({url:cds.remoteServerBaseURL+"/access?callback=?",dataType:"jsonp",data:{"c":"get-registration-properties","d":cds.getTemplateDomain()},context:this,success:function(data){var i;for(i in data){if(data.hasOwnProperty(i)){cds.domainProperties[i]=data[i];}}
this.loginDialog.dialog("close");this.register(cds.getTemplateDomain());}});};this.handleRegister=function(){var e,estate=document.getElementById("cds-registration-state"),ecountry=document.getElementById("cds-registration-country"),o={"c":"register","d":cds.getTemplateDomain()};if(document.getElementById("cds-registration-email").value&&document.getElementById("cds-registration-email").value.length){o["email"]=document.getElementById("cds-registration-email").value;}
if(cds.domainProperties["authentication.displayedfield.firstname"]&&document.getElementById("cds-registration-firstname")&&document.getElementById("cds-registration-firstname").value&&document.getElementById("cds-registration-firstname").value.length){o["fname"]=document.getElementById("cds-registration-firstname").value;}
if(cds.domainProperties["authentication.displayedfield.lastname"]&&document.getElementById("cds-registration-lastname")&&document.getElementById("cds-registration-lastname").value&&document.getElementById("cds-registration-lastname").value.length){o["lname"]=document.getElementById("cds-registration-lastname").value;}
if(cds.domainProperties["authentication.displayedfield.company"]&&document.getElementById("cds-registration-company")&&document.getElementById("cds-registration-company").value&&document.getElementById("cds-registration-company").value.length){o["company"]=document.getElementById("cds-registration-company").value;}
if(cds.domainProperties["authentication.displayedfield.phone"]&&document.getElementById("cds-registration-phone")&&document.getElementById("cds-registration-phone").value&&document.getElementById("cds-registration-phone").value.length){o["phone"]=document.getElementById("cds-registration-phone").value;}
if(cds.domainProperties["authentication.displayedfield.address1"]&&document.getElementById("cds-registration-address1")&&document.getElementById("cds-registration-address1").value&&document.getElementById("cds-registration-address1").value.length){o["address1"]=document.getElementById("cds-registration-address1").value;}
if(cds.domainProperties["authentication.displayedfield.address2"]&&document.getElementById("cds-registration-address2")&&document.getElementById("cds-registration-address2").value&&document.getElementById("cds-registration-address2").value.length){o["address2"]=document.getElementById("cds-registration-address2").value;}
if(cds.domainProperties["authentication.displayedfield.address3"]&&document.getElementById("cds-registration-address3")&&document.getElementById("cds-registration-address3").value&&document.getElementById("cds-registration-address3").value.length){o["address3"]=document.getElementById("cds-registration-address3").value;}
if(cds.domainProperties["authentication.displayedfield.city"]&&document.getElementById("cds-registration-city")&&document.getElementById("cds-registration-city").value&&document.getElementById("cds-registration-city").value.length){o["city"]=document.getElementById("cds-registration-city").value;}
if(cds.domainProperties["authentication.displayedfield.zip"]&&document.getElementById("cds-registration-zip")&&document.getElementById("cds-registration-zip").value&&document.getElementById("cds-registration-zip").value.length){o["zip"]=document.getElementById("cds-registration-zip").value;}
if(estate){if(estate.options){if(estate.options[estate.selectedIndex]&&estate.options[estate.selectedIndex].value.length){o["state"]=estate.options[estate.selectedIndex].value;}}else if(cds.domainProperties["authentication.displayedfield.state"]&&document.getElementById("cds-registration-state").value&&document.getElementById("cds-registration-state").value.length){o["state"]=document.getElementById("cds-registration-state").value;}}
if(ecountry&&ecountry.options[ecountry.selectedIndex]&&ecountry.options[ecountry.selectedIndex].value.length){o["country"]=ecountry.options[ecountry.selectedIndex].value;}
if(cds.templateDomainId==="gam"||cds.templateDomainId==="ruland"){e=document.getElementById("cds-registration-source");if(e){o["source"]=e.options[e.selectedIndex].value;if(o["source"]==="Other"||o["source"]==="Salesperson"){e=document.getElementById("cds-registration-source-other");if(e&&e.value&&e.value.length){o["source"]=e.value;}else{delete o["source"];}}}}
e=document.getElementById("cds-registration-variable1");if(e&&e.value&&e.value.length){o["var1"]=document.getElementById("cds-registration-variable1").value;}
e=document.getElementById("cds-registration-variable2");if(e&&e.value&&e.value.length){o["var2"]=document.getElementById("cds-registration-variable2").value;}
e=document.getElementById("cds-registration-variable3");if(e&&e.value&&e.value.length){o["var3"]=document.getElementById("cds-registration-variable3").value;}
e=document.getElementById("cds-registration-agreedtos");if(e&&e.checked){o["agreedtos"]="true";}else{document.getElementById("cds-registration-error").innerHTML="You must agree to the terms of service to register.";return;}
e=document.getElementById("cds-registration-contactok");if(e&&e.checked){o["contactok"]="true";}
if(!o["email"]||(cds.domainProperties["authentication.displayedfield.firstname"]&&cds.domainProperties["authentication.requiredfield.firstname"]&&!o["fname"])||(cds.domainProperties["authentication.requiredfield.lastname"]&&!o["lname"])||(cds.domainProperties["authentication.requiredfield.company"]&&!o["company"])||(cds.domainProperties["authentication.requiredfield.phone"]&&!o["phone"])||(cds.domainProperties["authentication.requiredfield.address1"]&&!o["address1"])||(cds.domainProperties["authentication.requiredfield.address2"]&&!o["address2"])||(cds.domainProperties["authentication.requiredfield.address3"]&&!o["address3"])||(cds.domainProperties["authentication.requiredfield.city"]&&!o["city"])||(cds.domainProperties["authentication.requiredfield.state"]&&!o["state"])||(cds.domainProperties["authentication.requiredfield.country"]&&!o["country"])||(cds.domainProperties["authentication.requiredfield.zip"]&&!o["zip"])||(cds.domainProperties["authentication.requiredfield.variable1"]&&!o["var1"])||(cds.domainProperties["authentication.requiredfield.variable2"]&&!o["var2"])||(cds.domainProperties["authentication.requiredfield.variable3"]&&!o["var3"])||((cds.templateDomainId==="gam"||cds.templateDomainId==="ruland")&&!o["source"])){document.getElementById("cds-registration-error").innerHTML=cds.getTextLabel("registration.error_required_field");return;}
if(typeof cdsHandlePreRegister==="function"){if(!cdsHandlePreRegister(o)){return;}}
jQuery.ajax({url:cds.remoteServerBaseURL+"/access?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){if(!data.ok){if(data.error==="account exists"){document.getElementById("cds-registration-error").innerHTML=cds.getTextLabel("registration.error_account_exists");}else{document.getElementById("cds-registration-error").innerHTML=cds.getTextLabel("registration.error_unknown");}}else{cds.setCookie("cds."+cds.getTemplateDomain()+".user",data.email,365);if(typeof cdsHandlePostRegister==="function"){cdsHandlePostRegister(data);}
if(cds.authenticationManager.registerDialog){cds.authenticationManager.registerDialog.dialog("close");}
if(cds.domainProperties["authentication.validateEmail"]===true){alert("A verification email has been sent to the account you just registered.\n\n"+"Please check your email account and click on the link contained within the "+"verification email message to access CAD download functionality. Please check "+"your spam filter if you do not receive the verification email message.");}
if(cds.authenticationManager.source==="cad"&&cds.CADRequester.resultCADFormat){cds.CADRequester.getCAD(cds.CADRequester.resultCADFormat);}else if(this.source==="spec-sheet"){cds.specSheet.submit();}else if(this.source==="cart-update"){cds.cart.handleUpdate();}else if(this.source==="cart-submit"){cds.cart.handleSubmit();}else if(this.source==="cart-add"){cds.cart.addProduct();}else if(this.source==="cart-load"){cds.cart.load();}}}});};this.getRegistrationFieldText=function(attribute,label,required){var s="";if(required||cds.domainProperties["authentication.displayedfield."+attribute]){s+="<tr><td>"
+"<label for=\"cds-registration-"+attribute+"\">"
+cds.getTextLabel("registration."+label+"_label")
+"</label></td>"
+"<td><input id=\"cds-registration-"+attribute+"\" type=\""
+(attribute==="email"?"email":"text")+"\" value=\"\" /></td>";if(required||cds.domainProperties["authentication.requiredfield."+attribute]){s+="<td class=\"info\">*</td>";}
s+="</tr>";}
return s;},this.getRegisterHTML=function(){var s="<div id=\"cds-registration-header\">"+cds.getTextLabel("registration.header_text")+"</div>"
+"<table id=\"cds-registration-form\">"
+"<tr>"
+"<td colspan=\"3\" class=\"info\">"+cds.getTextLabel("registration.required_notification_text")
+"</td>"
+"</tr>"
+"<tr><td colspan=\"3\" id=\"cds-registration-error\"></td></tr>";if(cds.domainProperties["authentication.displayedfield.address1"]||cds.domainProperties["authentication.displayedfield.address2"]||cds.domainProperties["authentication.displayedfield.address3"]||cds.domainProperties["authentication.displayedfield.city"]||cds.domainProperties["authentication.displayedfield.state"]||cds.domainProperties["authentication.displayedfield.country"]||cds.domainProperties["authentication.displayedfield.zip"]){s+="<tr><td colspan=\"3\" class=\"header\">"+cds.getTextLabel("registration.contact_details_label")
+"</td></tr>";}
s+=this.getRegistrationFieldText("email","email",true);s+=this.getRegistrationFieldText("firstname","first_name");s+=this.getRegistrationFieldText("lastname","last_name");s+=this.getRegistrationFieldText("company","company");s+=this.getRegistrationFieldText("phone","phone");if(cds.domainProperties["authentication.displayedfield.address1"]||cds.domainProperties["authentication.displayedfield.address2"]||cds.domainProperties["authentication.displayedfield.address3"]||cds.domainProperties["authentication.displayedfield.city"]||cds.domainProperties["authentication.displayedfield.state"]||cds.domainProperties["authentication.displayedfield.country"]||cds.domainProperties["authentication.displayedfield.zip"]){s+="<tr><td class=\"header\">"+cds.getTextLabel("registration.address_details_label")
+"</td></tr>";}
s+=this.getRegistrationFieldText("address1","address_1");s+=this.getRegistrationFieldText("address2","address_2");s+=this.getRegistrationFieldText("address3","address_3");s+=this.getRegistrationFieldText("city","city");if(cds.domainProperties["authentication.displayedfield.state"]){s+="<tr><td><label for=\"cds-registration-state\">"+cds.getTextLabel("registration.state_label")
+"</label></td><td id=\"cds-registration-state-container\">"
+"<select id=\"cds-registration-state\">"
+"<option value=\"\">Please select a state/province</option></select></td>";if(cds.domainProperties["authentication.requiredfield.state"]){s+="<td class=\"info\">*</td>";}
s+="</tr>";}
if(cds.domainProperties["authentication.displayedfield.country"]){s+="<tr><td><label for=\"cds-registration-country\">"+cds.getTextLabel("registration.country_label")
+"</label></td><td>"
+"<select id=\"cds-registration-country\"name=\"cds-registration-country\">"
+"<option value=\""+cds.defaultRegistrationCountry+"\" selected=\"selected\">"
+cds.defaultRegistrationCountry+"</option></select></td>";if(cds.domainProperties["authentication.requiredfield.country"]){s+="<td class=\"info\">*</td>";}
s+="</tr>";}
s+=this.getRegistrationFieldText("zip","postal_code");if(cds.templateDomainId==="gam"||cds.templateDomainId==="ruland"){s+="<tr><td colspan=\"2\" class=\"header\">Where did you hear about us?</td></tr>"
+"<tr>"
+"    <td>&nbsp;</td>"
+"    <td id=\"cds-registration-source-container\">"
+"        <select id=\"cds-registration-source\" onchange=\"cdsOnChangeSource()\">"
+"            <option>Existing Customer</option>"
+"            <option>Email</option>"
+"            <option>Social Media</option>"
+"            <option>Referral</option>"
+"            <option>Trade Magazine</option>"
+"            <option>Salesperson</option>"
+"            <option>Web Search</option>"
+"            <option>Other</option>"
+"        </select>"
+"    </td>"
+"    <td class=\"info\">*</td>"
+"</tr>"
+"<tr id=\"cds-registration-source-other-container\" style=\"display: none\">"
+"    <td><label for=\"cds-registration-source-other\" id=\"cds-registration-source-other-label\">Other Source:</label></td>"
+"    <td><input type=\"text\" value=\"\" id=\"cds-registration-source-other\"></td>"
+"    <td class=\"info\">*</td>"
+"</tr>"
+"<script>"
+"function cdsOnChangeSource() {"
+"    \"use strict\";"
+"    var e = document.getElementById(\"cds-registration-source-other\");"
+"    if (e) {"
+"        e.value = \"\";"
+"        e = document.getElementById(\"cds-registration-source\");"
+"        if (e) {"
+"            if (e.options[e.selectedIndex].value === \"Other\") {"
+"                document.getElementById(\"cds-registration-source-other-label\").innerHTML = \"Other Source:\";"
+"                document.getElementById(\"cds-registration-source-other-container\").style.display = \"\";"
+"            } else if (e.options[e.selectedIndex].value === \"Salesperson\") {"
+"                document.getElementById(\"cds-registration-source-other-label\").innerHTML = \"Salesperson:\";"
+"                document.getElementById(\"cds-registration-source-other-container\").style.display = \"\";"
+"            } else {"
+"                document.getElementById(\"cds-registration-source-other-container\").style.display = \"none\";"
+"            }"
+"        }"
+"    }"
+"}"
+"</script>";}
s+="<tr class=\"cds-registration-checkbox-container\">"
+"<td><input id=\"cds-registration-agreedtos\" type=\"checkbox\"></td>"
+"<td><label for=\"cds-registration-agreedtos\">"
+cds.getTextLabel("registration.agree_tos_text_prefix")
+"the "
+"<a target=\"_blank\" href=\""
+cds.getTextLabel("registration.tos_link")
+"\">"
+cds.getTextLabel("registration.agree_tos_text_anchor")
+"</a>"
+cds.getTextLabel("registration.agree_tos_text_suffix")
+"</label></td></tr>";s+="<tr class=\"cds-registration-checkbox-container\">"
+"<td><input id=\"cds-registration-contactok\" type=\"checkbox\"></td>"
+"<td><label for=\"cds-registration-contactok\">"
+cds.getTextLabel("registration.contact_me_text")
+"</label></td></tr>";s+="<tr class=\"cds-registration-checkbox-container\">"
+"<td></td>"
+"<td>"
+cds.getTextLabel("registration.gdpr_disclaimer_text")
+"</td></tr>";s+="<tr><td colspan=\"2\" class=\"controls\">"
+"<button onclick=\"cds.authenticationManager.handleRegister();\">"
+cds.getTextLabel("registration.submit_button_text")+"</button></td></tr></table></div>";return s;},this.register=function(domain,source,error){var js;this.registerDialog=jQuery("<div id=\"cds-auth-container\"></div>").html(this.getRegisterHTML()).dialog({title:"New User Registration",width:this.registerDialogWidth,height:this.registerDialogHeight,modal:true,resizable:false,autoOpen:false,close:function(){jQuery(this).remove();cds.authenticationManager.registerDialog=null;}});this.registerDialog.dialog("open");if(location.href.indexOf("product-config.net")!==-1||location.href.indexOf("cdsvisual.net")!==-1||location.href.indexOf("localhost:8080")!==-1){url="/catalog3/js/cds-access-min.js";}else{url="https://www.product-config.net/catalog3/js/cds-access-min.js";}
jQuery.getScript(url,function(){cds.registration.populateCountrySelect();});};this.login=function(domain,source,isInvalid){var s;if(typeof source==="string"){this.source=source;}else{this.callback=source;}
s="<div id=\"cds-login-header\">"
+cds.getTextLabel("login.header_text")
+"</div>";if(isInvalid){s+="<div id=\"cds-login-error\">"
+cds.getTextLabel("login.error_account_does_not_exist")
+"</div>";}
s+="<div id=\"cds-login-form\">"
+"<label for=\"cds-login-email\">"
+cds.getTextLabel("login.email_label")
+"</label>"
+"<input id=\"cds-login-email\" type=\"email\" value=\"\" /><br>"
+"<div id=\"cds-login-agreedtos-error\">"
+cds.getTextLabel("registration.agree_service_text")
+"</div>"
+"<div id=\"cds-login-agreedtos\">"
+"<input id=\"cds-login-agreedtos-input\" type=\"checkbox\" value=\"\">"
+cds.getTextLabel("registration.confirm_read_terms")
+"<a target=\"_blank\" href=\""
+cds.getTextLabel("registration.tos_link")
+"\">"
+cds.getTextLabel("registration.agree_tos_text_anchor")
+"</a>"
+cds.getTextLabel("registration.agree_tos_text_suffix")
+"</div>"
+"<div id=\"cds-login-contactok\">"
+"<input id=\"cds-login-contactok-input\" type=\"checkbox\" value=\"\">"
+cds.getTextLabel("registration.contact_me_text")
+"</div>"
+"<button onclick=\"cds.authenticationManager.handleSignIn();\">"
+cds.getTextLabel("login.submit_button_text")
+"</button>"
+"</div>"
+"<div id=\"cds-login-new-user-container\">"
+"<div>"
+cds.getTextLabel("login.new_user_header_text")
+"</div>"
+"<a href=\"javascript:cds.authenticationManager.handleNewUser();\">"
+cds.getTextLabel("login.new_user_link_text")
+"</a>"
+"</div>";this.loginDialog=jQuery("<div id=\"cds-auth-container\"></div>").html(s).dialog({title:cds.getTextLabel("login.dialog_title"),width:500,height:350,modal:true,resizable:false,autoOpen:false,close:function(){jQuery(this).remove();cds.authenticationManager.loginDialog=null;}});this.loginDialog.dialog("open");};})(),ProductCompareCart:function(){this.products={};this.categoryID=null;this.productCount=0;this.maxProducts=10;this.comparePageURL=null;this.comparePageTarget=null;this.setMaxProducts=function(maxProducts){this.maxProducts=maxProducts;};this.setComparePageURL=function(comparePageURL){this.comparePageURL=comparePageURL;}
this.setComparePageTarget=function(comparePageTarget){this.comparePageTarget=comparePageTarget;}
this.getProductCount=function(){return this.productCount;};this.getMaxProducts=function(){return this.maxProducts;}
this.getComparePageURL=function(){return this.comparePageURL;};this.getComparePageTarget=function(){return this.comparePageTarget;};this.isFull=function(){return this.productCount>=this.maxProducts;};this.addProduct=function(productId){if(!this.products[productId]){if(this.productCount<this.maxProducts){this.productCount++;this.products[productId]=true;}}};this.removeProduct=function(productId){if(this.products[productId]){this.productCount--;delete this.products[productId];}};this.hasProduct=function(productId){return(this.products[productId]);};this.reset=function(){this.products={};this.productCount=0;};this.showComparePage=function(){var url;if(this.productCount<2){alert(cds.getTextLabel("product_compare.error_not_enough_products"));return false;}
url=this.comparePageURL;if(url.indexOf("?")!=-1){url+="&ids=";}else{url+="?ids=";}
i=0;for(p in this.products){if(this.products.hasOwnProperty(p)){if(++i>1){url+="|";}
url+=encodeURIComponent(p);}}
if(this.categoryID!==null){url+="&cid="+encodeURIComponent(this.categoryID);}
if(this.comparePageTarget){window.open(url,this.comparePageTarget);}else{window.location.href=url;}
return false;};this.addToRFQCart=function(facetedSearch){var products=[];product_keys=Object.keys(this.products)
for(var i in product_keys){id=product_keys[i]
var product={"id":id,"qty":1};for(var j in facetedSearch.products){item=facetedSearch.products[j]
if(item.id==id){product["label"]=item.label;product["description"]=item.description;break;}}
product["url"]=facetedSearch.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain())).replace(/%CATEGORY%/g,encodeURIComponent(facetedSearch.category.id)).replace(/%PRODUCT%/g,id);products.push(product);}
cds.cart.addMultipleProducts(products,false,"index.jsp?c=cart");};},productCompareTable:new(function(){this.parentElementId=null;this.unit=null;this.productURLTemplate=null;this.products=[];this.showAttachments=true;this.setDomain=function(domain){cds.setDomain(domain);};this.setParentElementId=function(parentElementId){this.parentElementId=parentElementId;};this.setServerURL=function(serverURL){cds.setRemoteServerBaseURL(serverURL);};this.setUnit=function(unit){this.unit=unit;}
this.setProductURLTemplate=function(productURLTemplate){this.productURLTemplate=productURLTemplate;};this.getParentElementId=function(){return this.parentElementId;};this.getServerURL=function(){return cds.remoteServerBaseURL;};this.getUnit=function(){return unit;}
this.getProductURLTemplate=function(){return this.productURLTemplate;};this.load=function(){var r,i,ids,cid,o,u;r=(new RegExp("ids=([^&#]*)")).exec(window.location.search);if(r.length<2){alert(cds.getTextLabel("product_compare.error_no_products_given"));return;}
ids=decodeURIComponent(r[1]).split("|");if(ids.length===0){alert(cds.getTextLabel("product_compare.error_no_products_given"));return;}
cid=null;r=/cid=([^&#]+)/.exec(window.location.search);if(r&&r.length>0){cid=decodeURIComponent(r[1]);}
o={o:"compare",d:cds.getDataDomain()};for(i=0;i<ids.length;i++){o["id"+i]=ids[i];}
u=this.unit;if(!u){u=cds.getCookie("cds.catalog.unit");if(!u){u="english";}}
this.unit=u;o["unit"]=u;if(cid!==null){o["cid"]=cid;}
jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){if(data.error){alert(cds.getTextLabel("product_compare.error_server_response"));}else{this.products=data.products;if(typeof cdsProductCompareTablePreDisplayCallback!=="undefined"){cdsProductCompareTablePreDisplayCallback(this);}
this.display();if(typeof cdsProductCompareTablePostDisplayCallback!=="undefined"){cdsProductCompareTablePostDisplayCallback(this);}}}});};this.handleMouseOverRow=function(e){if(e.className&&e.className.length>0){e.className+=" hovered";}else{e.className="hovered";}};this.handleMouseOutRow=function(e){e.className=e.className.replace(/( )?hovered/,"");};this.display=function(){var table,thead,tbody,tr,td,e,i,j,s,a,v,l,found,diff,url,container=document.getElementById(this.parentElementId);if(!container){alert(cds.getTextLabel("product_compare.error_missing_parent_element"));return;}
while(container.hasChildNodes()){container.removeChild(container.lastChild);}
table=document.createElement("table");container.appendChild(table);table.setAttribute("id","cds-product-compare-table");thead=document.createElement("thead");table.appendChild(thead);tr=document.createElement("tr");thead.appendChild(tr);td=document.createElement("td");tr.appendChild(td);td.className="nowrap";td.setAttribute("rowspan","2");e=document.createElement("h3");td.appendChild(e);e.appendChild(document.createTextNode(cds.getTextLabel("product_compare.header_text").replace(/%count%/g,this.products.length)));for(i=0;i<this.products.length;i++){td=document.createElement("td");tr.appendChild(td);s=this.products[i].thumbnailURL;if(!s){s=this.products[i].imageURL;}
if(s){e=document.createElement("img");e.setAttribute("src",s);}else{e=document.createTextNode(" ");}
td.appendChild(e);}
tr=document.createElement("tr");thead.appendChild(tr);for(i=0;i<this.products.length;i++){s=this.products[i].label?this.products[i].label:this.products[i].id;td=document.createElement("td");tr.appendChild(td);e=document.createElement("a");td.appendChild(e);url=this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain())).replace(/%CATEGORY%/g,"").replace(/%PRODUCT%/g,encodeURIComponent(this.products[i].id)).replace(/%PRODUCT_CATEGORY%/g,encodeURIComponent(this.products[i].category.id));url=cds.getDataDomainURI(url);e.setAttribute("href",url);e.appendChild(document.createTextNode(s));}
tbody=document.createElement("tbody");table.appendChild(tbody);r=0;for(i=0;i<this.products.length;i++){if(this.products[i]["description"]){tr=document.createElement("tr");tbody.appendChild(tr);if(r++%2!==0){tr.className="odd-row";}
tr.controller=this;tr.onmouseover=function(){this.controller.handleMouseOverRow(this);return false;};tr.onmouseout=function(){this.controller.handleMouseOutRow(this);return false;};td=document.createElement("td");tr.appendChild(td);td.className="label";td.appendChild(document.createTextNode("Description"));for(j=0;j<this.products.length;j++){td=document.createElement("td");td.setAttribute("id","cds-compare-table-description-"+this.products[j].id);tr.appendChild(td);td.appendChild(document.createTextNode(this.products[j]["description"]||""));}
break;}}
a=this.products[0].attributes;for(i=0;i<a.length;i++){if(!this.showAttachments&&a[i].dataType==="attachment"){continue;}
v=this.products[0].attributeValues[i];found=false;diff=false;for(j=0;j<this.products.length;j++){if(this.products[j].attributeValues[i]!==null){found=true;}
if(this.products[j].attributeValues[i]!==v){diff=true;break;}}
if(!found){continue;}
tr=document.createElement("tr");tbody.appendChild(tr);if(r++%2!==0){tr.className="odd-row";}
tr.controller=this;tr.onmouseover=function(){this.controller.handleMouseOverRow(this);return false;};tr.onmouseout=function(){this.controller.handleMouseOutRow(this);return false;};td=document.createElement("td");tr.appendChild(td);td.className="label";l=a[i].label;if(a[i].hasOwnProperty("persistedUnit")){if(this.unit==="metric"){l+=" ("+(a[i].hasOwnProperty("metricDefaultUnit")?a[i].metricDefaultUnit:a[i].persistedUnit)+")";}else{l+=" ("+(a[i].hasOwnProperty("englishDefaultUnit")?a[i].englishDefaultUnit:a[i].persistedUnit)+")";}}
td.appendChild(document.createTextNode(l));for(j=0;j<this.products.length;j++){v=this.products[j].attributeValues[i];td=document.createElement("td");td.setAttribute("id","cds-compare-table-"+a[i].id+"-"+this.products[j].id);tr.appendChild(td);if(diff){td.className="hilited-text";}
if(a[i].dataType==="attachment"){if(v!==null){e=document.createElement("a");td.appendChild(e);e.setAttribute("href",v);e.appendChild(document.createTextNode(a[i].label));}}else{v=cds.attributeSearchTable.getDisplayValue(a[i],v);td.innerHTML=v;}}}
tfoot=document.createElement("tfoot");table.appendChild(tfoot);tr=document.createElement("tr");tfoot.appendChild(tr);td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(" "));for(i=0;i<this.products.length;i++){s=this.products[i].label?this.products[i].label:this.products[i].id;td=document.createElement("td");tr.appendChild(td);e=document.createElement("a");td.appendChild(e);url=this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain())).replace(/%CATEGORY%/g,"").replace(/%PRODUCT%/g,encodeURIComponent(this.products[i].id)).replace(/%PRODUCT_CATEGORY%/g,encodeURIComponent(this.products[i].category.id));url=cds.getDataDomainURI(url);e.setAttribute("href",url);e.appendChild(document.createTextNode(s));}};})(),attributeSearchTable:new(function(){this.category=null;this.sortAttribute=null;this.sortAscending=true;this.page=0;this.parentElementId=null;this.serverURL="//www.product-config.net/catalog3/service";this.unit="metric";this.productURLTemplate=null;this.displaySingleProduct=true;this.displayAdvancedSearch=true;this.displayThumbnail=false;this.rowsPerPage=null;this.compareCart=null;this.addPageTracker=false;this.filter={};this.allRowsCount=0;this.startRow=0;this.endRow=0;this.attributes=null;this.distinctValues=null;this.storedDistinctValues=null;this.rows=null;this.chooseAttributeDialog=null;this.attributeVisibleOverride={};this.attributeHiddenOverride={};this.reverseHeaderControlsOrder=false;this.setDomain=function(domain){cds.setDomain(domain);};this.setCategory=function(category){this.category=category;};this.setSortAttribute=function(sortAttribute){this.sortAttribute=sortAttribute;};this.setSortAscending=function(sortAscending){this.sortAscending=sortAscending;};this.setPage=function(page){this.page=page;};this.setParentElementId=function(parentElementId){this.parentElementId=parentElementId;};this.setServerURL=function(serverURL){this.serverURL=serverURL;};this.setUnit=function(unit){this.unit=unit;};this.setProductURLTemplate=function(productURLTemplate){this.productURLTemplate=productURLTemplate;};this.setDisplaySingleProduct=function(displaySingleProduct){this.displaySingleProduct=displaySingleProduct;};this.setDisplayAdvancedSearch=function(displayAdvancedSearch){this.displayAdvancedSearch=displayAdvancedSearch;};this.setDisplayThumbnail=function(displayThumbnail){this.displayThumbnail=displayThumbnail;};this.setRowsPerPage=function(rowsPerPage){this.rowsPerPage=rowsPerPage;};this.setCompareCart=function(compareCart){this.compareCart=compareCart;};this.setTextLabels=function(textLabels){this.textLabels=textLabels;};this.addFilter=function(id,exact,min,max){var o={},c=this.filter[id];if(exact!==null){o.exact=exact;}
if(min!==null){o.min=min;if(max===null&&c&&c.max){o.max=c.max;}}
if(max!==null){o.max=max;if(min===null&&c&&c.min){o.min=c.min;}}
this.filter[id]=o;};this.getCategory=function(){return this.category;};this.getSortAttribute=function(){return this.sortAttribute;};this.getSortAscending=function(){return this.sortAscending;};this.getPage=function(){return this.page;};this.getParentElementId=function(){return this.parentElementId;};this.getServerURL=function(){return this.serverURL;};this.getUnit=function(){return unit;};this.getProductURLTemplate=function(){return this.productURLTemplate;};this.getDisplaySingleProduct=function(){return this.displaySingleProduct;};this.getDisplayAdvancedSearch=function(){return this.displayAdvancedSearch;};this.getDisplayThumbnail=function(){return this.displayThumbnail;};this.getRowsPerPage=function(){return this.rowsPerPage;};this.getCompareCart=function(){return this.compareCart;};this.getFilter=function(){return this.filter;};this.getAllRowsCount=function(){return this.allRowsCount;};this.getAttributes=function(){return this.attributes;};this.getDistinctValues=function(){return this.distinctValues;};this.getStoredDistinctValues=function(){return this.storedDistinctValues;};this.getRows=function(){return this.rows;};this.setAllowCompare=function(){};this.load=function(){var o,i,a,ve,vn,vx,s,fcnt,found;if(!this.sortAttribute){a=cds.getQueryStringParameter("sa");if(a){this.setSortAttribute(a);this.setSortAscending(true);}else{a=cds.getQueryStringParameter("sd");if(a){this.setSortAttribute(a);this.setSortAscending(false);}}}
if(!this.filter.length){for(i=0;i<10;i++){a=cds.getQueryStringParameter("a"+i);if(a){ve=cds.getQueryStringParameter("v"+i);vn=cds.getQueryStringParameter("vmin"+i);vx=cds.getQueryStringParameter("vmax"+i);if(ve||vn||vx){this.addFilter(a,ve,vn,vx);}}}}
o={o:"search",d:cds.getDataDomain(),cid:this.category,page:this.page};if(this.sortAttribute){o.sort=this.sortAttribute;if(!this.sortAscending){o.sortDesc="true";}}
if(this.rowsPerPage){o.rowcount=this.rowsPerPage;}
fcnt=0;for(i in this.filter){if(this.filter.hasOwnProperty(i)){o["a"+fcnt]=i;if(this.filter[i].exact){o["ve"+fcnt]=this.filter[i].exact;}
if(this.filter[i].min){o["vn"+fcnt]=this.filter[i].min;}
if(this.filter[i].max){o["vx"+fcnt]=this.filter[i].max;}
fcnt++;}}
jQuery.ajax({url:this.serverURL+"?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){if(data.error){alert(cds.getTextLabel("attribute_search.error_server_response"));}else{this.allRowsCount=data.allRowsCount;this.startRow=data.startRow;this.endRow=data.endRow;this.unit=data.unit;this.attributes=data.attributes;this.distinctValues=data.distinctValues;this.storedDistinctValues=data.storedDistinctValues;this.rows=data.rows;if(!this.displaySingleProduct){if(this.rows&&this.rows.length===1){found=false;for(i in this.filter){if(this.filter.hasOwnProperty(i)){found=true;break;}}
if(!found){location.href=this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getDataDomain())).replace(/%CATEGORY%/g,encodeURIComponent(this.category)).replace(/%PRODUCT%/g,encodeURIComponent(this.rows[0][0]));}}}
this.init();this.preDisplayCallback();this.display();this.postDisplayCallback();}}});};this.toFraction=function(decimal){var tmp,fp,ip,d1,denominator,numerator,delta,dd,wp=0,sign=1;if(decimal<0){sign=-1;decimal*=-1;}
if(decimal>=1.0){tmp=decimal%1;wp=decimal-tmp;decimal=tmp;}
fp=decimal;d1=0;denominator=1;dd=decimal*denominator;numerator=dd-dd%1;delta=numerator/denominator-decimal;while((delta>0&&delta>1.0E-12)||(delta<0&&delta<-1.0E-12)){fp=1.0/fp;tmp=fp%1;ip=fp-tmp;fp=tmp;tmp=denominator;denominator=ip*denominator+d1;d1=tmp;dd=decimal*denominator;numerator=dd-dd%1;delta=numerator/denominator-decimal;}
var ret='';if(wp>0.5){if(numerator<0.5){ret=(sign*wp)+'';}else{ret=(sign*wp)+' '+numerator+'/'+denominator;}}else{if(numerator<0.5){ret='0';}else{ret=(sign*numerator)+'/'+denominator;}}
return ret;};this.getDisplayValue=function(attribute,value){var v=value;if(!v){return"";}else if(attribute.dataType==="fraction"&&(!this.unit||this.unit==="english"||!document.getElementById("cds-unit-toggle-english"))){v=this.toFraction(v);}
if(typeof cdsGetDisplayValue==="function"){v=cdsGetDisplayValue(attribute,v);}
return v;};this.preDisplayCallback=function(){};this.postDisplayCallback=function(){};this.handleChangePage=function(newPage){this.page=newPage;this.load();};this.handleChangeRowsPerPage=function(select){var v=parseInt(select.options[select.selectedIndex].innerHTML);if(!isNaN(v)&&v>=0&&v<=250){this.rowsPerPage=v;this.load();}};this.handleSelectAttributeValue=function(e,i){var v=e.options[e.selectedIndex].value,sv=this.storedDistinctValues[i][e.selectedIndex-1];if(v!=="all"){if(v==="none"){this.addFilter(this.attributes[i].id,null,null,null);}else{this.addFilter(this.attributes[i].id,sv,null,null);}
this.page=0;this.load();}};this.handleMinAttributeValue=function(e,i){var v=e.value;if(v!==cds.getTextLabel("attribute_search.range_min_input_box_text")){v=parseFloat(e.value);if(isNaN(v)){alert(cds.getTextLabel("attribute_search.error_invalid_min_range_value"));e.value=cds.getTextLabel("attribute_search.range_min_input_box_text");if(this.filter[this.attributes[i].id]){delete this.filter[this.attributes[i].id];this.page=0;this.load();}}else{this.addFilter(this.attributes[i].id,null,v,null);this.page=0;this.load();}}};this.handleMaxAttributeValue=function(e,i){var v=e.value;if(v!==cds.getTextLabel("attribute_search.range_max_input_box_text")){v=parseFloat(e.value);if(isNaN(v)){alert(cds.getTextLabel("attribute_search.error_invalid_max_range_value"));e.value=cds.getTextLabel("attribute_search.range_max_input_box_text");if(this.filter[this.attributes[i].id]){delete this.filter[this.attributes[i].id];this.page=0;this.load();}}else{this.addFilter(this.attributes[i].id,null,null,v);this.page=0;this.load();}}};this.handleMinKeypress=function(e,i,evt){var c;evt=(evt)?evt:window.event;c=(evt.charCode)?evt.charCode:((evt.which)?evt.which:evt.keyCode);if(c===13||c===3){this.handleMinAttributeValue(e,i);return false;}
return true;};this.handleMaxKeypress=function(e,i,evt){var c;evt=(evt)?evt:window.event;c=(evt.charCode)?evt.charCode:((evt.which)?evt.which:evt.keyCode);if(c===13||c===3){this.handleMaxAttributeValue(e,i);return false;}
return true;};this.handleResetAttributeValue=function(i){delete this.filter[this.attributes[i].id];this.page=0;this.load();};this.handleSortAttribute=function(i){if(this.sortAttribute===this.attributes[i].id){this.sortAscending=!this.sortAscending;}else{this.sortAttribute=this.attributes[i].id;this.sortAscending=true;}
this.page=0;this.load();};this.handleCompareProducts=function(){this.compareCart.showComparePage();};this.handleResetAll=function(){this.sortAttribute=null;this.sortAscending=true;this.page=0;this.filter={};if(this.compareCart){this.compareCart.reset();}
this.load();};this.handleChooseAttributes=function(){var i,s,a,container,div,e;if(!this.chooseAttributeDialog){container=document.createElement("div");container.setAttribute("id","cds-choose-attributes-dialog");e=document.createElement("p");container.appendChild(e);e.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.advanced_search_header_text")));for(i=2;i<this.attributes.length;i++){a=this.attributes[i];if(a.empty){continue;}
div=document.createElement("div");container.appendChild(div);e=document.createElement("input");e.setAttribute("type","checkbox");div.appendChild(e);e.setAttribute("id","cds-choose-attribute-"+a.id);if(a.visible){e.setAttribute("checked","checked");}
e.onchange=function(event){var i=this.id.substring(21);if(this.checked){cds.attributeSearchTable.attributeVisibleOverride[i]=true;delete cds.attributeSearchTable.attributeHiddenOverride[i];}else{delete cds.attributeSearchTable.attributeVisibleOverride[i];cds.attributeSearchTable.attributeHiddenOverride[i]=true;}
return false;};s=a.label;if(a.id==="_productId"||a.id==="_label"){s=cds.getTextLabel("attribute_search.product_column_label");}else if(a.id==="_description"){s=cds.getTextLabel("attribute_search.description_column_label");}else if(a.id==="_thumbnailURL"){s=cds.getTextLabel("attribute_search.image_column_label");}
e=document.createElement("label");div.appendChild(e);e.appendChild(document.createTextNode(s));e.setAttribute("for","cds-choose-attribute-"+a.id);e=document.createElement("br");div.appendChild(e);}
div=document.createElement("div");container.appendChild(div);div.className="controls";e=document.createElement("button");div.appendChild(e);e.appendChild(document.createTextNode(cds.getTextLabel("global.ok_button_label")));e.onclick=function(){cds.attributeSearchTable.chooseAttributeDialog.dialog("close");cds.attributeSearchTable.init();cds.attributeSearchTable.preDisplayCallback();cds.attributeSearchTable.display();cds.attributeSearchTable.postDisplayCallback();return false;};e=document.createElement("button");div.appendChild(e);e.appendChild(document.createTextNode(cds.getTextLabel("global.cancel_button_label")));e.onclick=function(){cds.attributeSearchTable.chooseAttributeDialog.dialog("close");return false;};this.chooseAttributeDialog=jQuery(container).dialog({title:cds.getTextLabel("attribute_search.advanced_search_dialog_title"),modal:true,close:function(){cds.attributeSearchTable.chooseAttributeDialog=null;}});}
this.chooseAttributeDialog.dialog("open");};this.handleSelectRow=function(e,i){var id=this.rows[i][0];if(e.checked){if(!this.compareCart.hasProduct(id)){if(this.compareCart.isFull()){alert(cds.getTextLabel("attribute_search.error_too_many_compare_products").replace(/%count%/g,this.compareCart.getMaxProducts()));e.checked=false;return;}
this.compareCart.addProduct(id);}}else{this.compareCart.removeProduct(id);}};this.handleMouseOverRow=function(e){if(e.className&&e.className.length>0){e.className+=" selected";}else{e.className="selected";}};this.handleMouseOutRow=function(e){e.className=e.className.replace(/( )?selected/,"");};this.init=function(){var i,j,a,empty;if(this.allRowsCount>0){this.attributes[0].visible=false;this.attributes[1].visible=true;for(i=2;i<this.attributes.length;i++){a=this.attributes[i];if(this.filter[a.id]){a.visible=true;}else if(a.id==="_thumbnailURL"&&!this.displayThumbnail){a.visible=false;}else if(a.visible){a.visible=false;for(j=0;j<this.rows.length;j++){if(this.rows[j][i]||this.distinctValues[i].length&&!(this.distinctValues[i].length===1&&this.distinctValues[i][0]===null)){a.visible=true;break;}}}
if(this.attributeVisibleOverride[a.id]){a.visible=true;}
if(this.attributeHiddenOverride[a.id]){a.visible=false;}}}};this.display=function(){var i,a,table,parentElement=document.getElementById(this.parentElementId);if(!parentElement){alert(cds.getTextLabel("attribute_search.error_missing_parent_element"));return;}
if(this.allRowsCount===0){if(this.filter!=={}){parentElement.innerHTML="<h2>"+cds.getTextLabel("attribute_search.error_no_filtered_products")
+"</h2>";}else{parentElement.innerHTML="<h2>"+cds.getTextLabel("attribute_search.error_no_products")+"</h2>";}
return;}
while(parentElement.hasChildNodes()){parentElement.removeChild(parentElement.lastChild);}
if(this.reverseHeaderControlsOrder){this.displayPagingControls(parentElement);this.displayHeaderControls(parentElement);}else{this.displayHeaderControls(parentElement);this.displayPagingControls(parentElement);}
table=document.createElement("table");table.setAttribute("id","cds-attribute-search-table");parentElement.appendChild(table);this.displayHeader(table);this.displayRows(table);this.displayPagingControls(parentElement);for(i=0;i<this.attributes.length;i++){a=this.attributes[i];if(a.toolTip){jQuery("#cds-attribute-label-"+a.id).tooltip({content:a.toolTip});}}};this.displayHeaderControls=function(parent){var startPage,endPage,rowsPerPage,container,i,div,ddiv,anchor,button,select,option;container=document.createElement("div");container.setAttribute("id","cds-attribute-search-table-header");parent.appendChild(container);div=document.createElement("div");div.setAttribute("id","cds-attribute-search-table-controls-buttons");container.appendChild(div);if(this.compareCart){button=document.createElement("button");button.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.compare_button_text")));button.onclick=function(){cds.attributeSearchTable.handleCompareProducts();return false;};div.appendChild(button);}
button=document.createElement("button");button.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.reset_button_text")));button.onclick=function(){cds.attributeSearchTable.handleResetAll();return false;};div.appendChild(button);if(this.displayAdvancedSearch){button=document.createElement("button");button.className="advanced-search-button";button.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.advanced_search_button_text")));button.onclick=function(){cds.attributeSearchTable.handleChooseAttributes();return false;};div.appendChild(button);}
div=document.createElement("div");div.className="record-count-select-container";div.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.record_count_select_label")));parent.appendChild(div);select=document.createElement("select");select.onchange=function(){cds.attributeSearchTable.handleChangeRowsPerPage(this);return false;};div.appendChild(select);option=document.createElement("option");option.appendChild(document.createTextNode("15"));if(this.rowsPerPage===15){option.setAttribute("selected","selected");}
select.appendChild(option);option=document.createElement("option");option.appendChild(document.createTextNode("25"));if(this.rowsPerPage===25){option.setAttribute("selected","selected");}
select.appendChild(option);option=document.createElement("option");option.appendChild(document.createTextNode("50"));if(this.rowsPerPage===50){option.setAttribute("selected","selected");}
select.appendChild(option);option=document.createElement("option");option.appendChild(document.createTextNode("100"));if(this.rowsPerPage===100){option.setAttribute("selected","selected");}
select.appendChild(option);option=document.createElement("option");option.appendChild(document.createTextNode("250"));if(this.rowsPerPage===250){option.setAttribute("selected","selected");}
select.appendChild(option);};this.displayPagingControls=function(parent){var startPage,endPage,rowsPerPage,container,i,div,anchor,button;container=document.createElement("div");container.className="cds-attribute-search-table-paging";parent.appendChild(container);div=document.createElement("div");div.className="cds-attribute-search-table-paging-count";div.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.record_count_text").replace(/%start-row%/g,this.startRow+1).replace(/%end-row%/g,this.endRow+1).replace(/%row-count%/g,this.allRowsCount)));container.appendChild(div);div=document.createElement("div");div.className="cds-attribute-search-table-paging-page";container.appendChild(div);div.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.record_page_text")));if(this.page>0){anchor=document.createElement("a");anchor.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.record_page_previous_text")));anchor.setAttribute("href","#");anchor.onclick=function(){cds.attributeSearchTable.handleChangePage(cds.attributeSearchTable.page-1);return false;};div.appendChild(anchor);div.appendChild(document.createTextNode(" "));}
startPage=this.page-2;if(startPage<0){startPage=0;}
endPage=startPage+4;if(this.endRow>=(this.allRowsCount-1)){endPage=this.page;}else{rowsPerPage=this.endRow-this.startRow+1;if(endPage*rowsPerPage>=this.allRowsCount){endPage=Math.floor(this.allRowsCount/rowsPerPage);}}
for(i=startPage;i<=endPage;i++){if(i>startPage){div.appendChild(document.createTextNode(" "));}
if(i===this.page){div.appendChild(document.createTextNode(i+1));}else{anchor=document.createElement("a");anchor.appendChild(document.createTextNode(i+1));anchor.setAttribute("href","#");anchor.page=i;anchor.onclick=function(){cds.attributeSearchTable.handleChangePage(this.page);return false;};div.appendChild(anchor);}}
if(this.endRow<(this.allRowsCount-1)){div.appendChild(document.createTextNode(" "));anchor=document.createElement("a");anchor.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.record_page_next_text")));anchor.setAttribute("href","#");anchor.onclick=function(){cds.attributeSearchTable.handleChangePage(cds.attributeSearchTable.page+1);return false;};div.appendChild(anchor);}};this.displayHeader=function(parent){var thead,tr,td,div,inp,sel,opt,anchor,i,j,a,s,dv;thead=document.createElement("thead");parent.appendChild(thead);tr=document.createElement("tr");thead.appendChild(tr);for(i=0;i<this.attributes.length;i++){a=this.attributes[i];if(a.visible){td=document.createElement("td");if(!a.searchable){td.setAttribute("rowSpan",5);}
if(a.id==="_productId"||a.id==="_label"){s=cds.getTextLabel("attribute_search.product_column_label");}else if(a.id==="_description"){s=cds.getTextLabel("attribute_search.description_column_label");}else if(a.id==="_thumbnailURL"){s=cds.getTextLabel("attribute_search.image_column_label");}else{s=a.label;}
if(!s){s=a.id;}
if(this.unit==="metric"&&a.metricDefaultUnit){s+=" ("+a.metricDefaultUnit+")";}else if(this.unit==="english"&&a.englishDefaultUnit){s+=" ("+a.englishDefaultUnit+")";}else if(a.persistedUnit){s+=" ("+a.persistedUnit+")";}
td.appendChild(document.createTextNode(s));if(a.toolTip){td.className="has-tooltip";td.setAttribute("id","cds-attribute-label-"+a.id);td.setAttribute("title","tooltip");}
if(i===1&&this.compareCart){div=document.createElement("div");div.className="info";div.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.compare_product_limit_text").replace(/%count%/g,this.compareCart.getMaxProducts())));td.appendChild(div);}else{}
tr.appendChild(td);}}
tr=document.createElement("tr");thead.appendChild(tr);for(i=0;i<this.attributes.length;i++){a=this.attributes[i];if(a.visible&&a.searchable){td=document.createElement("td");f=this.filter[a.id];dv=this.distinctValues[i];if(f){inp=document.createElement("input");inp.setAttribute("type","text");inp.readOnly="readonly";if(!f.exact){inp.setAttribute("size",("None".length+1));inp.setAttribute("value",this.getDisplayValue(a,cds.getTextLabel("attribute_search.attribute_select_none_text")));}else{inp.setAttribute("size",(f.exact.length+1));inp.setAttribute("value",this.getDisplayValue(a,f.exact));}
td.appendChild(inp);}else{sel=document.createElement("select");sel.colno=i;sel.onchange=function(){cds.attributeSearchTable.handleSelectAttributeValue(this,this.colno);return false;};opt=document.createElement("option");opt.setAttribute("value","all");opt.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.attribute_select_default_text")));opt.setAttribute("selected","selected");sel.appendChild(opt);for(j=0;j<dv.length;j++){opt=document.createElement("option");if(dv[j]===null){opt.setAttribute("value","none");opt.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.attribute_select_none_text")));}else{opt.setAttribute("value",dv[j]);opt.appendChild(document.createTextNode(this.getDisplayValue(a,dv[j])));}
sel.appendChild(opt);}
td.appendChild(sel);}
tr.appendChild(td);}}
tr=document.createElement("tr");thead.appendChild(tr);for(i=0;i<this.attributes.length;i++){a=this.attributes[i];if(a.visible&&a.searchable){td=document.createElement("td");if(a.rangeSearchable&&a.dataType!=="fraction"){inp=document.createElement("input");inp.setAttribute("type","text");inp.setAttribute("size",7);if(this.filter[a.id]&&this.filter[a.id].min){inp.setAttribute("value",this.getDisplayValue(a,this.filter[a.id].min));}else{inp.setAttribute("value",cds.getTextLabel("attribute_search.range_min_input_box_text"));}
inp.colno=i;inp.onfocus=function(){this.select();}
inp.onkeypress=function(e){cds.attributeSearchTable.handleMinKeypress(this,this.colno,e);};inp.onchange=function(){cds.attributeSearchTable.handleMinAttributeValue(this,this.colno);return false;};td.appendChild(inp);}
tr.appendChild(td);}}
tr=document.createElement("tr");thead.appendChild(tr);for(i=0;i<this.attributes.length;i++){a=this.attributes[i];if(a.visible&&a.searchable){td=document.createElement("td");if(a.rangeSearchable&&a.dataType!=="fraction"){inp=document.createElement("input");inp.setAttribute("type","text");inp.setAttribute("size",7);if(this.filter[a.id]&&this.filter[a.id].max){inp.setAttribute("value",this.getDisplayValue(a,this.filter[a.id].max));}else{inp.setAttribute("value",cds.getTextLabel("attribute_search.range_max_input_box_text"));}
inp.colno=i;inp.onfocus=function(){this.select();}
inp.onkeypress=function(e){cds.attributeSearchTable.handleMaxKeypress(this,this.colno,e);};inp.onchange=function(){cds.attributeSearchTable.handleMaxAttributeValue(this,this.colno);return false;};td.appendChild(inp);}
tr.appendChild(td);}}
tr=document.createElement("tr");thead.appendChild(tr);for(i=0;i<this.attributes.length;i++){a=this.attributes[i];if(a.visible&&a.searchable){td=document.createElement("td");if(this.filter[a.id]){anchor=document.createElement("a");anchor.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.reset_link_text")));anchor.setAttribute("href","#");anchor.colno=i;anchor.onclick=function(){cds.attributeSearchTable.handleResetAttributeValue(this.colno);return false;};td.appendChild(anchor);td.appendChild(document.createTextNode(" "));}
anchor=document.createElement("a");anchor.appendChild(document.createTextNode(cds.getTextLabel("attribute_search.sort_link_text")));if(this.sortAttribute!==a.id){anchor.className="norm";}
anchor.setAttribute("href","#");anchor.colno=i;anchor.onclick=function(){cds.attributeSearchTable.handleSortAttribute(this.colno);return false;};td.appendChild(anchor);tr.appendChild(td);}}};this.displayRows=function(parent){var tbody,tr,td,anchor,inp,img,row,a,i,j;tbody=document.createElement("tbody");parent.appendChild(tbody);for(i=0;i<this.rows.length;i++){row=this.rows[i];tr=document.createElement("tr");if(i%2!==0){tr.className="odd-row";}
tr.onmouseover=function(){cds.attributeSearchTable.handleMouseOverRow(this);return false;};tr.onmouseout=function(){cds.attributeSearchTable.handleMouseOutRow(this);return false;};tbody.appendChild(tr);for(j=0;j<this.attributes.length;j++){a=this.attributes[j];if(a.visible){td=document.createElement("td");if(j===1){td.className="nowrap";if(this.compareCart){inp=document.createElement("input");inp.setAttribute("type","checkbox");inp.rowno=i;inp.onclick=function(){cds.attributeSearchTable.handleSelectRow(this,this.rowno);return true;};td.appendChild(inp);if(this.compareCart.hasProduct(this.rows[i][0])){inp.setAttribute("checked","checked");}}
anchor=document.createElement("a");anchor.appendChild(document.createTextNode(row[j]));anchor.setAttribute("href",this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getDataDomain())).replace(/%CATEGORY%/g,encodeURIComponent(this.category)).replace(/%PRODUCT%/g,encodeURIComponent(row[0])).replace(/%PRODUCT_CATEGORY%/g,encodeURIComponent(row[2])));td.appendChild(anchor);td.appendChild(document.createTextNode(" "));}else{if(a.id==="_thumbnailURL"&&row[j]){img=document.createElement("img");td.appendChild(img);img.setAttribute("src",row[j]);}else if(a.dataType==="attachment"){anchor=document.createElement("a");td.appendChild(anchor);anchor.appendChild(document.createTextNode(a.label));anchor.setAttribute("href",row[j]);}else{td.appendChild(document.createTextNode(this.getDisplayValue(a,row[j])));}}
tr.appendChild(td);}
tbody.appendChild(tr);}}};})(),CADRequester:new(function(){this.debug=false;this.initialized=false;this.product=null;this.productLabel=null;this.cadResultFileName=null;this.parameters=null;this.preventParameters=null;this.componentPrefix=null;this.cadAvailable=false;this.cadDownloadAvailable=false;this.cad3DViewAvailable=false;this.cad2DViewAvailable=false;this.availableFormats=null;this.viewFormat3D=null;this.viewFormat2D=null;this.viewObjStaticURL=null;this.view3DStaticURL=null;this.view2DStaticURL=null;this.authenticatedDownload=null;this.authenticatedView=null;this.containerElementId=null;this.formatSelectElementId=null;this.downloadButtonElementId=null;this.view2DButtonElementId=null;this.view3DButtonElementId=null;this.staticView3DElementId=null;this.objViewerElementId=null;this.webglViewerElementId=null;this.webglIconsElementId=null;this.objViewer=null;this.webglViewer=null;this.dialogElementId=null;this.originalReferrer=null;this.attributes=null;this.notes=null;this.noGoogleJQuery=false;this.downloadInProgress=false;this.generatingDialog=null;this.resultCADUrl=null;this.resultCADFormat=null;this.ms4Environment=null;this.attachmentFormat=null;this.thankYouURL=null;this.useCDSdialogsCad=false;this.useStaticCADIfAvailable=false;this.email=null;this.fname=null;this.lname=null;this.company=null;this.address1=null;this.address2=null;this.address3=null;this.city=null;this.country=null;this.state=null;this.zip=null;this.phone=null;this.fax=null;this.agreetos=null;this.setDomain=function(domain){cds.setDomain(domain);};this.setProduct=function(product){this.product=product;};this.setProductLabel=function(productLabel){this.productLabel=productLabel;};this.setCADResultFileName=function(cadResultFileName){this.cadResultFileName=cadResultFileName.replace(/[^a-zA-Z0-9\-_]/g,"_");if(this.cadResultFileName.length>31){this.cadResultFileName=this.cadResultFileName.substring(0,31);}};this.setParameters=function(parameters){this.parameters=parameters;};this.addParameter=function(name,value,type){var i,found;if(!this.parameters){this.parameters=[];}
found=false;for(i=0;i<this.parameters.length;i++){if(this.parameters[i].name===name){this.parameters[i].type=type;this.parameters[i].value=value;found=true;break;}}
if(!found){this.parameters.push({"name":name,"type":type,"value":value});}
this.useStaticCADIfAvailable=false;};this.listParameters=function(){var s,i;if(!this.parameters||!this.parameters.length){return"empty";}
s="";for(i=0;i<this.parameters.length;i++){if(i>0){s+=", ";}
s+=this.parameters[i].name+"("+this.parameters[i].type+")="+this.parameters[i].value;}
return s;};this.setPreventParameters=function(preventParameters){this.preventParameters=preventParameters;};this.addPreventParameter=function(name){if(!this.preventParameters){this.preventParameters=[];}
this.preventParameters.push(name);};this.addNote=function(key,url){if(!this.notes){this.notes=[];}
this.notes.push({"key":key,"url":url});};this.setComponentPrefix=function(componentPrefix){this.componentPrefix=componentPrefix;};this.setCADAvailable=function(cadAvailable){this.cadAvailable=cadAvailable;};this.setCADDownloadAvailable=function(cadDownloadAvailable){this.cadDownloadAvailable=cadDownloadAvailable;}
this.setCAD3DViewAvailable=function(cad3DViewAvailable){this.cad3DViewAvailable=cad3DViewAvailable;}
this.setCAD2DViewAvailable=function(cad2DViewAvailable){this.cad2DViewAvailable=cad2DViewAvailable;}
this.setAvailableFormats=function(availableFormats){this.availableFormats=availableFormats;};this.setViewFormat3D=function(viewFormat3D){this.viewFormat3D=viewFormat3D;};this.setViewFormat2D=function(viewFormat2D){this.viewFormat2D=viewFormat2D;};this.setView3DStaticURL=function(view3DStaticURL){this.view3DStaticURL=view3DStaticURL;};this.setView2DStaticURL=function(view2DStaticURL){this.view2DStaticURL=view2DStaticURL;};this.setResultCADUrl=function(resultCADUrl){this.resultCADUrl=resultCADUrl;};this.setContainerElementId=function(containerElementId){this.containerElementId=containerElementId;};this.setFormatSelectElementId=function(formatSelectElementId){this.formatSelectElementId=formatSelectElementId;};this.setDownloadButtonElementId=function(downloadButtonElementId){this.downloadButtonElementId=downloadButtonElementId;};this.setView2DButtonElementId=function(view2DButtonElementId){this.view2DButtonElementId=view2DButtonElementId;};this.setView3DButtonElementId=function(view3DButtonElementId){this.view3DButtonElementId=view3DButtonElementId;};this.setStaticView3DElementId=function(staticView3DElementId){this.staticView3DElementId=staticView3DElementId;this.objViewerElementId=staticView3DElementId;};this.setObjViewerElementId=function(objViewerElementId){this.objViewerElementId=objViewerElementId;}
this.setDialogElementId=function(dialogElementId){this.dialogElementId=dialogElementId;};this.setOriginalReferrer=function(originalReferrer){this.originalReferrer=originalReferrer;}
this.setAttributes=function(attributes){this.attributes=attributes;}
this.setServerURL=function(serverURL){cds.setRemoteServerBaseURL(serverURL);};this.getProduct=function(){return this.product;};this.getProductLabel=function(){return this.productLabel;};this.getCADResultFileName=function(){return this.cadResultFileName;};this.getParameters=function(){return this.parameters;}
this.printParameters=function(){var i,a,s="";for(i=0;i<this.parameters.length;i++){if(i>0){s+="\n";}
a=this.parameters[i];s+=a.name+" ("+a.type+"): "+a.value;}
alert(s);}
this.getNotes=function(){return this.notes;}
this.getPreventParameters=function(){return this.preventParameters;}
this.getComponentPrefix=function(){return this.componentPrefix;}
this.isCADAvailable=function(){return this.cadAvailable;};this.isCADDownloadAvailable=function(){return this.cadDownloadAvailable;}
this.isCAD3DViewAvailable=function(){return this.cad3DViewAvailable;}
this.isCAD2DViewAvailable=function(){return this.cad2DViewAvailable;}
this.getAvailableFormats=function(){return this.availableFormats;};this.getViewFormat3D=function(){return this.viewFormat3D;};this.getViewFormat2D=function(){return this.viewFormat2D;};this.getView3DStaticURL=function(){return this.view3DStaticURL};this.getView2DStaticURL=function(){return this.view2DStaticURL};this.getresultCADUrl=function(){return this.resultCADUrl;};this.getContainerElementId=function(){return this.containerElementId;};this.getFormatSelectElementId=function(){return this.formatSelectElementId;}
this.getDownloadButtonElementId=function(){return this.downloadButtonElementId;}
this.getView2DButtonElementId=function(){return this.view2DButtonElementId;}
this.getView3DButtonElementId=function(){return this.view3DButtonElementId;}
this.getStaticView3DElementId=function(){return this.staticView3DElementId;}
this.getServerURL=function(){return cds.remoteServerBaseURL;};this.getOriginalReferrer=function(){return this.originalReferrer;}
this.getAttributes=function(){return this.attributes;}
this.isDownloadInProgress=function(){return this.downloadInProgress;};this.hasStatic3DView=function(){return typeof this.view3DStaticURL==="string"&&this.view3DStaticURL.length>0;};this.isViewRequest=function(format){return format===this.viewFormat3D||format===this.viewFormat2D;};this.load=function(){var u,o={d:cds.getDataDomain(),id:this.product};u=cds.getUser();if(u){o["cds-user"]=u;}else{if(this.email!==null){o["cds-user"]=this.email;}
if(this.fname!==null){o["cds-fname"]=this.fname;}
if(this.lname!==null){o["cds-lname"]=this.lname;}
if(this.company!==null){o["cds-company"]=this.company;}
if(this.address1!==null){o["cds-address1"]=this.address1;}
if(this.address2!==null){o["cds-address2"]=this.address2;}
if(this.address3!==null){o["cds-address3"]=this.address3;}
if(this.city!==null){o["cds-city"]=this.city;}
if(this.country!==null){o["cds-country"]=this.country;}
if(this.state!==null){o["cds-state"]=this.state;}
if(this.zip!==null){o["cds-zip"]=this.zip;}
if(this.phone!==null){o["cds-phone"]=this.phone;}
if(this.fax!==null){o["cds-fax"]=this.fax;}
if(this.agreetos!==null){o["cds-agree-tos"]=this.agreetos;}}
if(cds.getTemplateDomain()!==cds.getDataDomain()){o["td"]=cds.getTemplateDomain();}
if(this.originalReferrer){o["oref"]=this.originalReferrer;}
cds.loadXHR("GET",cds.remoteServerBaseURL+"/cad",o,function(data){var i,j,a,v,vv,found;let self=cds.CADRequester;if(data.error){self.cadAvailable=false;self.cadDownloadAvailable=false;self.cad3DViewAvailable=false;self.cad2DViewAvailable=false;self.view3DStaticURL=null;self.view2DStaticURL=null;if(typeof cdsHandlePreInitCAD==="function"){cdsHandlePreInitCAD();}}else{self.cadAvailable=data.cadAvailable;self.cadDownloadAvailable=data.cadDownloadAvailable;self.cad3DViewAvailable=data.cad3DViewAvailable;self.cad2DViewAvailable=data.cad2DViewAvailable;self.availableFormats=data.availableFormats;self.viewFormat3D=data.viewFormat3D;self.viewFormat2D=data.viewFormat2D;self.viewObjStaticURL=data.viewObjStaticURL;self.view3DStaticURL=data.view3DStaticURL;self.view2DStaticURL=data.view2DStaticURL;self.authenticatedDownload=data.authenticatedDownload;self.authenticatedView=data.authenticatedView;self.attributes=data.attributes||[];if(data.attributes){for(i=0;i<data.attributes.length;i++){a=data.attributes[i];v=(data.attributeValues.length>=i+1)&&data.attributeValues[i];if(v&&a.cadParameterName&&a.cadDataType){if(a.dataType==="range"){vv=v.split("|");if(vv.length>=3){self.addParameter(a.cadParameterName,vv[2],a.cadDataType);self.attributes[i].value=vv[2];}}else if(a.dataType==="list"){vv=v.split("|");found=false;for(j=0;j<vv.length-1;j++){if(vv[j]===vv[vv.length-1]){self.addParameter(a.cadParameterName,vv[j],a.cadDataType);self.attributes[i].value=vv[j];found=true;}}
if(!found){self.addParameter(a.cadParameterName,vv[0],a.cadDataType);self.attributes[i].value=vv[0];}}else{self.addParameter(a.cadParameterName,v,a.cadDataType);self.attributes[i].value=v;}}}}
self.init();}},function(data){console.log("Error retrieving CAD data");console.log(data);});};this.init=function(){var e,ee,i,s,format;this.useStaticCADIfAvailable=true;if(typeof cdsHandlePreInitCAD==="function"){cdsHandlePreInitCAD();}
if(this.cadAvailable){e=jQuery("#"+this.formatSelectElementId);if(e){if(!this.cadDownloadAvailable){e.hide();}else if(this.availableFormats){if(cds.isInFusion){e.hide();}else{e.empty();ee=document.createElement("option");ee.setAttribute("value","none");ee.setAttribute("selected","selected");ee.appendChild(document.createTextNode(cds.getTextLabel("product_home.download_select_default_text")));e.append(ee);for(i=0;i<this.availableFormats.length;i++){ee=document.createElement("option");ee.setAttribute("value",this.availableFormats[i].name);ee.appendChild(document.createTextNode(this.availableFormats[i].label));e.append(ee);}}}}
e=jQuery("#"+this.downloadButtonElementId);if(e&&e[0]){if(!this.cadDownloadAvailable){e.hide();}else{if(cds.isInFusion){e[0].setAttribute("type","button");e.get(0).controller=this;e.click(function(){var furl="fusion360://command=insert&file="
+encodeURIComponent("//qa.product-config.net/catalog3/cad?&d="+cds.getDataDomain()+"&id="+_cdsProductId+"&td=3dmsfusion360&stream=true")
+"&id="+encodeURIComponent("cds-cad-"+cds.getDataDomain()
+"-"+_cdsProductId);location.href=furl;});}else if(!this.initialized){e[0].setAttribute("type","button");e.get(0).controller=this;e.click(function(){var controller=jQuery(this).get(0).controller;format=jQuery("#"+controller.formatSelectElementId).find(":selected").val();if(!format||format==="none"){alert(cds.getTextLabel("product_home.error_no_download_format_selected"));return;}
if(typeof cdsHandlePreSubmitCAD==="function"){if(!cdsHandlePreSubmitCAD(format)){return;}}
controller.getCAD(format);});}}}
e=jQuery("#"+this.view3DButtonElementId);if(e&&e[0]){if(!this.cad3DViewAvailable){e.hide();}else{if(cds.isInFusion){e.hide();}else if(!this.initialized){e[0].setAttribute("type","button");e.get(0).controller=this;e.click(function(){var controller=jQuery(this).get(0).controller;controller.getCAD(controller.viewFormat3D);});}}}
e=jQuery("#"+this.view2DButtonElementId);if(e&&e[0]){if(!this.cad2DViewAvailable||(!this.view2DStaticURL&&!this.viewFormat2D)){e.hide();}else{if(cds.isInFusion){e.hide();}else if(!this.initialized){e[0].setAttribute("type","button");e.get(0).controller=this;e.click(function(){var controller=jQuery(this).get(0).controller;controller.getCAD(controller.viewFormat2D);});}}}
e=jQuery("#"+this.containerElementId);if(e&&e.css("display")==="none"){e.show();}
e=document.getElementById(this.staticView3DElementId);if(this.view3DStaticURL&&this.webglViewerElementId&&(this.viewFormat3D==="webgl"||this.viewFormat3D==="json")&&cds.isWebGLAvailable()){e=document.getElementById(this.webglViewerElementId);if(e){while(e.hasChildNodes()){if(e.lastChild.getAttribute&&e.lastChild.getAttribute("id")===this.webglIconsElementId){break;}else{e.removeChild(e.lastChild);}}
e=document.getElementById(this.webglIconsElementId);if(e){e.style.display="";}
cds.cadViewer.init(this.webglViewerElementId);cds.cadViewer.loadScene(decodeURIComponent(this.view3DStaticURL));}}else if(this.viewObjStaticURL&&this.objViewerElementId&&cds.isWebGLAvailable()){e=document.getElementById(this.objViewerElementId);if(e){s=this.viewObjStaticURL;if(s.indexOf(".obj")!==-1){s=s.substring(0,s.indexOf(".obj"));}
while(e.hasChildNodes()){e.removeChild(e.lastChild);}
e.className=e.className?e.className+" "+"cds-obj-viewer-container":"cds-obj-viewer-container";this.objViewer=new CDSViewer(this.objViewerElementId);this.objViewer.showToolbar=true;this.objViewer.Init();this.objViewer.LoadScene(s);}}else if(e&&this.view3DStaticURL){s="<object data=\""+this.view3DStaticURL+"\" type=\"application/pdf\">"
if(navigator.appName==="Microsoft Internet Explorer"){s+="<param name=\"src\" value=\""+this.view3DStaticURL+"\">"}
s+="</object>";e.innerHTML=s;e=document.getElementById(this.view3DButtonElementId);if(e){e.style.display="none";}}
if(typeof cdsHandlePostInitCAD==="function"){cdsHandlePostInitCAD();}}
this.initialized=true;};this.checkCAD=function(format){};this.getCAD=function(format,checkOnly){var u,o,i,p,a,e,v,min,max;if(cds.isInputBlocked){return;}
this.resultCADFormat=format;if((format==="obj"||format==="json"||format==="webgl")&&!cds.isWebGLAvailable()){this.resultCADFormat="pdf";if(cds.getDataDomain()==="heyco"){this.resultCADFormat="23-pdf";}}
if(typeof cdsHandlePreGetCAD==="function"){if(cdsHandlePreGetCAD()===false){return;}}
this.resultCADUrl=null;this.resultCADError=null;this.downloadInProgress=true;cds.isInputBlocked=true;o={d:cds.getDataDomain(),id:this.product,f:this.resultCADFormat};u=cds.getUser();if(u){o["cds-user"]=u;}else{if(this.email!==null){o["cds-user"]=this.email;}
if(this.fname!==null){o["cds-fname"]=this.fname;}
if(this.lname!==null){o["cds-lname"]=this.lname;}
if(this.company!==null){o["cds-company"]=this.company;}
if(this.address1!==null){o["cds-address1"]=this.address1;}
if(this.address2!==null){o["cds-address2"]=this.address2;}
if(this.address3!==null){o["cds-address3"]=this.address3;}
if(this.city!==null){o["cds-city"]=this.city;}
if(this.country!==null){o["cds-country"]=this.country;}
if(this.state!==null){o["cds-state"]=this.state;}
if(this.zip!==null){o["cds-zip"]=this.zip;}
if(this.phone!==null){o["cds-phone"]=this.phone;}
if(this.fax!==null){o["cds-fax"]=this.fax;}
if(this.agreetos!==null){o["cds-agree-tos"]=this.agreetos;}}
if(cds.getTemplateDomain()!==cds.getDataDomain()){o["td"]=cds.getTemplateDomain();}
if(this.productLabel){o["pn"]=this.productLabel;}
if(this.cadResultFileName){o["o"]=this.cadResultFileName;}
if(this.originalReferrer){o["oref"]=this.originalReferrer;}
if(this.componentPrefix){o["cprefix"]=this.componentPrefix;}
if(this.ms4Environment){o["environment"]=this.ms4Environment;}
if(this.useStaticCADIfAvailable){o["usestatic"]="true";}
let op={};if(this.parameters&&this.parameters.length>0){for(i=0;i<this.parameters.length;i++){p=this.parameters[i];if(p.name==="_FORCE_MS"){this.resultCADFormat=p.value+"-"+this.resultCADFormat;o["f"]=this.resultCADFormat;continue;}
op[p.name]=[p.value,p.type?p.type:null];}}
if(this.attributes&&this.attributes.length>0){for(i=0;i<this.attributes.length;i++){a=this.attributes[i];v=a.value;if(a.cadParameterName.indexOf("_")===0){continue;}
if(a.dataType==="range"){e=document.getElementById("cds-dv-"+a.id);if(e){v=parseFloat(e.value);if(!isNaN(v)){v=(Math.round(v*Math.pow(10,a.precision))/Math.pow(10,a.precision)).toFixed(a.precision);}}}else if(a.dataType==="list"){e=document.getElementById("cds-dv-"+a.id);if(e){v=e.options[e.selectedIndex].value;}}else if(a.dataType==="multilist"){v="";for(i=0;i<100;i++){e=document.getElementById("cds-dv-"+a.id+"-"+i);if(e){if(e.checked){if(v.length){v+=",";}
v+=e.value;}}else{break;}}}else if(a.dataType==="text"){e=document.getElementById("cds-dv-"+a.id);if(e){v=e.value;}}
op[a.cadParameterName]=[v,a.cadDataType];}}
i=0;for(p in op){o["p"+i]=p;o["v"+i]=op[p][0];if(op[p][1]){o["t"+i]=op[p][1];}
i++;}
if(this.preventParameters&&this.preventParameters.length>0){for(i=0;i<this.preventParameters.length;i++){o["r"+i]=this.preventParameters[i];}}
if(this.notes&&this.notes.length>0){for(i=0;i<this.notes.length;i++){o["note"+i]=this.notes[i].key;if(this.notes[i].url){o["note"+i+"url"]=this.notes[i].url;}}}
if(typeof cdsHandlePreGetCADRequest==="function"){o=cdsHandlePreGetCADRequest(o);}
if(checkOnly){o["checkonly"]=true;cds.loadXHR("GET",cds.remoteServerBaseURL+"/cad",o,function(data){let self=cds.CADRequester;self.downloadInProgress=false;cds.isInputBlocked=false;if(typeof cdsHandlePostCheckCADRequest==="function"){cdsHandlePostCheckCADRequest(data);}},function(data){console.log("Error retrieving CAD data");console.log(data);});}else{this.showDialogGenerating();if(this.resultCADFormat.indexOf("41-")===0){cds.loadXHR("POST",cds.remoteServerBaseURL+"/cad",o,function(data){let self=cds.CADRequester;self.downloadInProgress=false;cds.isInputBlocked=false;self.resultCADUrl=data.url;self.resultCADError=data.error;if(self.resultCADError||self.resultCADUrl.indexOf(".")!==-1){self.showDialogResults();}else{self.downloadInProgress=true;cds.isInputBlocked=true;self.waitForMS4();}},function(data){console.log("Error retrieving CAD data");console.log(data);});}else{cds.loadXHR("POST",cds.remoteServerBaseURL+"/cad",o,function(data){let self=cds.CADRequester;self.downloadInProgress=false;cds.isInputBlocked=false;self.resultCADUrl=data.url;self.resultCADError=data.error;if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(data.url)){self.waitForMS4();}else{self.showDialogResults();}},function(data){console.log("Error retrieving CAD data");console.log(data);});}}};this.waitForMS4=function(){jQuery.ajax({url:"https://www.product-config.net/visualization/service/jobs/"+this.resultCADUrl+"?callback=?",dataType:"jsonp",context:this,success:function(data){let self=cds.CADRequester;if(data["job"]["resultUrl"]||data["job"]["errorText"]){self.downloadInProgress=false;cds.isInputBlocked=false;self.resultCADError=data["job"]["errorText"];self.resultCADUrl=data["job"]["resultUrl"];self.showDialogResults();return;}else{setTimeout(function(){cds.CADRequester.waitForMS4();},1000);}}});};this.showDialogGenerating=function(){if(cds.useCDSdialogs||this.useCDSdialogsCad){if(this.generatingDialog&&this.generatingDialog.parentNode){this.generatingDialog.parentNode.removeChild(this.generatingDialog);}
if(this.dialogOverlay){this.dialogOverlay.style.display="block";}else{this.dialogOverlay=document.createElement("div");document.body.appendChild(this.dialogOverlay);this.dialogOverlay.setAttribute("id","cds-modal-overlay");}
this.generatingDialog=document.createElement("div");document.body.appendChild(this.generatingDialog);this.generatingDialog.classList.add("cds-modal-dialog");this.generatingDialog.setAttribute("id","cds-wait-dialog");let h=document.createElement("h2");this.generatingDialog.appendChild(h);h.textContent="Generating Drawing...";let p=document.createElement("p");this.generatingDialog.appendChild(p);p.textContent="The model you have requested is being generated. As soon as the model is ready, you will be given a link to download your customized model.";h=document.createElement("h4");this.generatingDialog.appendChild(h);h.setAttribute("id","cds-dialog-label-step1");let img=document.createElement("img");h.appendChild(img);img.setAttribute("id","cds-dialog-image-step1");img.setAttribute("src","https://www.product-config.net/catalog3/images/spacer.gif");h.appendChild(document.createTextNode("Queuing placement diagram request"));h=document.createElement("h4");this.generatingDialog.appendChild(h);h.setAttribute("id","cds-dialog-label-step2");img=document.createElement("img");h.appendChild(img);img.setAttribute("id","cds-dialog-image-step2");img.setAttribute("src","https://www.product-config.net/catalog3/images/spacer.gif");h.appendChild(document.createTextNode("Initializing placement diagram"));h=document.createElement("h4");this.generatingDialog.appendChild(h);h.setAttribute("id","cds-dialog-label-step3");img=document.createElement("img");h.appendChild(img);img.setAttribute("id","cds-dialog-image-step3");img.setAttribute("src","https://www.product-config.net/catalog3/images/spacer.gif");h.appendChild(document.createTextNode("Setting custom parameters"));h=document.createElement("h4");this.generatingDialog.appendChild(h);h.setAttribute("id","cds-dialog-label-step4");img=document.createElement("img");h.appendChild(img);img.setAttribute("id","cds-dialog-image-step4");img.setAttribute("src","https://www.product-config.net/catalog3/images/spacer.gif");h.appendChild(document.createTextNode("Regenerating placement diagram"));h=document.createElement("h4");this.generatingDialog.appendChild(h);h.setAttribute("id","cds-dialog-label-step5");img=document.createElement("img");h.appendChild(img);img.setAttribute("id","cds-dialog-image-step5");img.setAttribute("src","https://www.product-config.net/catalog3/images/spacer.gif");h.appendChild(document.createTextNode("Saving diagram"));h=document.createElement("h4");this.generatingDialog.appendChild(h);h.setAttribute("id","cds-dialog-label-step6");img=document.createElement("img");h.appendChild(img);img.setAttribute("id","cds-dialog-image-step6");img.setAttribute("src","https://www.product-config.net/catalog3/images/spacer.gif");h.appendChild(document.createTextNode("Generation complete!"));let a=document.createElement("a");h.appendChild(a);a.setAttribute("id","cds-dialog-download-link");a.setAttribute("href","");a.setAttribute("target","_blank");a.style.display="none";a.textContent="Click Here to Download";a.onclick=function(){let self=cds.CADRequester;if(self.generatingDialog){self.generatingDialog.parentNode.removeChild(self.generatingDialog);}
if(self.dialogOverlay){self.dialogOverlay.style.display="none";}}
let progress=document.createElement("progress");this.generatingDialog.appendChild(progress);progress.setAttribute("id","cds-dialog-progress");progress.setAttribute("max","100");progress.setAttribute("value","0");this.showDialogWaiting(0);}else{var e;if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML="<img src='"+cds.remoteServerBaseURL
+"/images/progress_animation.gif' />"
+"<div>"+cds.getTextLabel("product_home.cad_generating_dialog_text")+"</div>";}}else{this.generatingDialog=jQuery("<div id='cds-cad-request-dialog'></div>").html("<img src='"+cds.remoteServerBaseURL+"/images/progress_animation.gif' />"+"<div>"+cds.getTextLabel("product_home.cad_generating_dialog_text")+"</div>").dialog({title:cds.getTextLabel("product_home.cad_generating_dialog_title"),width:400,modal:true,resizable:false,beforeClose:function(event,ui){return!cds.CADRequester.downloadInProgress;}});}}};this.showDialogWaiting=function(count){if(count===0){document.getElementById("cds-dialog-label-step1").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step2").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step3").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step4").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step5").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step6").classList.remove("cds-selected");document.getElementById("cds-dialog-progress").setAttribute("value","0");document.getElementById("cds-dialog-label-step1").classList.add("cds-selected");document.getElementById("cds-dialog-image-step1").setAttribute("src","https://www.product-config.net/catalog3/images/globewait.gif");}else if(count===1){document.getElementById("cds-dialog-label-step1").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step2").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step3").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step4").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step5").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step6").classList.remove("cds-selected");document.getElementById("cds-dialog-progress").setAttribute("value","20");document.getElementById("cds-dialog-label-step1").classList.add("cds-completed");document.getElementById("cds-dialog-label-step2").classList.add("cds-selected");document.getElementById("cds-dialog-image-step1").setAttribute("src","https://www.product-config.net/catalog3/images/checkmark.png");document.getElementById("cds-dialog-image-step2").setAttribute("src","https://www.product-config.net/catalog3/images/globewait.gif");}else if(count===8){document.getElementById("cds-dialog-label-step1").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step2").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step3").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step4").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step5").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step6").classList.remove("cds-selected");document.getElementById("cds-dialog-progress").setAttribute("value","40");document.getElementById("cds-dialog-label-step2").classList.add("cds-completed");document.getElementById("cds-dialog-label-step3").classList.add("cds-selected");document.getElementById("cds-dialog-image-step2").setAttribute("src","https://www.product-config.net/catalog3/images/checkmark.png");document.getElementById("cds-dialog-image-step3").setAttribute("src","https://www.product-config.net/catalog3/images/globewait.gif");}else if(count===13){document.getElementById("cds-dialog-label-step1").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step2").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step3").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step4").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step5").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step6").classList.remove("cds-selected");document.getElementById("cds-dialog-progress").setAttribute("value","60");document.getElementById("cds-dialog-label-step3").classList.add("cds-completed");document.getElementById("cds-dialog-label-step4").classList.add("cds-selected");document.getElementById("cds-dialog-image-step3").setAttribute("src","https://www.product-config.net/catalog3/images/checkmark.png");document.getElementById("cds-dialog-image-step4").setAttribute("src","https://www.product-config.net/catalog3/images/globewait.gif");}else if(count===22){document.getElementById("cds-dialog-label-step1").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step2").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step3").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step4").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step5").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step6").classList.remove("cds-selected");document.getElementById("cds-dialog-progress").setAttribute("value","80");document.getElementById("cds-dialog-label-step4").classList.add("cds-completed");document.getElementById("cds-dialog-label-step5").classList.add("cds-selected");document.getElementById("cds-dialog-image-step4").setAttribute("src","https://www.product-config.net/catalog3/images/checkmark.png");document.getElementById("cds-dialog-image-step5").setAttribute("src","https://www.product-config.net/catalog3/images/globewait.gif");}else if(count===-1){document.getElementById("cds-dialog-label-step1").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step2").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step3").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step4").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step5").classList.remove("cds-selected");document.getElementById("cds-dialog-label-step6").classList.remove("cds-selected");document.getElementById("cds-dialog-progress").setAttribute("value","100");document.getElementById("cds-dialog-label-step5").classList.add("cds-completed");document.getElementById("cds-dialog-label-step6").classList.add("cds-selected");document.getElementById("cds-dialog-image-step5").setAttribute("src","https://www.product-config.net/catalog3/images/checkmark.png");document.getElementById("cds-dialog-image-step6").setAttribute("src","https://www.product-config.net/catalog3/images/checkmark.png");document.getElementById("cds-dialog-download-link").style.display="";}
if(this.resultCADError){if(this.generatingDialog){this.generatingDialog.parentNode.removeChild(this.generatingDialog);}
if(this.dialogOverlay){this.dialogOverlay.style.display="none";}
alert("Error: "+this.resultCADError);}else if(this.resultCADUrl&&!this.downloadInProgress){let a=document.getElementById("cds-dialog-download-link");a.setAttribute("href",this.resultCADUrl);if(count>-1&&count<25){setTimeout(function(){cds.CADRequester.showDialogWaiting(count+1);},100);}else if(count>-1){cds.CADRequester.showDialogWaiting(-1);}}else{setTimeout(function(){cds.CADRequester.showDialogWaiting(count+1);},1000);}};this.showDialogResults=function(){if(cds.useCDSdialogs||this.useCDSdialogsCad){;}else{var s,o,remoteServerBaseURL;remoteServerBaseURL=cds.remoteServerBaseURL.replace(/^(https?)?:?\/\//,"http://");if(typeof cdsHandlePostGetCAD==="function"){cdsHandlePostGetCAD();}
let format=this.resultCADFormat;if(format.match(/^\d\d-/)){format=format.substring(3);}
s="<div>"+cds.getTextLabel("product_home.cad_complete_dialog_text")+"</div>";if(format==="pdf"||format==="23-pdf"||format==="obj"||format==="pview"||format==="json"||format==="webgl"||format==="2dpdf"||format===this.viewFormat2D||format===this.attachmentFormat){if(cds.getTemplateDomain()==="heyco"&&format===this.viewFormat2D){s+="<div><a href='"+this.resultCADUrl+"' target='cds_cad_view'>"
+"Click Here to Download Customer PDF Print</a></div>";}else if(format==="pdf"||format==="23-pdf"||format==="2dpdf"||format===this.viewFormat2D){s+="<div><a href='"+this.resultCADUrl+"' target='cds_cad_view'>"
+cds.getTextLabel("product_home.cad_complete_link_view")+"</a></div>";}else if(format==="obj"&&this.noGoogleJQuery){s+="<div><a href='"+remoteServerBaseURL+"/viewobj-ng.html?url="
+encodeURIComponent(this.resultCADUrl)+"' target='cds_cad_view'>"
+cds.getTextLabel("product_home.cad_complete_link_view")+"</a></div>";}else if(format==="obj"){s+="<div><a href='"+remoteServerBaseURL+"/viewobj.html?url="
+encodeURIComponent(this.resultCADUrl)+"' target='cds_cad_view'>"
+cds.getTextLabel("product_home.cad_complete_link_view")+"</a></div>";}else if(format==="webgl"||format==="json"){if(cds.getDataDomain()==="ni"){s+="<div><a href='"+cds.cadViewerBaseURL+"index.html?toggleinst=true&url="
+encodeURIComponent(this.resultCADUrl)+"' target='cds_cad_view'>"
+cds.getTextLabel("product_home.cad_complete_link_view")+"</a></div>";}else{s+="<div><a href='"+cds.cadViewerBaseURL+"index.html?url="
+encodeURIComponent(this.resultCADUrl)+"' target='cds_cad_view'>"
+cds.getTextLabel("product_home.cad_complete_link_view")+"</a></div>";}}else if(format===this.attachmentFormat){s+="<div><a href='"+this.resultCADUrl+"'>"
+cds.getTextLabel("product_home.cad_complete_link")
+"</a></div>";}}else{s+="<table><tr><td><img src='"+cds.remoteServerBaseURL+"/images/drag-drop.png' /></td>";if(navigator.userAgent.indexOf("ProE-Datecode")!==-1){s+="<td><div><a href='"+this.resultCADUrl+"'>"
+"Drag &amp; Drop into PTC Creo or Pro/Engineer</a></div>";s+="<div><a href='"+this.resultCADUrl+"'>"+cds.getTextLabel("product_home.cad_complete_link")
+"</a></div></td></tr></table>";}else if(this.thankYouURL!==null){s+="<td><div><a href='"+this.thankYouURL+encodeURIComponent(this.resultCADUrl)
+"' target='_blank'>"
+cds.getTextLabel("product_home.cad_complete_link_drag_drop")
+"</a></div>"
+"<div><a href='"+this.thankYouURL+encodeURIComponent(this.resultCADUrl)+"'>"
+cds.getTextLabel("product_home.cad_complete_link")
+"</a></div></td></tr></table>";}else{s+="<td><div><a href='"+this.resultCADUrl+"'>"
+cds.getTextLabel("product_home.cad_complete_link_drag_drop")
+"</a></div>";s+="<div><a href='"+this.resultCADUrl+"'>"+cds.getTextLabel("product_home.cad_complete_link")
+"</a></div></td></tr></table>";}
if(this.debug){s+="<h3>CAD Debug Information</h3>";s+="<table>";if(this.product){s+="    <tr><td>Product:</td><td>"+this.product+"</td></tr>";}
if(this.productLabel){s+="    <tr><td>Product Label:</td><td>"+this.productLabel+"</td></tr>";}
if(format){s+="    <tr><td>Format:</td><td>"+format+"</td></tr>";}
if(this.cadResultFileName){s+="    <tr><td>File Name:</td><td>"+this.cadResultFileName+"</td></tr>";}
if(this.parameters){s+="    <tr><td>Parameters:</td><td>&nbsp;</td></tr>";for(i=0;i<this.parameters.length;i++){s+="    <tr><td>&nbsp;</td><td>"+this.parameters[i].name+", "
+this.parameters[i].value+"</td></tr>";}}
if(this.preventParameters){s+="    <tr><td>Prevent Parameters:</td><td>"+this.preventParameters+"</td></tr>";}
if(this.componentPrefix){s+="    <tr><td>Component Prefix:</td><td>"+this.componentPrefix+"</td></tr>";}
if(this.notes){s+="    <tr><td>Notes:</td><td>"+this.notes+"</td></tr>";}
s+="</table>";}}
if(this.resultCADError==="authentication required"){this.generatingDialog.dialog("close");if(cds.authenticationManager.isInitialLoginAttempt){cds.authenticationManager.login(cds.getTemplateDomain(),"cad");}else{cds.authenticationManager.login(cds.getTemplateDomain(),"cad",true);}
return;}else if(this.resultCADError==="access denied"||this.resultCADError==="authentication error"){this.generatingDialog.dialog("close");cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"cad",true);return;}else if(this.resultCADError==="restricted access"&&(cds.getDataDomain()==="raf"||cds.getDataDomain()==="asm"||cds.getDataDomain()==="century")){if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML="You have exceeded the maximum number of downloads per day. Please try again later.";}}else{this.generatingDialog.html("You have exceeded the maximum number of downloads per day. Please try again later.").dialog("option","title",cds.getTextLabel("product_home.cad_error_title"));}}else if(this.resultCADUrl){if(cds.dataDomainId==='amc'&&format==="datasheet"){location.href=this.resultCADUrl;}
if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML=s;}}else{this.generatingDialog.html(s).dialog("option","title",cds.getTextLabel("product_home.cad_complete_dialog_title"));}}else{if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML=cds.getTextLabel("product_home.cad_error_text");}}else{this.generatingDialog.html(cds.getTextLabel("product_home.cad_error_text")).dialog("option","title",cds.getTextLabel("product_home.cad_error_title"));}}}};this.redirectToModel=function(){if(this.generatingDialog){this.generatingDialog.dialog("close");}
if(this.resultCADFormat==="pview"){window.open(cds.remoteServerBaseURL+"/viewpvl.html?ms="
+encodeURIComponent(this.resultCADUrl),"cad_view");}else if(this.resultCADFormat==="edrawings"){window.open(cds.remoteServerBaseURL+"/viewedr.html?ms="
+encodeURIComponent(this.resultCADUrl),"cad_view");}else if(this.resultCADFormat==="pdf"||this.resultCADFormat==="23-pdf"){window.open(this.resultCADUrl,"cad_view");}else{location.href=this.resultCADUrl;}};this.loadInlineCADDialog=function(domain,pid){if(cds.hasOwnProperty("facetedSearch")){cds.facetedSearch.closePopupFacet();}
let div=document.getElementById("cds-inline-cad-overlay");if(!div){div=document.createElement("div");document.body.appendChild(div);div.setAttribute("id","cds-inline-cad-overlay");div.onclick=function(){cds.CADRequester.hideInlineCADDialog();};}
let container=document.getElementById("cds-inline-cad-container");if(!container){container=document.createElement("div");document.body.appendChild(container);container.setAttribute("id","cds-inline-cad-container");}else{while(container.hasChildNodes()){container.removeChild(container.lastChild);}}
this.renderInlineCADDialog(container,domain,pid);cds.CADRequester.setDomain(domain);cds.CADRequester.setProduct(pid);cds.loadXHR("GET",cds.remoteServerBaseURL+"/cad",{"d":domain,"id":pid},function(data){if(data.cadAvailable){cds.CADRequester.setContainerElementId("cds-inline-cad-controls");cds.CADRequester.setFormatSelectElementId("cds-cad-download-formats");cds.CADRequester.setDownloadButtonElementId("cds-cad-download-button");cds.CADRequester.setView2DButtonElementId("cds-cad-view-2D-button");cds.CADRequester.setView3DButtonElementId("cds-cad-view-3D-button");if(data.hasOwnProperty("view3DStaticURL")&&data["viewFormat3D"]==="json"){cds.CADRequester.webglViewerElementId="cds-inline-cad-viewer-container";document.getElementById("cds-inline-cad-viewer-container").style.display="block";}
document.getElementById("cds-inline-cad-container").style.display="block";document.getElementById("cds-inline-cad-overlay").style.display="block";if(data.hasOwnProperty("attributes")&&data.attributes.length>0){let container=document.getElementById("cds-inline-cad-attributes")
for(let i=0;i<data.attributes.length;i++){let a=data.attributes[i];let v=data.attributeValues[i];if(a.hasOwnProperty("cadParameterName")&&a.hasOwnProperty("dataType")&&(a.dataType==="range"||a.dataType==="list")&&v!==null){v=v.split("\|");let div=document.createElement("div");container.appendChild(div);if(a.dataType==="range"&&v.length>=2){let label=document.createElement("label");div.appendChild(label);label.textContent=a.label+" ("+v[0]+" to "+v[1]+")";let input=document.createElement("input");div.appendChild(input);input.setAttribute("id","cds-dv-"+a.id);input.setAttribute("data-id",a.id);input.setAttribute("data-min",v[0]);input.setAttribute("data-max",v[1]);input.setAttribute("data-prec",a.precision);input.setAttribute("data-cad",a.cadParameterName);if(v.length>2){input.value=v[2];input.setAttribute("data-default",v[2]);}else{input.value=v[0];input.setAttribute("data-default",v[0]);}
input.onchange=function(){let id=this.getAttribute("data-id");let v=parseFloat(this.value);let min=parseFloat(this.getAttribute("data-min"));let max=parseFloat(this.getAttribute("data-max"));let precision=parseInt(this.getAttribute("data-prec"));if(isNaN(v)||v<min||v>max){alert("Please enter a value between "+min+" and "+max+".");e.value=this.getAttribute("data-default");e.focus();}else{v=(Math.round(v*Math.pow(10,precision))/Math.pow(10,precision)).toFixed(precision);this.value=v;}
cds.CADRequester.addParameter(this.getAttribute("data-cad"),v);};}else{let label=document.createElement("label");div.appendChild(label);label.textContent=a.label;let select=document.createElement("select");div.appendChild(select);for(let j=0;j<v.length;j++){let option=document.createElement("option");select.appendChild(option);option.textContent=v[j];option.value=v[j];}
select.setAttribute("id","cds-dv-"+a.id);select.setAttribute("data-id",a.id);select.setAttribute("data-cad",a.cadParameterName);select.onchange=function(){let v=this.options[this.selectedIndex].value;if(v){cds.CADRequester.addParameter(this.getAttribute("data-cad"),v);}};}}}}
cds.CADRequester.initialized=false;cds.CADRequester.load();}},function(data){console.log("Error retrieving data for CAD dialog");console.log(data);});};this.renderInlineCADDialog=function(container,domain,pid){let h=document.createElement("h3");container.appendChild(h);h.textContent="DRAWINGS & CAD";let i=document.createElement("i");container.appendChild(i);i.setAttribute("class","material-icons");i.textContent="highlight_off";i.onclick=function(){cds.CADRequester.hideInlineCADDialog();};div=document.createElement("div");container.appendChild(div);div.setAttribute("id","cds-inline-cad-icon-container");let img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/solid.png");img.onclick=function(){cds.cadViewer.setRenderMode(cds.cadViewer.MODE_SHADED);}
img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/transparent.png");img.onclick=function(){cds.cadViewer.setRenderMode(cds.cadViewer.MODE_TRANSPARENT);}
img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/camera_perspective.png");img.onclick=function(){cds.cadViewer.setOrientation(cds.cadViewer.VIEW_ISOMETRIC);}
img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/camera_top.png");img.onclick=function(){cds.cadViewer.setOrientation(cds.cadViewer.VIEW_TOP);}
img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/camera_left.png");img.onclick=function(){cds.cadViewer.setOrientation(cds.cadViewer.VIEW_LEFT);}
img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/camera_bottom.png");img.onclick=function(){cds.cadViewer.setOrientation(cds.cadViewer.VIEW_BOTTOM);}
img=document.createElement("img");div.appendChild(img);img.setAttribute("src",""+cds.cadViewerBaseURL+"images/icons/camera_right.png");img.onclick=function(){cds.cadViewer.setOrientation(cds.cadViewer.VIEW_RIGHT);}
div=document.createElement("div");container.appendChild(div);div.setAttribute("id","cds-inline-cad-viewer-container");div.style.display="none";h=document.createElement("h4");container.appendChild(h);h.textContent="CAD FILE DOWNLOADS";div=document.createElement("div");container.appendChild(div);div.setAttribute("id","cds-inline-cad-attributes");let select=document.createElement("select");container.appendChild(select);select.setAttribute("id","cds-cad-download-formats");let option=document.createElement("option");select.appendChild(option);option.setAttribute("value","none");option.textContent="Choose a CAD format";div=document.createElement("div");container.appendChild(div);div.setAttribute("id","cds-inline-cad-controls");let button=document.createElement("button");div.appendChild(button);button.setAttribute("id","cds-cad-download-button");button.style.float="left";button.textContent="Download CAD";button=document.createElement("button");div.appendChild(button);button.setAttribute("id","cds-cad-view-3D-button");button.style.float="right";button.textContent="View CAD";div=document.createElement("div");container.appendChild(div);div.setAttribute("id","cds-inline-cad-controls");button=document.createElement("button");div.appendChild(button);button.setAttribute("id","cds-cad-view-2D-button");button.style.float="left";button.textContent="View 2D Drawing";button=document.createElement("button");div.appendChild(button);button.setAttribute("id","cds-inline-cad-exit-button");button.style.float="right";button.textContent="Exit";button.onclick=function(){cds.CADRequester.hideInlineCADDialog();};};this.hideInlineCADDialog=function(domain,pid){document.getElementById("cds-inline-cad-container").style.display="none";document.getElementById("cds-inline-cad-overlay").style.display="none";};})(),cart:new(function(){this.hasCart=false;this.parentElementId=null;this.items=[];this.displayAfterAdd=false;this.dialog=null;this.submitInProgress=false;this.error=null;this.currentProduct=null;this.currentLabel=null;this.currentDescription=null;this.currentQuantity=0;this.currentURL=null;this.currentImage=null;this.currentDisplay=false;this.currentDisplayURL=null;this.customAttributes=null;this.thankYouURL=null;this.bypassThankYou=false;this.cartURLTemplate="?c=cart";this.setDomain=function(domain){cds.setDomain(domain);};this.setParentElementId=function(parentElementId){this.parentElementId=parentElementId;};this.setServerURL=function(serverURL){cds.setRemoteServerBaseURL(serverURL);};this.addCustomAttribute=function(key,value){if(this.customAttributes===null){this.customAttributes={};}
this.customAttributes[key]=value;}
this.getParentElementId=function(){return this.parentElementId;};this.getServerURL=function(){return cds.remoteServerBaseURL;};this.handleRemove=function(product){if(product){this.currentProduct=product;}
this.addProduct(this.currentProduct,null,null,0,null,null,true);setTimeout(function(){if(typeof cdsHandleRemoveCartItem==="function"){cdsHandleRemoveCartItem(product);}},100);};this.handleUpdate=function(){var i,o,e,u,ps="",qs="",v1s="",v2s="",v3s="";for(i=0;i<this.items.length;i++){p=this.items[i].productId;e=document.getElementById("cds-cart-quantity-"+this.items[i].productId);if(qs.length>0){qs+="|";}
if(e&&e.value){qs+=e.value;}else{qs+=0;}
e=document.getElementById("cds-cart-variable1-"+this.items[i].productId);if(e){if(e.tagName.toUpperCase()==="INPUT"){v=e.value;}else if(e.tagName.toUpperCase()==="SELECT"){v=e.options[e.selectedIndex].value;}
if(v1s.length>0){v1s+="|";}
v1s+=v;}
e=document.getElementById("cds-cart-variable2-"+this.items[i].productId);if(e){if(e.tagName.toUpperCase()==="INPUT"){v=e.value;}else if(e.tagName.toUpperCase()==="SELECT"){v=e.options[e.selectedIndex].value;}
if(v2s.length>0){v2s+="|";}
v2s+=v;}
e=document.getElementById("cds-cart-variable3-"+this.items[i].productId);if(e){if(e.tagName.toUpperCase()==="INPUT"){v=e.value;}else if(e.tagName.toUpperCase()==="SELECT"){v=e.options[e.selectedIndex].value;}
if(v3s.length>0){v3s+="|";}
v3s+=v;}
if(ps.length>0){ps+="|";}
ps+=this.items[i].productId;}
o={o:"cart-update",d:cds.getDataDomain(),pid:ps,qty:qs};u=cds.getUser();if(u){o["cds-user"]=u;}else{if(cds.cdsu!==null){o["cds-user"]=cds.cdsu;}
if(cds.fname!==null){o["cds-fname"]=cds.fname;}
if(cds.lname!==null){o["cds-lname"]=cds.lname;}
if(cds.company!==null){o["cds-company"]=cds.company;}
if(cds.address1!==null){o["cds-address1"]=cds.address1;}
if(cds.address2!==null){o["cds-address2"]=cds.address2;}
if(cds.address3!==null){o["cds-address3"]=cds.address3;}
if(cds.city!==null){o["cds-city"]=cds.city;}
if(cds.country!==null){o["cds-country"]=cds.country;}
if(cds.state!==null){o["cds-state"]=cds.state;}
if(cds.zip!==null){o["cds-zip"]=cds.zip;}
if(cds.phone!==null){o["cds-phone"]=cds.phone;}
if(cds.fax!==null){o["cds-fax"]=cds.fax;}
if(cds.agreetos!==null){o["cds-agree-tos"]=cds.agreetos;}}
if(cds.getDataDomain()!==cds.getTemplateDomain()){o["td"]=cds.getTemplateDomain();}
if(v1s.length>0){o["var1"]=v1s;}
if(v1s.length>0){o["var2"]=v2s;}
if(v1s.length>0){o["var3"]=v3s;}
jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){if(data.error){if(data.error==="authentication required"){cds.authenticationManager.login(cds.getTemplateDomain(),"cart-update");return;}else{cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"cart-update",true);return;}}else{cds.cart.items=data.items;cds.cart.display();}}});return false;};this.handleSubmitIsValid=function(o){return true;};this.modifySubmitData=function(o){return o;};this.handleSubmit=function(){var o,u,e,v;if(cds.isInputBlocked){return;}
o={o:"cart-submit",d:cds.getDataDomain()};u=cds.getUser();if(u){o["cds-user"]=u;}else{if(cds.cdsu!==null){o["cds-user"]=cds.cdsu;}
if(cds.fname!==null){o["cds-fname"]=cds.fname;}
if(cds.lname!==null){o["cds-lname"]=cds.lname;}
if(cds.company!==null){o["cds-company"]=cds.company;}
if(cds.address1!==null){o["cds-address1"]=cds.address1;}
if(cds.address2!==null){o["cds-address2"]=cds.address2;}
if(cds.address3!==null){o["cds-address3"]=cds.address3;}
if(cds.city!==null){o["cds-city"]=cds.city;}
if(cds.country!==null){o["cds-country"]=cds.country;}
if(cds.state!==null){o["cds-state"]=cds.state;}
if(cds.zip!==null){o["cds-zip"]=cds.zip;}
if(cds.phone!==null){o["cds-phone"]=cds.phone;}
if(cds.fax!==null){o["cds-fax"]=cds.fax;}
if(cds.agreetos!==null){o["cds-agree-tos"]=cds.agreetos;}}
if(cds.getDataDomain()!==cds.getTemplateDomain()){o["td"]=cds.getTemplateDomain();}
e=document.getElementById("cds-cart-comments");if(e){o["comments"]=e.value;}
e=document.getElementById("cds-cart-variable1");if(e){if(e.tagName.toUpperCase()==="INPUT"){v=e.value;}else if(e.tagName.toUpperCase()==="SELECT"){v=e.options[e.selectedIndex].value;}
if(v&&v.length){o["var1"]=v;}}
e=document.getElementById("cds-cart-variable2");if(e){if(e.tagName.toUpperCase()==="INPUT"){v=e.value;}else if(e.tagName.toUpperCase()==="SELECT"){v=e.options[e.selectedIndex].value;}
if(v&&v.length){o["var2"]=v;}}
e=document.getElementById("cds-cart-variable3");if(e){if(e.tagName.toUpperCase()==="INPUT"){v=e.value;}else if(e.tagName.toUpperCase()==="SELECT"){v=e.options[e.selectedIndex].value;}
if(v&&v.length){o["var3"]=v;}}
if(this.handleSubmitIsValid(o)){o=this.modifySubmitData(o);this.submitInProgress=true;this.dialog=jQuery("<div id='cds-rfq-request-dialog'></div>").html("<img src='"+cds.remoteServerBaseURL+"/images/progress_animation.gif' />"+"<div>"+cds.getTextLabel("cart.submit_dialog_text")+"</div>").dialog({title:cds.getTextLabel("cart.submit_dialog_title"),width:400,modal:true,resizable:false,beforeClose:function(event,ui){return!cds.cart.submitInProgress;},close:function(){cds.cart.items=[];cds.cart.display();}});jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){cds.cart.submitInProgress=false;if(data.error){if(data.error==="authentication required"){cds.authenticationManager.login(cds.getTemplateDomain(),"cart-submit");return;}else if(data.error==="access denied"||data.error==="authentication error"){cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"cart-submit",true);return;}else{cds.cart.dialog.html(cds.getTextLabel("cart.submit_dialog_error_text")).dialog("option","title","Error!");}}else{if(typeof cdsHandlePostSubmitRFQ==="function"){cdsHandlePostSubmitRFQ(data);}
if(!this.bypassThankYou){if(cds.cart.thankYouURL===null){cds.cart.dialog.html(cds.getTextLabel("cart.submit_dialog_success_text")).dialog("option","title",cds.getTextLabel("cart.submit_dialog_success_title"));}
if(cds.cart.thankYouURL!==null){location.href=this.thankYouURL;}}}}});}}
this.display=function(){var i,d,desc,c,s="",e=document.getElementById(this.parentElementId);if(e){s=""
+"<table id=\"cds-cart-table\">"
+"    <thead>"
+"        <tr>"
+"            <td class=\"cds-cart-cell-id\">Product ID</td>"
+"            <td class=\"cds-cart-cell-description\">Description</td>"
+"            <td class=\"cds-cart-cell-quantity\">Quantity</td>"
+"            <td class=\"cds-cart-cell-controls\">&nbsp;</td>"
+"        </tr>"
+"    </thead>"
+"    <tbody>";for(i=0;i<this.items.length;i++){d=this.items[i];desc=(d["description"]||"").replace(/\r\n/g,"<br />");c=(i%2!==0)?" class=\"odd-row\"":"";s+="        <tr"+c+">";if(d["productUrl"]){s+="            <td class=\"cds-cart-cell-id\"><a href=\""+d["productUrl"]+"\" class=\"productUrlLink\">"+(d["productLabel"]||d["productId"]||"")+"</a></td>";}else{s+="            <td class=\"cds-cart-cell-id\">"+(d["productLabel"]||d["productId"]||"")+"</td>";}
s+="            <td class=\"cds-cart-cell-description\">"+desc+"</td>"
+"            <td class=\"cds-cart-cell-quantity\"><input id=\"cds-cart-quantity-"+d["productId"]+"\" type=\"text\" onfocus=\"select();\" value=\""+(d["quantity"]||"")+"\" size=\"10\" class=\"quantityInput\" onchange=\"cds.cart.handleUpdate()\"></td>"
+"            <td class=\"cds-cart-cell-controls\"><a href=\"javascript:cds.cart.handleRemove('"+d["productId"]+"');\">remove</a></td>"
+"        </tr>";}
s+="    </tbody>"
+"    <tfoot>"
+"        <tr><td>&nbsp;</td></tr>"
+"        <tr><td><label>Comments:</label></td></tr>"
+"        <tr><td colspan=\"3\"><textarea id=\"cds-cart-comments\" cols=\"80\" rows=\"5\"></textarea></td></tr>"
+"    </tfoot>"
+"</table>";if(this.items.length>0){s+="<div id=\"cds-cart-footer\">"
+"    <button type=\"button\" onclick=\"cds.cart.handleSubmit()\">"
+cds.getTextLabel("cart.submit_button_text")+"</button>"
+"</div>";}
while(e.hasChildNodes()){e.removeChild(e.lastChild);}
e.innerHTML=s;}};this.addProductsConfirmation=function(quantity){var s;s="<div id=\"cds-confirm-content\">"
+String(quantity)
+cds.getTextLabel("confirm.content_text")
+"</div>";this.confirmDialog=jQuery("<div id=\"cds-confirm-container\"></div>").html(s).dialog({title:cds.getTextLabel("confirm.dialog_title"),width:500,height:150,modal:true,resizable:false,autoOpen:false,close:function(){jQuery(this).remove();cds.authenticationManager.confirmDialog=null;}});this.confirmDialog.dialog("open");};this.addMultipleProducts=function(products,display,displayURL){if(cds.isInputBlocked){return;}
if(products){this.currentProduct=products;this.currentDisplay=display;this.currentDisplayURL=displayURL;}
let o={o:"cart-add",d:cds.getDataDomain(),};let u=cds.getUser();if(u){o["cds-user"]=u;}else{if(cds.cdsu!==null){o["cds-user"]=cds.cdsu;}
if(cds.fname!==null){o["cds-fname"]=cds.fname;}
if(cds.lname!==null){o["cds-lname"]=cds.lname;}
if(cds.company!==null){o["cds-company"]=cds.company;}
if(cds.address1!==null){o["cds-address1"]=cds.address1;}
if(cds.address2!==null){o["cds-address2"]=cds.address2;}
if(cds.address3!==null){o["cds-address3"]=cds.address3;}
if(cds.city!==null){o["cds-city"]=cds.city;}
if(cds.country!==null){o["cds-country"]=cds.country;}
if(cds.state!==null){o["cds-state"]=cds.state;}
if(cds.zip!==null){o["cds-zip"]=cds.zip;}
if(cds.phone!==null){o["cds-phone"]=cds.phone;}
if(cds.fax!==null){o["cds-fax"]=cds.fax;}
if(cds.agreetos!==null){o["cds-agree-tos"]=cds.agreetos;}}
if(cds.getDataDomain()!==cds.getTemplateDomain()){o["td"]=cds.getTemplateDomain();}
if(this.originalReferrer){o["oref"]=this.originalReferrer;}
for(var i=0;i<this.currentProduct.length;i++){o["pid"+String(i)]=this.currentProduct[i].id
o["plabel"+String(i)]=this.currentProduct[i].label
o["qty"+String(i)]=this.currentProduct[i].qty
if(this.currentProduct[i].url){o["purl"+String(i)]=this.currentProduct[i].url}
if(this.currentProduct[i].description){o["desc"+String(i)]=this.currentProduct[i].description}
if(this.currentProduct[i].image){o["img"+String(i)]=this.currentProduct[i].image}
if(this.currentProduct[i].var1){o["var1"+String(i)]=this.currentProduct[i].var1}
if(this.currentProduct[i].var2){o["var2"+String(i)]=this.currentProduct[i].var2}
if(this.currentProduct[i].var3){o["var3"+String(i)]=this.currentProduct[i].var3}}
if(typeof cdsCartPreAddProductCallback!=="undefined"){if(!cdsCartPreAddProductCallback(o)){return;}}
this.displayAfterAdd=this.currentDisplay;jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){if(typeof cdsCartPostAddProductCallback!=="undefined"){cdsCartPostAddProductCallback(data);}
if(data.error){if(data.error==="authentication required"){cds.authenticationManager.login(cds.getTemplateDomain(),"cart-add");return false;}else{cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"cart-add",true);return false;}}else{if(this.displayAfterAdd){cds.cart.items=data.items;if(cds.cart.currentDisplayURL){location.href=cds.cart.currentDisplayURL;}else{cds.cart.display();}}
else{cds.cart.addProductsConfirmation(this.currentProduct.length);}
return true;}}});}
this.addProduct=function(product,label,description,quantity,url,image,display,displayURL,variable1,variable2,variable3){if(cds.isInputBlocked){return;}
if(product){this.currentProduct=product;this.currentLabel=label;this.currentDescription=description;this.currentQuantity=(quantity!==null)?quantity:1;this.currentURL=url;this.currentImage=image;this.currentDisplay=display;this.currentDisplayURL=displayURL;}
else if(this.currentProduct instanceof Array){this.addMultipleProducts();}
let o={o:"cart-add",d:cds.getDataDomain(),pid:this.currentProduct,plabel:this.currentLabel,qty:this.currentQuantity};if(this.currentURL){o["purl"]=this.currentURL;}
if(this.currentDescription){o["desc"]=this.currentDescription;}
if(this.currentImage){o["img"]=this.currentImage;}
let u=cds.getUser();if(u){o["cds-user"]=u;}else{if(cds.cdsu!==null){o["cds-user"]=cds.cdsu;}
if(cds.fname!==null){o["cds-fname"]=cds.fname;}
if(cds.lname!==null){o["cds-lname"]=cds.lname;}
if(cds.company!==null){o["cds-company"]=cds.company;}
if(cds.address1!==null){o["cds-address1"]=cds.address1;}
if(cds.address2!==null){o["cds-address2"]=cds.address2;}
if(cds.address3!==null){o["cds-address3"]=cds.address3;}
if(cds.city!==null){o["cds-city"]=cds.city;}
if(cds.country!==null){o["cds-country"]=cds.country;}
if(cds.state!==null){o["cds-state"]=cds.state;}
if(cds.zip!==null){o["cds-zip"]=cds.zip;}
if(cds.phone!==null){o["cds-phone"]=cds.phone;}
if(cds.fax!==null){o["cds-fax"]=cds.fax;}
if(cds.agreetos!==null){o["cds-agree-tos"]=cds.agreetos;}}
if(cds.getDataDomain()!==cds.getTemplateDomain()){o["td"]=cds.getTemplateDomain();}
if(this.originalReferrer){o["oref"]=this.originalReferrer;}
if(variable1&&variable1.length>0){o["var1"]=variable1;}
if(variable2&&variable2.length>0){o["var2"]=variable2;}
if(variable3&&variable3.length>0){o["var3"]=variable3;}
if(typeof cdsCartPreAddProductCallback!=="undefined"){if(!cdsCartPreAddProductCallback(o)){return;}}
this.displayAfterAdd=this.currentDisplay;jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,success:function(data){if(typeof cdsCartPostAddProductCallback!=="undefined"){cdsCartPostAddProductCallback(data);}
if(data.error){if(data.error==="authentication required"){cds.authenticationManager.login(cds.getTemplateDomain(),"cart-add");return false;}else{cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"cart-add",true);return false;}}else{if(this.displayAfterAdd){cds.cart.items=data.items;if(cds.cart.currentDisplayURL){location.href=cds.cart.currentDisplayURL;}else{cds.cart.display();}}
return true;}}});};this.load=function(){var u,pid,plabel,purl,pdesc,pimg,pqty,o={o:"cart-get",d:cds.getDataDomain()};u=cds.getUser();if(u){o["cds-user"]=u;}else{if(cds.cdsu!==null){o["cds-user"]=cds.cdsu;}
if(cds.fname!==null){o["cds-fname"]=cds.fname;}
if(cds.lname!==null){o["cds-lname"]=cds.lname;}
if(cds.company!==null){o["cds-company"]=cds.company;}
if(cds.address1!==null){o["cds-address1"]=cds.address1;}
if(cds.address2!==null){o["cds-address2"]=cds.address2;}
if(cds.address3!==null){o["cds-address3"]=cds.address3;}
if(cds.city!==null){o["cds-city"]=cds.city;}
if(cds.country!==null){o["cds-country"]=cds.country;}
if(cds.state!==null){o["cds-state"]=cds.state;}
if(cds.zip!==null){o["cds-zip"]=cds.zip;}
if(cds.phone!==null){o["cds-phone"]=cds.phone;}
if(cds.fax!==null){o["cds-fax"]=cds.fax;}
if(cds.agreetos!==null){o["cds-agree-tos"]=cds.agreetos;}}
if(cds.getDataDomain()!==cds.getTemplateDomain()){o["td"]=cds.getTemplateDomain();}
if(this.originalReferrer){o["oref"]=this.originalReferrer;}
pid=cds.getQueryStringParameter("add-id");plabel=cds.getQueryStringParameter("add-label");purl=cds.getQueryStringParameter("add-url");pdesc=cds.getQueryStringParameter("add-desc");pimg=cds.getQueryStringParameter("add-img");pqty=cds.getQueryStringParameter("add-qty");pvar1=cds.getQueryStringParameter("add-var1");pvar2=cds.getQueryStringParameter("add-var2");pvar3=cds.getQueryStringParameter("add-var3");if(pid!==""&&plabel!==""&&pqty!==""){o["pid"]=pid;o["plabel"]=plabel;if(purl){o["purl"]=purl;}
if(pdesc){o["desc"]=pdesc;}
if(pimg){o["img"]=pimg;}
o["qty"]=pqty;}
if(pvar1){o["var1"]=pvar1;}
if(pvar2){o["var2"]=pvar2;}
if(pvar3){o["var3"]=pvar3;}
jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,error:function(jqXHR,textStatus,errorThrown){alert(jqXHR+'\n'+textStatus+'\n'+errorThrown);},success:function(data){if(data.error){if(data.error==="authentication required"){cds.authenticationManager.login(cds.getTemplateDomain(),"cart-load");return;}else{cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"cart-load",true);return;}}else{cds.cart.items=data.items;cds.cart.display();}}});};})(),specSheet:new(function(){this.params={};this.name="specsheet";this.unit=null;this.generatingDialog=null;this.downloadInProgress=false;this.resultURL=null;this.resultError=null;this.load=function(elementId){var e=document.getElementById(elementId);if(e){jQuery("#"+elementId).click(this,function(event){event.data.submit();});}};this.preSubmitCallback=null,this.getSubmitParameters=function(){var i,u,s,v,found,a,customo,o={o:"pdf",name:this.name,d:cds.getDataDomain(),su:true};if(this.preSubmitCallback!==null){customo=this.preSubmitCallback(o);if(customo){for(i in customo){o[i]=customo[i];}}}
u=cds.getUser();if(u){o["cds-user"]=u;}else{if(cds.cdsu!==null){o["cds-user"]=cds.cdsu;}
if(cds.fname!==null){o["cds-fname"]=cds.fname;}
if(cds.lname!==null){o["cds-lname"]=cds.lname;}
if(cds.company!==null){o["cds-company"]=cds.company;}
if(cds.address1!==null){o["cds-address1"]=cds.address1;}
if(cds.address2!==null){o["cds-address2"]=cds.address2;}
if(cds.address3!==null){o["cds-address3"]=cds.address3;}
if(cds.city!==null){o["cds-city"]=cds.city;}
if(cds.country!==null){o["cds-country"]=cds.country;}
if(cds.state!==null){o["cds-state"]=cds.state;}
if(cds.zip!==null){o["cds-zip"]=cds.zip;}
if(cds.phone!==null){o["cds-phone"]=cds.phone;}
if(cds.fax!==null){o["cds-fax"]=cds.fax;}
if(cds.agreetos!==null){o["cds-agree-tos"]=cds.agreetos;}}
if(cds.getDataDomain()!==cds.getTemplateDomain()){o["td"]=cds.getTemplateDomain();}
if(this.originalReferrer){o["oref"]=this.originalReferrer;}
u=this.unit;if(!u){u=cds.getCookie("cds.catalog.unit");if(!u){u="english";}}
o["unit"]=u;for(i in this.params){o[i]=this.params[i];}
if(cds.productAttributes){found=false;s="";for(i in cds.productAttributes){a=cds.productAttributes[i];v=null;if(a.dataType==="range"){e=document.getElementById("cds-dv-"+i);if(e){v=e.value;if(isNaN(parseFloat(v))){v=null;}}}else if(a.dataType==="list"){var e=document.getElementById("cds-dv-"+i);if(e){v=e.options[e.selectedIndex].value;if(v!==null&&v.toLowerCase()==="none"){v=null;}}}else if(a.dataType==="multilist"){v="";for(var j=0;j<100;j++){e=document.getElementById("cds-dv-"+i+"-"+j);if(e){if(e.checked){if(v.length){v+=", ";}
v+=e.value;}}else{break;}}
if(!v.length){v=null;}}else if(a.dataType==="text"){var e=document.getElementById("cds-dv-"+i);if(e){v=e.value;if(v&&!v.length){v=null;}}}
if(v){if(!found){found=true;}else{s+=";";}
s+=a.label+":"+v;}}
if(found){o["ca"]=s;}}
return o;};this.getSubmitURL=function(){var url,i,o=this.getSubmitParameters();url=cds.remoteServerBaseURL+"/service?";for(i in o){if(o.hasOwnProperty(i)&&i!=="su"){url+=i+"="+o[i]+"&";}}
return url.substring(0,url.length-2);};this.submit=function(){var o=this.getSubmitParameters();this.resultURL=null;this.downloadInProgress=true;cds.isInputBlocked=true;document.body.style.cursor="wait";this.showDialogGenerating();jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,error:function(jqXHR,textStatus,errorThrown){alert(jqXHR+'\n'+textStatus+'\n'+errorThrown);cds.isInputBlocked=false;document.body.style.cursor="default";},success:function(data){if(data.error){cds.specSheet.resultError=data.error;cds.specSheet.resultURL=null;}else{cds.specSheet.resultError=null;cds.specSheet.resultURL=data.resultPath;}
cds.specSheet.downloadInProgress=false;cds.isInputBlocked=false;document.body.style.cursor="default";cds.specSheet.showDialogResults();}});};this.showDialogGenerating=function(){var e,generatingTitle="Generating Document",generatingText="The document you requested is being generated. This could take up to a minute, please wait...";if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML="<img src='"+cds.remoteServerBaseURL
+"/images/progress_animation.gif' />"
+"<div>"+generatingText+"</div>";}}else{this.generatingDialog=jQuery("<div id='cds-cad-request-dialog'></div>").html("<img src='"+cds.remoteServerBaseURL+"/images/progress_animation.gif' />"+"<div>"+generatingText+"</div>").dialog({title:generatingTitle,width:400,modal:true,resizable:false,beforeClose:function(event,ui){return!cds.specSheet.downloadInProgress;}});}};this.showDialogResults=function(){var s,o,remoteServerBaseURL,completeTitle="Generation Complete!",completeText="The document you requested has been successfully generated.",completeLinkText="Click Here to Download Document",errorTitle="There was an error generating the document you have requested.&nbsp;&nbsp;Please wait a few minutes and try again.",errorText="Error!";s="<div>"+completeText+"</div><div><a href='"+this.resultURL+"' target='cds_spec_sheet'>"
+completeLinkText+"</a></div>";if(this.resultError==="authentication required"){this.generatingDialog.dialog("close");cds.authenticationManager.login(cds.getTemplateDomain(),"spec-sheet");return;}else if(this.resultError==="access denied"||this.resultError==="authentication error"){this.generatingDialog.dialog("close");cds.deleteCookie("cds."+cds.getTemplateDomain()+".user");cds.authenticationManager.login(cds.getTemplateDomain(),"spec-sheet",true);return;}else if(this.resultURL){if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML=s;}}else{this.generatingDialog.html(s).dialog("option","title",completeTitle);}}else{if(this.dialogElementId){e=document.getElementById(this.dialogElementId);if(e){e.innerHTML=errorText;}}else{this.generatingDialog.html(errorText).dialog("option","title",errorTitle);}}};})(),explode:new(function(){this.productId=null;this.categoryId=null;this.containerElementId=null;this.explodeURLTemplate="?c=explode&id=%PRODUCT%&cid=%CATEGORY%";this.productURLTemplate="?c=products&id=%PRODUCT%";this.url=null;this.components=null;this.error=null;this.load=function(){if(this.productId===null){return;}
var o={o:"explode",d:cds.getDataDomain(),id:this.productId};if(this.categoryId){o.cid=this.categoryId;}
jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,error:function(jqXHR,textStatus,errorThrown){alert("Request object: "+jqXHR+"\nStatus: "+textStatus+"\nError: "+errorThrown);},success:function(data){if(data.error){this.error=data.error;}else{this.url=data.url;this.components=data.components;if(!this.components||!this.components.length){this.error="Unable to load components";}}
this.display();}});};this.display=function(){var i,purl,eurl,url,container,h,div,img,table,thead,tbody,tr,td,a,c;container=document.getElementById(this.containerElementId);if(container){while(container.hasChildNodes()){container.removeChild(container.lastChild);}
if(this.error){h=document.createElement("h3");container.appendChild(h);h.appendChild(document.createTextNode("Unable to load exploded diagram."));return;}
if(this.url){div=document.createElement("div");div.setAttribute("id","cds-explode-image");container.appendChild(div);img=document.createElement("img");img.setAttribute("src",this.url);div.appendChild(img);}
table=document.createElement("table");table.setAttribute("id","cds-explode-table");table.className="attribute-table";container.appendChild(table);thead=document.createElement("thead");table.appendChild(thead);tr=document.createElement("tr");thead.appendChild(tr);td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode("Product Number"));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode("Description"));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode("Reference Number"));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode("Quantity"));tbody=document.createElement("tbody");table.appendChild(tbody);purl=this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain()));purl=cds.getDataDomainURI(purl);eurl=this.explodeURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain()));eurl=cds.getDataDomainURI(eurl);for(i=0;i<this.components.length;i++){c=this.components[i];tr=document.createElement("tr");tr.className=(i%2===0)?"cds-odd":"cds-even";tbody.appendChild(tr);td=document.createElement("td");tr.appendChild(td);a=document.createElement("a");if(c.ownExplodedView){url=eurl.replace(/%CATEGORY%/g,this.categoryId).replace(/%PRODUCT%/g,this.productId);}else{url=purl.replace(/%CATEGORY%/g,this.categoryId).replace(/%PRODUCT%/g,this.productId);}
a.setAttribute("href",url);td.appendChild(a);a.appendChild(document.createTextNode(c.linkedProductId));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(c.description?c.description:"&nbsp;"));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(c.index?c.index:"&nbsp;"));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(c.quantity?c.quantity:"&nbsp;"));}}};})(),keys:new(function(){this.q=null;this.queryParameter="cdskeys";this.attributeList=null;this.autoComplete=false;this.autoCompleteMap={};this.productOnly=false;this.checkFacetedSearch=true;this.idOnly=false;this.products=null;this.page=0;this.resultCount=0;this.error=null;this.inputElementId="cds-keys-input";this.buttonElementId="cds-keys-button";this.containerElementId="cds-keys-results";this.resultsURLTemplate="?c=fsearch&cid=root";this.productURLTemplate="?c=products&id=%PRODUCT%&cid=%CATEGORY%";this.categoryURLTemplate="?c=fsearch&cid=%CATEGORY%";this.loadInput=function(){var e;jQuery("#"+this.buttonElementId).click(this,function(event){event.data.doSearch();});jQuery("#"+this.inputElementId).keypress(this,function(event){if(event.which===13){event.data.doSearch();}});if(this.autoComplete){jQuery("#"+this.inputElementId).autocomplete({source:function(request,response){jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:{o:"autocomplete",d:cds.getDataDomain(),so:true,cdskeys:request.term},context:this,error:function(jqXHR,textStatus,errorThrown){response();},success:function(data){var i,a,m;if(!data.error&&data.keywords&&data.keywords.length){cds.keys.autoCompleteMap={};a=[];for(i=0;i<10&&i<data.keywords.length;i++){a[i]=data.keywords[i];if((data.productIDs&&data.productIDs[i])||(data.categoryIDs&&data.categoryIDs[i])){m={};if(data.productIDs&&data.productIDs[i]){m["productID"]=data.productIDs[i];}
if(data.productCategoryIDs&&data.productCategoryIDs[i]){m["productCategoryID"]=data.productCategoryIDs[i];}
if(data.categoryIDs&&data.categoryIDs[i]){m["categoryID"]=data.categoryIDs[i];}
if(data.thumbnailURLs&&data.thumbnailURLs[i]){m["thumbnailURL"]=data.thumbnailURLs[i];}
cds.keys.autoCompleteMap[data.keywords[i].toUpperCase()]=m;}}
response(a);}else{response();}}});},select:function(event,ui){document.getElementById(cds.keys.inputElementId).value=ui.item.label;cds.keys.doSearch();}});}};this.doSearch=function(){var url,e,m,o;e=document.getElementById(this.inputElementId);if(e&&e.value&&e.value.length&&e.value!=="Search"){m=cds.keys.autoCompleteMap[e.value.toUpperCase()];if(m){if(m['productID']){url=this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain())).replace(/%KEYS%/g,encodeURIComponent(e.value)).replace(/%PRODUCT%/g,encodeURIComponent(m['productID']));if(m['productCategoryID']){url=url.replace(/%CATEGORY%/g,encodeURIComponent(m['productCategoryID']))}
location.href=cds.getDataDomainURI(url);return;}else if(m['categoryID']){url=this.categoryURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain())).replace(/%KEYS%/g,encodeURIComponent(e.value)).replace(/%CATEGORY%/g,encodeURIComponent(m['categoryID']));location.href=cds.getDataDomainURI(url);return;}}
if(typeof cdsKeysNoResultsCallback!=="undefined"){o={o:"keys",check:"true",d:cds.getDataDomain(),cdskeys:e.value};if(this.resultsURLTemplate.indexOf("=keys")==-1){o={o:"fsearch",check:"true",d:cds.getDataDomain(),cdskeys:e.value};}
jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,error:function(jqXHR,textStatus,errorThrown){cdsKeysNoResultsCallback(null);},success:function(data){var url,apn;if(data.error){cdsKeysNoResultsCallback(data.keys);}else{url=this.resultsURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain()));if(data.keys){url=url.replace(/%KEYS%/g,encodeURIComponent(e.value));}
url=cds.getDataDomainURI(url);if(url.indexOf("?")!==-1){url+="&"+this.queryParameter+"="+e.value;}else{url+="?"+this.queryParameter+"="+e.value;}
if(this.attributeList){url+="&attributes="+encodeURIComponent(this.attributeList);}
if(this.productOnly){url+="&po=true";}
if(this.idOnly){url+="&pno=true";}
if(typeof cdsKeysPreSearchCallback!=="undefined"){url=cdsKeysPreSearchCallback(url);}
location.href=url;return;}}});}else{url=this.resultsURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain()));url=url.replace(/%KEYS%/g,encodeURIComponent(e.value));url=cds.getDataDomainURI(url);if(url.indexOf("?")!==-1){url+="&"+this.queryParameter+"="+e.value;}else{url+="?"+this.queryParameter+"="+e.value;}
if(this.attributeList){url+="&attributes="+encodeURIComponent(this.attributeList);}
if(this.productOnly){url+="&po=true";}
if(this.idOnly){url+="&pno=true";}
if(typeof cdsKeysPreSearchCallback!=="undefined"){url=cdsKeysPreSearchCallback(url);}
location.href=url;return;}}else{alert("Please enter search terms");return;}};this.load=function(){var o;if(!this.q){this.q=cds.getQueryStringParameter(this.queryParameter);if(!this.q){this.q=cds.getQueryStringParameter("cdskeys");}
if(!this.q){this.q=cds.getQueryStringParameter("q");}
this.attributeList=cds.getQueryStringParameter("attributes").length?cds.getQueryStringParameter("attributes"):null;this.productOnly=cds.getQueryStringParameter("po").length?cds.getQueryStringParameter("po"):null;this.idOnly=cds.getQueryStringParameter("pno").length?cds.getQueryStringParameter("pno"):null;}
o={o:"keys",d:cds.getDataDomain(),cdskeys:this.q};if(this.attributeList){o.attributes=this.attributeList;}
if(this.productOnly){o.po=this.productOnly;}
if(this.idOnly){o.pno=this.idOnly;}
jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:this,error:function(jqXHR,textStatus,errorThrown){alert("Request object: "+jqXHR+"\nStatus: "+textStatus+"\nError: "+errorThrown);},success:function(data){var i;if(data.error){if(data.error!=="No results found"){this.error="Unable to load search results.";}else{this.products=null;this.resultCount=0;this.error=null;}
this.display();}else{if(!data.products||!data.products.length){this.products=null;this.resultCount=0;}else{this.products=data.products;this.resultCount=data.resultCount;}
this.error=null;this.display();}}});};this.display=function(){var i,o,purl,curl,container,h,table,thead,tbody,tr,td,a;purl=this.productURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain()));purl=cds.getDataDomainURI(purl);curl=this.categoryURLTemplate.replace(/%DOMAIN%/g,encodeURIComponent(cds.getTemplateDomain()));curl=cds.getDataDomainURI(curl);container=document.getElementById("cds-keys-info");if(container){container.innerHTML=this.resultCount+" "+(this.resultCount===1?"result":"results")+" found.";}
container=document.getElementById(this.containerElementId);if(container){while(container.hasChildNodes()){container.removeChild(container.lastChild);}
if(this.error){h=document.createElement("h3");container.appendChild(h);h.appendChild(document.createTextNode("Unable to load search results."));return;}
if(!this.products){h=document.createElement("h3");container.appendChild(h);h.innerHTML=cds.getTextLabel("keyword_search_results.error_no_results");return;}
table=document.createElement("table");table.className="cds-keys-results-table";container.appendChild(table);thead=document.createElement("thead");table.appendChild(thead);tr=document.createElement("tr");thead.appendChild(tr);td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(cds.getTextLabel("keyword_search_results.product_column_label")));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(cds.getTextLabel("keyword_search_results.category_column_label")));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(cds.getTextLabel("keyword_search_results.description_column_label")));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(cds.getTextLabel("keyword_search_results.long_description_column_label")));tbody=document.createElement("tbody");table.appendChild(tbody);for(i=0;i<this.products.length;i++){o=this.products[i];tr=document.createElement("tr");tr.className=(i%2===0)?"cds-odd":"cds-even";tbody.appendChild(tr);td=document.createElement("td");tr.appendChild(td);a=document.createElement("a");a.setAttribute("href",purl.replace(/%PRODUCT%/g,encodeURIComponent(o.id)).replace(/%PRODUCT_CATEGORY%/g,encodeURIComponent(o.category.id)));a.appendChild(document.createTextNode(o.label));td.appendChild(a);td=document.createElement("td");tr.appendChild(td);a=document.createElement("a");a.setAttribute("href",curl.replace(/%CATEGORY%/g,encodeURIComponent(o.category.id)));a.appendChild(document.createTextNode(o.category.label));td.appendChild(a);td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(o.description?o.description:" "));td=document.createElement("td");tr.appendChild(td);td.appendChild(document.createTextNode(o.longDescription?o.longDescription:" "));}
if((this.page+1)*50<this.resultCount){a=document.createElement("a");a.setAttribute("id","cds-show-more-products");a.className="cds-more-button";a.appendChild(document.createTextNode("Show 50 More"));jQuery(a).click(function(){o={o:"keys",d:cds.getDataDomain(),cdskeys:cds.keys.q,page:++cds.keys.page};if(cds.keys.attributeList){o.attributes=cds.keys.attributeList;}
if(cds.keys.productOnly){o.po=cds.keys.productOnly;}
if(cds.keys.idOnly){o.pno=cds.keys.idOnly;}
document.body.style.cursor="wait";jQuery.ajax({url:cds.remoteServerBaseURL+"/service?callback=?",dataType:"jsonp",data:o,context:cds.keys,error:function(jqXHR,textStatus,errorThrown){alert("Request object: "+jqXHR+"\nStatus: "+textStatus+"\nError: "+errorThrown);},success:function(data){var i;if(!data.error){if(data.products&&data.products.length){cds.keys.products=cds.keys.products.concat(data.products);cds.keys.resultCount=data.resultCount;}
cds.keys.error=null;cds.keys.display();}
document.body.style.cursor="default";}});});container.appendChild(a);}}};})(),accessManager:new(function(){this.loginDialog=null;this.callback=null;this.callbackParameters=null;this.errorCallback=null;this.errorCallbackParameters=null;this.requestAccess=function(callback,callbackParameters,errorCallback,errorCallbackParameters){this.callback=callback;this.callbackParameters=callbackParameters;this.errorCallback=errorCallback;this.errorCallbackParameters=errorCallbackParameters;jQuery.ajax({url:cds.remoteServerBaseURL+"/access?callback=?",dataType:"jsonp",data:{"d":cds.getTemplateDomain(),"c":"request-access"},context:this,success:function(data){if(data.ok){if(typeof this.callback==="function"){this.callback(this.callbackParameters);}}else{if(typeof this.errorCallback==="function"){this.errorCallback(data.error,this.errorCallbackParameters);}else{this.login(this.callback,this.callbackParameters,this.errorCallback,this.errorCallbackParameters);}}}});};this.login=function(callback,callbackParameters,errorCallback,errorCallbackParameters){var s;this.callback=callback;this.callbackParameters=callbackParameters;this.errorCallback=errorCallback;this.errorCallbackParameters=errorCallbackParameters;s="<div id=\"cds-login-header\">"+cds.getTextLabel("login.header_text")+"</div>";s+="<div id=\"cds-login-error\"></div>";s+="<div id=\"cds-login-form\">"
+"    <label for=\"cds-login-email\">"+cds.getTextLabel("login.email_label")+"</label>"
+"    <input id=\"cds-login-email\" type=\"email\" value=\"\">"
+"    <button onclick=\"cds.accessManager.handleLogin();\">"
+cds.getTextLabel("login.submit_button_text")+"</button>"
+"</div>"
+"<div id=\"cds-login-new-user-container\" style=\"display: none\">"
+"    <div>"+cds.getTextLabel("login.new_user_header_text")+"</div>"
+"    <a href=\"javascript:cds.registration.handleNewUser();\">"
+cds.getTextLabel("login.new_user_link_text")+"</a>"
+"</div>";this.loginDialog=jQuery("<div id=\"cds-auth-container\"></div>").html(s).dialog({title:cds.getTextLabel("login.dialog_title"),width:500,height:350,modal:true,resizable:false,autoOpen:false,close:function(){jQuery(this).remove();cds.accessManager.loginDialog=null;}});this.loginDialog.dialog("open");jQuery.getScript(cds.remoteServerBaseURL+"/js/cds-access.js",function(){document.getElementById("cds-login-new-user-container").style.display="block";});};this.handleLogin=function(){var email=document.getElementById("cds-login-email").value;if(!email||!/.+@.+\..+/.exec(email)){document.getElementById("cds-login-error").innerHTML="Invalid email address. Please try again.";return;}
jQuery.ajax({url:cds.remoteServerBaseURL+"/access?callback=?",dataType:"jsonp",data:{"d":cds.getTemplateDomain(),"email":email,"c":"login"},context:this,success:function(data){var s;if(data.ok){if(this.loginDialog){this.loginDialog.dialog("close");}
if(typeof this.callback==="function"){this.callback(this.callbackParameters);}}else{switch(data.error){case"authentication required":case"authentication unsuccessfull":case"insufficient permissions":s="Either no account exists for this email address or you do not have permission for this"
+" action.<p>If you recently created this account, a verification request should have"
+" been sent to your email account.</p>";break;case"no request submitted":case"exception thrown":s="There was an error logging in, please try again";break;}
document.getElementById("cds-login-error").innerHTML=s;if(typeof this.errorCallback==="function"){this.errorCallback(data.error,this.errorCallbackParameters);}}}});};this.logout=function(callback,callbackParameters,errorCallback,errorCallbackParameters){this.callback=callback;this.callbackParameters=callbackParameters;this.errorCallback=errorCallback;this.errorCallbackParameters=errorCallbackParameters;jQuery.ajax({url:cds.remoteServerBaseURL+"/access?callback=?",dataType:"jsonp",data:{"d":cds.getTemplateDomain(),"c":"logout"},context:this,success:function(data){if(data.ok&&typeof this.callback==="function"){this.callback(this.callbackParameters);}else if(typeof this.errorCallback==="function"){this.errorCallback(data.error,this.errorCallbackParameters);}}});};})()};