1/* 2 * This code is copyright (c) ViciSoft SL, all rights reserved. 3 * The contents of this file are protected under law as the intellectual property 4 * of ViciSoft SL. Any use, reproduction, disclosure or copying 5 * of any kind without the express and written permission of ViciSoft SL is forbidden. 6 * Author: Vince Reid, [email protected] 7 * 8 * Last Modified: 2022-02-25 9 */ 10var oversldiv,gtid,absoptionpricediffs=false,cartpageonhttps=false,currDecimalSep='.',currencyseparator='',currThousandsSep=',',ectbody3layouttaxinc=false,hasdecimals=true,hideoptpricediffs=false,noprice=false, 11 nopriceanywhere=false,noshowoptionsinstock=false,notifybackinstock=false,noupdateprice=false,showinstock=false,stockdisplaythreshold=0,usehardaddtocart=false,usestockmanagement=false,softcartrelated=false,liajaxobj; 12function disabledectcontact(service,pid){ 13 var txt='\nTo enable this service please add the following parameter to your includes.'+sfextensionabs+' file...\n\n'; 14 if(sfextensionabs=='php')txt+='$'; 15 if(service=='emailfriend')txt+='useemailfriend=TRUE'; 16 else if(service=='askquestion')txt+='useaskaquestion=TRUE'; 17 else txt+='usecontactus=TRUE'; 18 if(sfextensionabs=='php')txt+=';'; 19 alert(txt); 20} 21function checklogintimeout(){ 22 var thistime=new Date().getTime(); 23 var timeremaining=(lastloginattempt+5000)-thistime; 24 if(timeremaining<0){ 25 ectById('cartaccountlogin').disabled=false; 26 ectById('fclitspan').innerHTML=xxNow; 27 }else{ 28 ectById('fclitspan').innerHTML=xxInSecs.replace('%s',Math.ceil(timeremaining/1000)); 29 setTimeout('checklogintimeout()',1000); 30 } 31} 32function checkloginaccount(){ 33 if(!ectchkemail('liemail'))return false; 34 if(!chkenter('lipass',xxPwd))return false; 35 ectById('loginacctdiv').style.display='none'; 36 ectById('ectsoftpreload').style.display=''; 37 postdata="email=" + ectByIdEnc('liemail') + "&pw=" + ectByIdEnc('lipass') + (ectById('licook').checked?'&licook=ON':''); 38 liajaxobj=ectGetAjaxObj(); 39 ectAjaxCall(liajaxobj,'POST','vsadmin/ajaxservice.'+sfextensionabs+'?action=loginaccount&lc='+loginhash,laajaxcallback,postdata,true); 40 return false; 41} 42function dologoutaccount(){ 43 ectById('loginacctdiv').style.display='none'; 44 ectById('ectsfsuccess').style.display='none'; 45 ectById('softopaquediv').style.display='' 46 ectById('ectsoftpreload').style.display=''; 47 liajaxobj=ectGetAjaxObj(); 48 ectAjaxCall(liajaxobj,'GET','vsadmin/ajaxservice.'+sfextensionabs+'?action=logoutaccount',laajaxcallback,null,true); 49 if(storeurlssl!=''){ 50 liajaxobj2=ectGetAjaxObj(); 51 ectAjaxCall(liajaxobj2,'GET','vsadmin/ajaxservice.'+sfextensionabs+'?action=logoutaccount',null,null,true); 52 } 53 return false; 54} 55function laajaxcallback(){ 56 if(liajaxobj.readyState==4){ 57 ectById('ectsoftpreload').style.display='none'; 58 if(liajaxobj.responseText.substr(0,10)=='DONELOGOUT'){ 59 ectById('ectsfsuccess').innerHTML=xxLOSuc; 60 ectById('ectsfsuccess').style.display=''; 61 setTimeout("customeraccounturl!=''?document.location=customeraccounturl:document.location.reload()",1500); 62 }else if(liajaxobj.responseText.substr(0,7)=='SUCCESS'){ 63 ectById('ectsfsuccess').innerHTML=xxLISuc; 64 ectById('ectsfsuccess').style.display=''; 65 if(loginrefurl[liajaxobj.responseText.split(':')[1]]) 66 setTimeout("document.location='" + loginrefurl[liajaxobj.responseText.split(':')[1]] + "'",1000); 67 else{ 68 if(clientloginref_sess!='') 69 setTimeout("document.location=clientloginref_sess",1000); 70 else if(clientloginref!=''&&clientloginref!='referer') 71 setTimeout("document.location=clientloginref",1000); 72 else 73 setTimeout("customeraccounturl!=''?document.location=customeraccounturl:document.location.reload()",1000); 74 } 75 }else{ 76 ectById('loginacctdiv').style.display=''; 77 var responsetext=liajaxobj.responseText.substr(7); 78 if(liajaxobj.responseText.substr(6,1)=='1'){ 79 var thistime=new Date().getTime(); 80 var timeremaining=(lastloginattempt+5000)-thistime; 81 responsetext=responsetext.replace('%s',Math.ceil(timeremaining/1000)); 82 ectById('cartaccountlogin').disabled=true; 83 setTimeout('checklogintimeout()',1000) 84 }else 85 lastloginattempt=new Date().getTime(); 86 ectById('liaccterrordiv').innerHTML=responsetext; 87 var className=ectById('liaccterrordiv').className; 88 if(className.indexOf('ectwarning')==-1)ectById('liaccterrordiv').className+=' ectwarning'; 89 } 90 } 91} 92function displayloginaccount(){ 93 hideaccounts(); 94 if(ectById('liemail')) ectById('liemail').disabled=false; 95 ectById('loginacctdiv').style.display=''; 96 ectById('softopaquediv').style.display=''; 97 return false; 98} 99function displaynewaccount(){ 100 hideaccounts(); 101 ectById('newacctdiv').style.display=''; 102 ectById('softopaquediv').style.display='';
103 if(recaptchaenabled8){ 104 if(nacaptchawidgetid===''){ 105 nacaptchawidgetid=grecaptcha.render('nacaptcha',{ 106 'sitekey' : recaptchasitekey, 107 'expired-callback' : function(){ 108 nacaptchaok=false; 109 },'callback' : function(response){ 110 nacaptcharesponse=response; 111 nacaptchaok=true; 112 }}); 113 } 114 nacaptchaok=false; 115 } 116 return false; 117} 118function displayectcontact(service,pid){ 119 askqproductid=pid; 120 hideaccounts(); 121 var cuheader='Contact Us',theblurb=xxCUBlur; 122 var csbut=ectById('contactsend'); 123 if(service=='askquestion'){cuheader=xxAskQue;csbut.onclick=function(){checkcontactus('askquestion');};theblurb=xxAQBlr;} 124 else if(service=='emailfriend'){cuheader=xxEmFrnd;csbut.onclick=function(){checkcontactus('emailfriend');};theblurb=xxEFBlr;} 125 else csbut.onclick=function() { checkcontactus(''); }; 126 ectById('cuheader').innerHTML=cuheader; 127 ectById('contactblurb').innerHTML=theblurb; 128 var tds=ectById('ectcontactdiv').getElementsByClassName('asqonly'); 129 for(var index=0;index<tds.length;index++)tds[index].style.display=service=='askquestion'?'':'none'; 130 var tds=ectById('ectcontactdiv').getElementsByClassName('emfonly'); 131 for(var index=0;index<tds.length;index++)tds[index].style.display=service=='emailfriend'?'':'none'; 132 var tds=ectById('ectcontactdiv').getElementsByClassName('couonly'); 133 for(var index=0;index<tds.length;index++)tds[index].style.display=service=='contactus'?'':'none'; 134 ectById('ectcontactdiv').style.display=''; 135 ectById('softopaquediv').style.display=''; 136 if(recaptchaenabled2){ 137 if(contactcaptchawidgetid===''){ 138 contactcaptchawidgetid=grecaptcha.render('contactcaptcha',{ 139 'sitekey' : recaptchasitekey, 140 'expired-callback' : function(){ 141 contactcaptchaok=false; 142 },'callback' : function(response){ 143 contactcaptcharesponse=response; 144 contactcaptchaok=true; 145 }}); 146 }else 147 grecaptcha.reset(contactcaptchawidgetid); 148 contactcaptchaok=false; 149 } 150 return false; 151} 152function checknewaccount(){ 153 if(!chkenter('naname',xxName))return false; 154 var regex=/ /; 155 var tobj=ectById('naname'); 156 if(!checkedfullname && !regex.test(tobj.value)){ 157 alert(xxFulNam + ' "' + xxName + '".'); 158 tobj.focus(); 159 checkedfullname=true; 160 return false; 161 } 162 if(!ectchkemail('naemail'))return false; 163 var tobj=ectById('pass'); 164 if(!nocustomerloginpwlimit&&tobj.value.length<6){ 165 alert(xxMinLen + ' "' + xxPwd + '".'); 166 tobj.focus(); 167 return false; 168 }else if(!chkenter('pass',xxPwd)) 169 return false; 170 if(extraclientfield1required&&!chkenter('extraclientfield1',extraclientfield1))return false; 171 if(extraclientfield2required&&!chkenter('extraclientfield2',extraclientfield2))return false; 172 postdata="fullname=" + ectByIdEnc('naname') + '&email=' + ectByIdEnc('naemail') + "&pw=" + ectByIdEnc('pass') + (nomailinglist ? '' : '&allowemail=' + (ectById('allowemail').checked?1:0)); 173 if(recaptchaenabled8){ 174 if(!nacaptchaok){alert(xxRecapt);return(false);} 175 postdata+='&g-recaptcha-response='+encodeURIComponent(nacaptcharesponse); 176 } 177 if(extraclientfield1!='') postdata+='&extraclientfield1=' + ectByIdEnc('extraclientfield1'); 178 if(extraclientfield2!='') postdata+='&extraclientfield2=' + ectByIdEnc('extraclientfield2'); 179 ectById('newacctdiv').style.display='none'; 180 ectById('ectsoftpreload').style.display=''; 181 liajaxobj=ectGetAjaxObj(); 182 ectAjaxCall(liajaxobj,'POST','vsadmin/ajaxservice.'+sfextensionabs+'?action=createaccount',checkoutmode=='checkout'?co2newacctcallback:naajaxcallback,postdata,true) 183 return false; 184} 185function checkcontactus(service){ 186 var ob; 187 if(!chkenter('yourname',xxEFNam))return false; 188 if(!chkenter('youremail',xxEFEm))return false; 189 if(!ectchkemail('youremail'))return false; 190 postdata='service='+service+'&nm='+ectByIdEnc('yourname')+'&ye='+ectByIdEnc('youremail')+'&yc='+ectByIdEnc('yourcomments'); 191 postdata+='&pid='+encodeURIComponent(askqproductid)+'&g-recaptcha-response='+contactcaptcharesponse; 192 if(service=='askquestion'){ 193 for(var index=1;index<=9;index++){ 194 if(ob=ectById('askquestionparam'+index)){ 195 var tval=''; 196 fieldtype=(ob.type?ob.type:'radio'); 197 if(fieldtype=='text'||fieldtype=='textarea'||fieldtype=='password'){ 198 tval=ob.value; 199 if(ectById('asqreq'+index)&&!chkenter('askquestionparam'+index,ectById('asqtxt'+index).innerHTML))return false; 200 }else if(fieldtype=='select-one'){ 201 tval=ob[ob.selectedIndex].value; 202 if(ectById('asqreq'+index)&&!chkenter('askquestionparam'+index,ectById('asqtxt'+index).innerHTML))return false; 203 }else if(fieldtype=='radio'){ 204 for(var ii=0;ii<ob.length;ii++)if(ob[ii].checked)tval=ob[ii].value; 205 }else if(fieldtype=='checkbox') 206 if(ob.checked)tval=ob.value; 207 postdata+='&aqex'+index+'='+encodeURIComponent(tval); 208 } 209 } 210 }else if(service=='emailfriend'){ 211 if(!ectchkemail('friendsemail'))return false; 212 postdata+='&fe='+ectByIdEnc('friendsemail'); 213 }else{ 214 for(var index=1;index<=9;index++){ 215 if(ob=ectById('contactusparam'+index)){ 216 var tval=''; 217 fieldtype=(ob.type?ob.type:'radio'); 218 if(fieldtype=='text'||fieldtype=='textarea'||fieldtype=='password'){ 219 tval=ob.value; 220 if(ectById('coureq'+index)&&!chkenter('contactusparam'+index,ectById('coutxt'+index).innerHTML))return false; 221 }else if(fieldtype=='select-one'){ 222 tval=ob[ob.selectedIndex].value; 223 if(ectById('coureq'+index)&&!chkenter('contactusparam'+index,ectById('coutxt'+index).innerHTML))return false; 224 }else if(fieldtype=='radio'){ 225 for(var ii=0;ii<ob.length;ii++)if(ob[ii].checked)tval=ob[ii].value; 226 }else if(fieldtype=='checkbox') 227 if(ob.checked)tval=ob.value; 228 postdata+='&aqex'+index+'='+encodeURIComponent(tval); 229 } 230 } 231 } 232 if(!chkenter('yourcomments',xxEFCmt))return false;
233 if(recaptchaenabled2&&!contactcaptchaok){ alert(xxRecapt);return(false); } 234 ectById('ectcontactdiv').style.display='none'; 235 ectById('ectsoftpreload').style.display=''; 236 liajaxobj=ectGetAjaxObj(); 237 ectAjaxCall(liajaxobj,'POST','vsadmin/ajaxservice.'+sfextensionabs+'?action=contactus',cuajaxcallback,postdata,true); 238 return false; 239} 240function naajaxcallback(){ 241 if(liajaxobj.readyState==4){ 242 ectById('ectsoftpreload').style.display='none'; 243 if(liajaxobj.responseText.substr(0,7)=='SUCCESS'){ 244 ectById('ectsfsuccess').innerHTML=xxAccSuc; 245 ectById('newacctdiv').style.display='none'; 246 ectById('ectsfsuccess').style.display=''; 247 setTimeout("customeraccounturl!=''?document.location=customeraccounturl:document.location.reload()",1500); 248 }else{ 249 ectById('accounterrordiv').innerHTML=liajaxobj.responseText.substr(6); 250 ectById('newacctdiv').style.display=''; 251 ectaddclass(ectById('accounterrordiv'),'ectwarning'); 252 if(recaptchaenabled8){nacaptchaok=false;grecaptcha.reset(nacaptchawidgetid);} 253 } 254 } 255} 256function ectresetobj(ob){ 257 var fieldtype=(ob.type?ob.type:'radio'); 258 if(fieldtype=='text'||fieldtype=='textarea'||fieldtype=='password'){ 259 ob.value=''; 260 }else if(fieldtype=='select-one'){ 261 ob.selectedIndex=0; 262 }else if(fieldtype=='radio'){ 263 for(var ii=0;ii<ob.length;ii++)ob[ii].checked=false; 264 }else if(fieldtype=='checkbox') 265 ob.checked=false; 266} 267function cuajaxcallback(){ 268 var thanksblurb=contactusthanks; 269 if(liajaxobj.readyState==4){ 270 ectById('ectsoftpreload').style.display='none'; 271 if(liajaxobj.responseText.substr(0,7)=='SUCCESS'){ 272 if(liajaxobj.responseText.substr(8,1)=='e') thanksblurb=emailfriendthanks; 273 if(liajaxobj.responseText.substr(8,1)=='a') thanksblurb=askaquestionthanks; 274 ectById('ectsfsuccess').innerHTML=xxMesSuc+(thanksblurb!=''?'<div class="ectsfthanks">'+thanksblurb+'</div>':''); 275 ectById('ectsfsuccess').style.display=''; 276 if(ectById('friendsemail'))ectById('friendsemail').value=''; 277 ectById('yourcomments').value=''; 278 for(var index=1;index<=9;index++){ 279 var ob; 280 if(ob=ectById('askquestionparam'+index))ectresetobj(ob); 281 if(ob=ectById('contactusparam'+index))ectresetobj(ob); 282 } 283 }else{ 284 ectById('ectcontactdiv').style.display=''; 285 if(recaptchaenabled2){grecaptcha.reset(contactcaptchawidgetid);} 286 alert(liajaxobj.responseText.substr(6)); 287 } 288 } 289} 290function hideaccounts(){ 291 ectById('ectsfsuccess').style.display='none'; 292 if(ectById('liemail')) ectById('liemail').disabled=true; 293 ectById('softopaquediv').style.display='none'; 294 ectById('ectsoftpreload').style.display='none'; 295 if(ectById('ectcontactdiv'))ectById('ectcontactdiv').style.display='none'; 296 if(ectById('loginacctdiv'))ectById('loginacctdiv').style.display='none'; 297 if(ectById('newacctdiv'))ectById('newacctdiv').style.display='none'; 298 return false; 299} 300function ectGetAjaxObj(){ 301 return window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP"); 302} 303function ectAjaxCall(ectajaxobj,prot,url,cback,pdata,async){ 304 if(cback!=null)ectajaxobj.onreadystatechange=cback; 305 ectajaxobj.open(prot,url,async); 306 ectajaxobj.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 307 ectajaxobj.send(pdata); 308} 309function ectByIdEnc(tobj){ 310 return encodeURIComponent(document.getElementById(tobj).value); 311} 312function ectById(tobj){ 313 return document.getElementById(tobj); 314} 315function chkenter(tobjtxt,tfield){ 316 var tobj=ectById(tobjtxt); 317 if((tobj.type=='select-one'&&tobj.selectedIndex==0)||(tobj.type!='select-one'&&tobj.value=='')){ 318 alert(xxPlsEntr+' "'+tfield+'".'); 319 ectaddclass(tobj,'ectwarning'); 320 tobj.focus(); 321 return false; 322 } 323 return true; 324} 325function ectchkemail(tobjtxt){ 326 var validemailregex=/[^@]+@[^@]+\.[a-z]{2,}$/i; 327 var tobj=ectById(tobjtxt); 328 if(!validemailregex.test(tobj.value)){ 329 alert(xxValEm); 330 ectaddclass(tobj,'ectwarning'); 331 tobj.focus(); 332 return false; 333 } 334 return true; 335} 336function displaysavelist(el,evt,twin){ 337 oversldiv=false 338 var theevnt=(!evt)?twin.event:evt;//IE:FF 339 var sld=ectById('savelistdiv'); 340 var parentdiv=el.parentNode; 341 parentdiv.insertBefore(sld,parentdiv.firstChild); 342 sld.style.visibility="visible"; 343 setTimeout('checksldiv()',2000); 344 return(false); 345} 346function checksldiv(){ 347 var sld=ectById('savelistdiv'); 348 if(! oversldiv) 349 sld.style.visibility='hidden'; 350} 351var notifystockid,notifystocktid,notifystockoid,nsajaxobj; 352function notifystockcallback(){ 353 if(nsajaxobj.readyState==4){ 354 var rstxt=nsajaxobj.responseText; 355 if(rstxt!='SUCCESS')alert(rstxt);else alert(xxInStNo); 356 closeinstock(); 357 } 358} 359function regnotifystock(){ 360 var regex=/[^@]+@[^@]+\.[a-z]{2,}$/i; 361 var theemail=ectById('nsemailadd'); 362 if(!regex.test(theemail.value)){ 363 alert(xxValEm); 364 theemail.focus(); 365 return(false); 366 }else{ 367 nsajaxobj=ectGetAjaxObj(); 368 ectAjaxCall(nsajaxobj,'GET','vsadmin/ajaxservice.'+extensionabs+'?action=notifystock&pid='+encodeURIComponent(notifystockid)+'&tpid='+encodeURIComponent(notifystocktid)+'&oid='+encodeURIComponent(notifystockoid)+'&email='+encodeURIComponent(theemail.value),notifystockcallback,null,true); 369 } 370} 371function closeinstock(){ 372 ectById('notifyinstockcover').style.display='none'; 373} 374function notifyinstock(isoption,pid,tpid,oid){ 375 if(globalquickbuyid!=='') closequickbuy(globalquickbuyid); 376 notifystockid=pid; 377 notifystocktid=tpid; 378 notifystockoid=oid;
379 ectById('notifyinstockcover').style.display=''; 380 return false; 381} 382var globallistname=''; 383function subformid(tid,listid,listname){ 384 if(ectById('ectform'+tid).listid)ectById('ectform'+tid).listid.value=listid; 385 globallistname=listname; 386 if(usehardaddtocart){ 387 var tform=ectById('ectform'+tid); 388 if(tform.onsubmit()) tform.submit(); 389 }else 390 ajaxaddcart(tid); 391 return false; 392} 393var globalquickbuyid=''; 394function displayquickbuy(qbid){ 395 var quid; 396 globalquickbuyid=qbid; 397 ectById('qbopaque'+qbid).style.display=''; 398 if(quid=ectById('wqb'+qbid+'quant'))quid.name='quant'; 399 if(quid=ectById('w'+qbid+'quant'))quid.name=''; 400 return false; 401} 402function closequickbuy(qbid){ 403 var quid; 404 if(quid=ectById('wqb'+qbid+'quant'))quid.name=''; 405 if(quid=ectById('w'+qbid+'quant'))quid.name='quant'; 406 ectById('qbopaque'+qbid).style.display='none'; 407 globalquickbuyid=''; 408 return false; 409} 410function ajaxaddcartcb(){ 411 if(ajaxobj.readyState==4){ 412 var pparam,pname,pprice,pimage,optname,optvalue,retvals=ajaxobj.responseText.split('&'); 413 try{pimage=decodeURIComponent(retvals[6])}catch(err){pimage='ERROR'} 414 var schtml='<div class="scart sccheckout">'+imgsoftcartcheckout+'</div><div class="scart scclose"><a href="#" onclick="ectById(\'opaquediv\').style.display=\'none\';return false"><img src="images/close.gif" alt="'+xxClsWin+'" /></a></div>'; 415 if(retvals[0]=='error'){ 416 ectById('scdiv').innerHTML=schtml+'<div class="scart scerror ectwarning">'+decodeURIComponent(retvals[1]) + '</div>'; 417 }else{ 418 schtml+='<div class="scart scprodsadded">'+(globallistname!=''?xxAddWiL+' '+globallistname:xxSCAdOr)+'</div>'; 419 if(retvals[0]!='') schtml+='<div class="scart scnostock">'+xxNotSto+': '+decodeURIComponent(retvals[0]) + '</div>'; 420 schtml+='<div class="scimgproducts">'+ // Image and products container 421 '<div class="scart scimage"><img class="scimage" src="'+pimage+'" alt="" /></div>'+ 422 '<div class="scart scproducts">'; // start outer div for products 423 var baseind=7; 424 for(var index=0;index<retvals[3];index++){ 425 try{pname=decodeURIComponent(retvals[baseind+1])}catch(err){pname='ERROR'} 426 try{pprice=decodeURIComponent(retvals[baseind+3])}catch(err){pprice='ERROR'} 427 schtml+='<div class="scart scproduct"><div class="scart scprodname"> '+retvals[baseind+2]+' '+pname+' '+xxHasAdd+'</div>'; 428 var prhtml='<div '+(nopriceanywhere?'style="display:none" ':'')+'class="scart scprice">'+xxPrice+(xxPrice!=''?':':'')+pprice+'</div>'; 429 var numoptions=retvals[baseind+5]; 430 baseind+=6; 431 if(numoptions>0){ 432 schtml+='<div '+(numoptions>10?'style="height:200px;overflow-y:scroll" ':'')+'class="scart scoptions">'; 433 for(var index2=0;index2<numoptions;index2++){ 434 try{optname=decodeURIComponent(retvals[baseind++])}catch(err){optname='ERROR'} 435 try{optvalue=decodeURIComponent(retvals[baseind++])}catch(err){optvalue='ERROR'} 436 schtml+='<div class="scart scoption"><div class="scart scoptname">- '+optname+':</div><div class="scart scoptvalue">'+optvalue+'</div></div>'; 437 } 438 schtml+='</div>'; 439 } 440 schtml+=prhtml+'</div>'; 441 } 442 schtml+='</div>'+ // end outer div for products 443 '</div>'+ // end image and products container 444 '<div>'; 445 try{pprice=decodeURIComponent(retvals[5])}catch(err){pprice='ERROR'} 446 if(retvals[1]==1) schtml+='<div class="scart scnostock">'+xxSCStkW+'</div>'; 447 if(retvals[2]==1) schtml+='<div class="scart scbackorder">'+xxSCBakO+'</div>'; 448 schtml+='<div class="scart sccartitems">'+xxCarCon+':'+retvals[4]+' '+xxSCItem+'</div>' + 449 '<div '+(nopriceanywhere?'style="display:none" ':'')+'class="scart sccarttotal"><span style="display:none" id="sccartdscnt" class="scart sccartdscnt">('+xxDscnts+':<span id="sccartdscamnt" class="sccartdscamnt"></span>) / </span>'+(showtaxinclusive!=0?xxCntTax+':<span id="sccarttax" class="sccarttax"></span> / ':'')+xxSCCarT+':'+pprice+'</div>' + 450 '<div class="scart sclinks"><button class="ectbutton" onclick="ectById(\'opaquediv\').style.display=\'none\'">'+xxCntShp+'</button> | <button class="ectbutton" onclick="ectById(\'opaquediv\').style.display=\'none\';document.location=\''+(cartpageonhttps?storeurlssl:'')+'cart'+extension+'\'">'+xxEdiOrd+'</button></div>' + 451 '</div>'; 452 if(softcartrelated){ 453 screlated(retvals[7]); 454 schtml+='<div id="softcartrelated" style="display:none"></div>'; 455 } 456 ectById('scdiv').innerHTML=schtml; 457 if(document.getElementsByClassName){ 458 var ectMCpm=document.getElementsByClassName('ectMCquant'); 459 for(var index=0;
459index<ectMCpm.length;index++)ectMCpm[index].innerHTML=retvals[4]; 460 ectMCpm=document.getElementsByClassName('ectMCship'); 461 for(var index=0;index<ectMCpm.length;index++)ectMCpm[index].innerHTML='<a href="'+(cartpageonhttps?storeurlssl:'')+'cart'+extension+'">'+xxClkHere+'</a>'; 462 ectMCpm=document.getElementsByClassName('ectMCtot'); 463 for(var index=0;index<ectMCpm.length;index++)ectMCpm[index].innerHTML=pprice; 464 if(retvals.length>baseind){ 465 try{pparam=decodeURIComponent(retvals[baseind++])}catch(err){pparam='-'} 466 if(ectMCpm=ectById('sccarttax'))ectMCpm.innerHTML=pparam; 467 try{pparam=decodeURIComponent(retvals[baseind++])}catch(err){pparam='-'} 468 var ectMCpm=document.getElementsByClassName('mcMCdsct'); 469 for(var index=0;index<ectMCpm.length;index++)ectMCpm[index].innerHTML=pparam; 470 ectById('sccartdscamnt').innerHTML=pparam; 471 try{pparam=decodeURIComponent(retvals[baseind++])}catch(err){pparam='-'} 472 var ectMCpm=document.getElementsByClassName('ecHidDsc'); 473 for(var index=0;index<ectMCpm.length;index++)ectMCpm[index].style.display=(pparam=='0'?'none':''); 474 ectById('sccartdscnt').style.display=(pparam=='0'?'none':''); 475 try{pparam=decodeURIComponent(retvals[baseind++])}catch(err){pparam='-'} 476 var ectMCpm=document.getElementsByClassName('mcLNitems'); 477 for(var index=0;index<ectMCpm.length;index++)ectMCpm[index].innerHTML=pparam; 478 } 479 } 480 } 481} 482} 483var scrajaxobj; 484function ajaxscrelatedcb(){ 485 if(scrajaxobj.readyState==4){ 486 if(tid=ectById('softcartrelated')){ 487 tid.innerHTML+=scrajaxobj.responseText; 488 tid.style.display=''; 489 } 490 } 491} 492function screlated(prodid){ 493 scrajaxobj=ectGetAjaxObj(); 494 scrajaxobj.onreadystatechange=ajaxscrelatedcb; 495 scrajaxobj.open("POST","vsadmin/ajaxservice."+extensionabs+"?action=screlated",true); 496 scrajaxobj.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 497 scrajaxobj.send('prodid='+encodeURIComponent(prodid)); 498} 499function ajaxaddcart(frmid){ 500 var elem=ectById('ectform'+frmid).elements; 501 var str=''; 502 var postdata='ajaxadd=true'; 503 eval('var isvalidfm=formvalidator'+frmid+'(ectById(\'ectform'+frmid+'\'))'); 504 if(isvalidfm){ 505 for(var ecti=0; ecti<elem.length; ecti++){ 506 if(elem[ecti].disabled){ 507 }else if(elem[ecti].type=='select-one'){ 508 if(elem[ecti].value!='')postdata+='&'+elem[ecti].name+'='+elem[ecti].value; 509 }else if(elem[ecti].type=='text'||elem[ecti].type=='textarea'||elem[ecti].type=='hidden'){ 510 if(elem[ecti].value!='')postdata+='&'+elem[ecti].name+'='+encodeURIComponent(elem[ecti].value); 511 }else if(elem[ecti].type=='radio'||elem[ecti].type=='checkbox'){ 512 if(elem[ecti].checked)postdata+='&'+elem[ecti].name+'='+elem[ecti].value; 513 } 514 } 515 if(ectById('qbopaque'+frmid))closequickbuy(frmid); 516 ajaxobj=ectGetAjaxObj(); 517 ajaxobj.onreadystatechange=ajaxaddcartcb; 518 ajaxobj.open("POST","vsadmin/shipservice."+extensionabs+"?action=addtocart",true); 519 ajaxobj.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 520 ajaxobj.send(postdata); 521 ectById('opaquediv').innerHTML='<div id="scdiv" class="scart scwrap"><img src="images/preloader.gif" alt="" style="margin:40px" /></div>'; 522 ectById('opaquediv').style.display=''; 523 } 524} 525var op=[], // Option Price Difference 526 aIM=[],aIML=[], // Option Alternate Image 527 dOP=[], // Dependant Options 528 dIM=[], // Default Image 529 pIM=[],pIML=[], // Product Image 530 pIX=[], // Product Image Index 531 ot=[], // Option Text 532 pp=[], // Product Price 533 pl=[], // List Price 534 pi=[], // Alternate Product Image 535 or=[], // Option Alt Id 536 cp=[], // Current Price 537 oos=[], // Option Out of Stock Id 538 rid=[], // Resulting product Id 539 otid=[], // Original product Id 540 opttype=[],optperc=[],optmaxc=[],optacpc=[],fid=[],oS=[],ps=[]; 541function checkStock(x,i,backorder){ 542 if(i!=''&&(oS[i]>0||or[i]))return(true); 543 if(backorder&&(globBakOrdChk||confirm(xxBakOpt)))return(globBakOrdChk=true); 544 if(notifybackinstock) 545 notifyinstock(true,x.form.id.value,x.form.id.value,i); 546 else 547 alert(xxOptOOS); 548 x.focus();return(false); 549} 550function dummyfunc(){}; 551function pricechecker(cnt,i){ 552 if(i!=''&&i in op&&!isNaN(op[i]))return(op[i]);return(0); // Safari 553} 554function regchecker(cnt,i){ 555 if(i!='')return(or[i]);return(''); 556} 557function enterValue(x){ 558 ectaddclass(x,'ectwarning'); 559 alert(xxPrdEnt); 560 x.focus(); 561 return(false); 562}
563function invalidChars(x){ 564 alert(xxInvCha+" "+x); 565 return(false); 566} 567function enterDigits(x){ 568 ectaddclass(x,'ectwarning'); 569 alert(xxDigits); 570 x.focus(); 571 return(false); 572} 573function removemultiwarning(pdiv){ 574 var ti=pdiv.getElementsByClassName('ecttextinput'); 575 for(var i=0; i<ti.length; i++)ectremoveclass(ti[i],'ectwarning'); 576} 577function enterMultValue(pdiv){ 578 var ti=pdiv.getElementsByClassName('ecttextinput'); 579 for(var i=0; i<ti.length; i++)ectaddclass(ti[i],'ectwarning'); 580 alert(xxEntMul); 581 return(false); 582} 583function chooseOption(x){ 584 if(x.type=='select-one') 585 ectaddclass(x,'ectwarning'); 586 else{ 587 var ti=x.parentNode.parentNode.getElementsByTagName('INPUT'); 588 for(var i=0; i<ti.length; i++)ectaddclass(ti[i],'ectwarning'); 589 } 590 alert(xxPrdChs); 591 x.focus();return(false); 592} 593function dataLimit(x,numchars){ 594 ectaddclass(x,'ectwarning'); 595 alert(xxPrd255.replace(255,numchars)); 596 x.focus();return(false); 597} 598var hiddencurr=''; 599function addCommas(ns,decs,thos){ 600 ns=ns.toString().replace(/\./,decs); 601 if((dpos=ns.indexOf(decs))<0)dpos=ns.length; 602 dpos-=3; 603 while(dpos>0){ 604 ns=ns.substr(0,dpos)+thos+ns.substr(dpos); 605 dpos-=3; 606 } 607 return(ns); 608} 609function formatprice(i,currcode,currformat){ 610currcode=currcode||''; 611currformat=currformat||''; 612i=(Math.round(i*100)/100);if(hiddencurr=='')hiddencurr=ectById('hiddencurr').value;var pTemplate=hiddencurr; 613if(currcode!='') pTemplate=' ' + zero2dps + (currcode!=' '?'<strong>'+currcode+'<\/strong>':''); 614 if(currcode==' JPY'||(!hasdecimals&&currcode==''))i=Math.round(i).toString(); 615 else if(hasdecimals){ 616 if(i==Math.round(i))i=i.toString()+".00"; 617 else if(i*10.0==Math.round(i*10.0))i=i.toString()+"0"; 618 else if(i*100.0==Math.round(i*100.0))i=i.toString(); 619 } 620 i=addCommas(i,currDecimalSep,currThousandsSep); 621 if(currcode!='')pTemplate=currformat.toString().replace(/%s/,i.toString()); 622 else pTemplate=pTemplate.toString().replace(/\d[,.]*\d*/,i.toString()); 623 return(pTemplate); 624} 625function vsdecimg(timg){ 626 return decodeURIComponent(timg); 627} 628function updateprodimage(theitem,isnext){ 629 return updateprodimage2(false,theitem,isnext); 630} 631function sz(szid,szprice,szlist,szimage,szstock){ 632 if(usestockmanagement) ps[szid]=szstock; 633 pp[szid]=szprice; 634 pl[szid]=szlist; 635 if(szimage!='')pi[szid]=szimage; 636} 637function gfid(tid){ 638 if(tid in fid) 639 return(fid[tid]); 640 fid[tid]=ectById(tid); 641 return(fid[tid]); 642} 643function applyreg(arid,arreg){ 644 if(arreg&&arreg!=''){ 645 arreg=arreg.replace('%s', arid); 646 if(arreg.indexOf(' ')>0){ 647 var ida=arreg.split(' ', 2); 648 arid=arid.replace(ida[0], ida[1]); 649 }else 650 arid=arreg; 651 } 652 return(arid); 653} 654function getaltid(theid,optns,prodnum,optnum,optitem,numoptions){ 655 var thereg=''; 656 for(var index=0; index<numoptions; index++){ 657 if(Math.abs(opttype[index])==4){ 658 thereg=or[optitem]; 659 }else if(Math.abs(opttype[index])==2){ 660 if(optnum==index) 661 thereg=or[optns.options[optitem].value]; 662 else{ 663 var opt=gfid("optn"+prodnum+"x"+index); 664 if(!opt.disabled)thereg=or[opt.options[opt.selectedIndex].value]; 665 } 666 }else if(Math.abs(opttype[index])==1){ 667 opt=document.getElementsByName("optn"+prodnum+"x"+index); 668 if(optnum==index){ 669 thereg=or[opt[optitem].value]; 670 }else{ 671 for(var y=0;y<opt.length;y++) 672 if(opt[y].checked&&!opt[y].disabled) thereg=or[opt[y].value]; 673 } 674 }else 675 continue; 676 theid=applyreg(theid,thereg); 677 } 678 return(theid); 679} 680function getnonaltpricediff(optns,prodnum,optnum,optitem,numoptions,theoptprice){ 681 var nonaltdiff=0; 682 for(index=0; index<numoptions; index++){ 683 var optid=''; 684 if(Math.abs(opttype[index])==4){ 685 optid=optitem; 686 }else if(Math.abs(opttype[index])==2){ 687 if(optnum==index) 688 optid=optns.options[optitem].value; 689 else{ 690 var opt=gfid("optn"+prodnum+"x"+index); 691 if(opt.style.display=='none'||opt.disabled)continue; 692 optid=opt.options[opt.selectedIndex].value; 693 } 694 }else if(Math.abs(opttype[index])==1){ 695 var opt=document.getElementsByName("optn"+prodnum+"x"+index); 696 if(optnum==index) 697 optid=opt[optitem].value; 698 else{ 699 for(var y=0;y<opt.length;y++){ if(opt[y].checked&&opt[y].style.display!='none'&&!opt[y].disabled)optid=opt[y].value; } 700 } 701 }else 702 continue;
703 if(!or[optid]&&optid in op&&!isNaN(op[optid]))//isNaN for Safari Bug 704 if(optperc[index])nonaltdiff+=(op[optid]*theoptprice)/100.0;else nonaltdiff+=op[optid]; 705 } 706 return(nonaltdiff); 707} 708function ectaddclass(elem,classname){ 709 elem.classList.add(classname); 710} 711function ectremoveclass(elem,classname){ 712 elem.classList.remove(classname); 713} 714function ecttoggleclass(elem,classname){ 715 if(elem.className.indexOf(classname)<0) elem.classList.add(classname); else elem.classList.remove(classname); 716} 717function updateprice(numoptions,prodnum,prodprice,listprice,origid,thetax,stkbyopts,taxexmpt,backorder){ 718 var baseid=origid,origprice=prodprice,canresolve=true,hasiteminstock=true,hasregex=false,hasaltid=false,hasmultioption=false,canresolve=true,allbutlastselected=true; 719 oos[prodnum]=''; 720 if(typeof stockdisplaythreshold === "undefined") stockdisplaythreshold=0; 721 for(cnt=0; cnt<numoptions; cnt++){ 722 var optid=0; 723 if(Math.abs(opttype[cnt])==2){ 724 optns=gfid("optn"+prodnum+"x"+cnt); 725 if(optns.disabled) continue; 726 optid=optns.options[optns.selectedIndex].value; 727 baseid=applyreg(baseid,regchecker(prodnum,optid)); 728 if(optid==''&&cnt<numoptions-1)allbutlastselected=false; 729 }else if(Math.abs(opttype[cnt])==1){ 730 optns=document.getElementsByName("optn"+prodnum+"x"+cnt); 731 if(optns[0].disabled) continue; 732 var hasonechecked=false; 733 for(var i=0;i<optns.length;i++){ if(optns[i].checked){optid=optns[i].value;hasonechecked=true;baseid=applyreg(baseid,regchecker(prodnum,optid));}} 734 if(!hasonechecked&&cnt<numoptions-1)allbutlastselected=false; 735 } 736 if(optid in oS&&!(optid in or)&&oS[optid]<=0)hasiteminstock=false; 737 if(optid in or)hasregex=true; 738 if(baseid in pp)prodprice=pp[baseid]; 739 if(baseid in pl)listprice=pl[baseid]; 740 } 741 if(usestockmanagement&&stkbyopts){ 742 var buttonid=ectById('ectaddcart'+prodnum); 743 if(buttonid&&buttonid.type=='button'){ 744 if(hasregex)hasiteminstock=ps[baseid]>0; 745 if(hasiteminstock){ 746 buttonid.innerHTML=xxAddToC; 747 buttonid.disabled=false; 748 }else if(notifybackinstock) 749 buttonid.innerHTML=xxNotBaS; 750 else{ 751 buttonid.innerHTML=xxOutStok; 752 buttonid.disabled=true; 753 } 754 } 755 } 756 var baseprice=prodprice; 757 for(cnt=0; cnt<numoptions; cnt++){ 758 if(Math.abs(opttype[cnt])==2){ 759 optns=gfid("optn"+prodnum+"x"+cnt); 760 if(optns.disabled)continue; 761 prodprice+=optperc[cnt]?(baseprice*pricechecker(prodnum,optns.options[optns.selectedIndex].value))/100.0:pricechecker(prodnum,optns.options[optns.selectedIndex].value); 762 }else if(Math.abs(opttype[cnt])==1){ 763 optns=document.getElementsByName("optn"+prodnum+"x"+cnt); 764 for(var i=0;i<optns.length;i++){ if(optns[i].checked&&optns[i].style.display!='none'&&!optns[i].disabled) prodprice+=(optperc[cnt]?(baseprice*pricechecker(prodnum,optns[i].value))/100.0:pricechecker(prodnum,optns[i].value)); } 765 } 766 } 767 var totalprice=prodprice; 768 var prodtax=(showtaxinclusive==2?(!taxexmpt?prodprice*thetax/100.0:0):0); 769 for(cnt=0; cnt<numoptions; cnt++){ 770 if(Math.abs(opttype[cnt])==2){ 771 var optns=gfid("optn"+prodnum+"x"+cnt); 772 for(var i=0;i<optns.length;i++){ 773 if(!optns.disabled&&optns.options[i].value!=''){ 774 theid=origid; 775 optns.options[i].text=ot[optns.options[i].value]; 776 theid=getaltid(theid,optns,prodnum,cnt,i,numoptions); 777 theoptprice=(theid in pp?pp[theid]:origprice); 778 if(pi[theid]&&pi[theid]!=''&&or[optns.options[i].value]){aIM[optns.options[i].value]=pi[theid].split('*')[0];if(pi[theid].split('*')[1])aIML[optns.options[i].value]=pi[theid].split('*')[1];} 779 if(usestockmanagement){ 780 theoptstock=((theid in ps&&or[optns.options[i].value])||!stkbyopts ? ps[theid] : oS[optns.options[i].value]); 781 if(theoptstock<=0&&optns.selectedIndex==i){oos[prodnum]="optn"+prodnum+"x"+cnt;rid[prodnum]=theid;otid[prodnum]=origid;} 782 } 783 canresolve=(!or[optns.options[i].value]||theid in pp)?true:false; 784 var staticpricediff=getnonaltpricediff(optns,prodnum,cnt,i,numoptions,theoptprice); 785 theoptpricediff=(theoptprice+staticpricediff)-totalprice; 786 if(!noprice && !hideoptpricediffs){ if(Math.round(theoptpricediff*100)!=0)optns.options[i].text+=' ('+(absoptionpricediffs?'':(theoptpricediff>0?'+':'-'))+formatprice(Math.abs(Math.round(((absoptionpricediffs?prodprice+prodtax:0)+theoptpricediff+(showtaxinclusive==2?(!taxexmpt?theo
786ptpricediff*thetax/100.0:0):0))*100)/100.0))+')';} 787 if(usestockmanagement && showinstock && !noshowoptionsinstock && (theoptstock<stockdisplaythreshold||stockdisplaythreshold==0)) if(stkbyopts&&canresolve)optns.options[i].text+=xxOpSkTx.replace('%s',Math.max(theoptstock,0)); 788 if(usestockmanagement?theoptstock>0||!stkbyopts||!canresolve:true) ectremoveclass(optns.options[i],'oostock');else ectaddclass(optns.options[i],'oostock'); 789 if(allbutlastselected&&cnt==numoptions-1&&!canresolve)ectaddclass(optns.options[i],'oostock'); 790 if(or[optns.options[i].value])hasaltid=true; 791 } 792 } 793 }else if(Math.abs(opttype[cnt])==1){ 794 optns=document.getElementsByName("optn"+prodnum+"x"+cnt); 795 for(var i=0;i<optns.length;i++){ 796 if(!optns[i].disabled){ 797 theid=origid; 798 optn=gfid("optn"+prodnum+"x"+cnt+"y"+i); 799 optn.innerHTML=ot[optns[i].value]; 800 theid=getaltid(theid,optns,prodnum,cnt,i,numoptions); 801 theoptprice=(theid in pp?pp[theid]:origprice); 802 if(pi[theid]&&pi[theid]!=''&&or[optns[i].value]){aIM[optns[i].value]=pi[theid].split('*')[0];if(pi[theid].split('*')[1])aIML[optns[i].value]=pi[theid].split('*')[1];} 803 if(usestockmanagement){ 804 theoptstock=((theid in ps&&or[optns[i].value])||!stkbyopts ? ps[theid] : oS[optns[i].value]); 805 if(theoptstock<=0&&optns[i].checked){oos[prodnum]="optn"+prodnum+"x"+cnt+"y"+i;rid[prodnum]=theid;otid[prodnum]=origid;} 806 } 807 canresolve=(!or[optns[i].value]||theid in pp)?true:false; 808 var staticpricediff=getnonaltpricediff(optns,prodnum,cnt,i,numoptions,theoptprice); 809 theoptpricediff=(theoptprice+staticpricediff)-totalprice; 810 if(!noprice && !hideoptpricediffs){ if(Math.round(theoptpricediff*100)!=0)optn.innerHTML+=' ('+(absoptionpricediffs?'':(theoptpricediff>0?'+':'-'))+formatprice(Math.abs(Math.round(((absoptionpricediffs?prodprice+prodtax:0)+theoptpricediff+(showtaxinclusive==2?(!taxexmpt?theoptpricediff*thetax/100.0:0):0))*100)/100.0))+')';} 811 if(usestockmanagement && showinstock && !noshowoptionsinstock && (theoptstock<stockdisplaythreshold||stockdisplaythreshold==0)) if(stkbyopts&&canresolve)optn.innerHTML+=xxOpSkTx.replace('%s',Math.max(theoptstock,0)); 812 if(usestockmanagement?theoptstock>0||!stkbyopts||!canresolve:true)ectremoveclass(optn,'oostock');else ectaddclass(optn,'oostock'); 813 if(allbutlastselected&&cnt==numoptions-1&&!canresolve)ectaddclass(optn,'oostock'); 814 if(or[optns[i].value])hasaltid=true; 815 } 816 } 817 }else if(Math.abs(opttype[cnt])==4){ 818 var tstr="optm"+prodnum+"x"+cnt+"y"; 819 var tlen=tstr.length; 820 var optns=document.getElementsByTagName("input"); 821 hasmultioption=true; 822 for(var i=0;i<optns.length;i++){ 823 if(optns[i].id.substr(0,tlen)==tstr){ 824 theid=origid; 825 var oid=optns[i].name.substr(4); 826 var optn=optns[i] 827 var optnt=gfid(optns[i].id.replace(/optm/,"optx")); 828 optnt.innerHTML=' - '+ot[oid]; 829 theid=getaltid(theid,optns,prodnum,cnt,oid,numoptions); 830 theoptprice=(theid in pp?pp[theid]:origprice); 831 if(usestockmanagement){ 832 theoptstock=((theid in ps&&or[oid])||!stkbyopts ? ps[theid] : oS[oid]); 833 if(theoptstock<=0&&optns[i].checked){oos[prodnum]="optm"+prodnum+"x"+cnt+"y"+i;rid[prodnum]=theid;otid[prodnum]=origid;} 834 canresolve=(!or[oid]||(applyreg(theid,or[oid]) in ps))?true:false; 835 } 836 var staticpricediff=getnonaltpricediff(optns,prodnum,cnt,oid,numoptions,theoptprice); 837 theoptpricediff=(theoptprice+staticpricediff)-totalprice; 838 if(!noprice && !hideoptpricediffs){ if(Math.round(theoptpricediff*100)!=0)optnt.innerHTML+=' ('+(absoptionpricediffs?'':(theoptpricediff>0?'+':'-'))+formatprice(Math.abs(Math.round(((absoptionpricediffs?prodprice+prodtax:0)+theoptpricediff+(showtaxinclusive==2?(!taxexmpt?theoptpricediff*thetax/100.0:0):0))*100)/100.0))+')';} 839 if(usestockmanagement && showinstock && !noshowoptionsinstock && (theoptstock<stockdisplaythreshold||stockdisplaythreshold==0)) if(stkbyopts&&canresolve&&!(or[oid]&&theoptstock<=0))optnt.innerHTML+=xxOpSkTx.replace('%s',Math.max(theoptstock,0)); 840 if(usestockmanagement) if(theoptstock>0||(or[oid]&&!canresolve)||backorder){ectremoveclass(optn,'oostock');optn.disabled=false;optn.style.backgroundColor='#FFFFFF';}else{ectaddclass(optn,'oostock');optn.disabled=true;optn.style.backgroundColor='#EBEBE4';} 841 if(or[oid])hasaltid=true; 842 } 843 } 844 } 845 } 846 if(hasmultioption)oos[prodnum]=''; 847 if((!cp[prodnum]||cp[prodnum]==0)&&prodprice==0)return; 848 cp[prodnum]=prodprice; 849 var lpt=xxListPrice,yst=yousavetext; 850 if(!noprice){ 851 var qbprefix; 852 for(var qbind=0;qbind<=1;qbind++){ 853 qbprefix=qbind==0?'':'qb'; 854 if(ectById(qbprefix+'taxmsg'+prodnum))ectById(qbprefix+'taxmsg'+prodnum).style.display=''; 855 if(!noupdateprice) if(ectById(qbprefix+'pricediv'+prodnum)) ectById(qbprefix+'pricediv'+prodnum).innerHTML=(pricezeromessage!=''&&prodprice==0?pricezeromessage:formatprice(prodprice+(showtaxinclusive==2?(!taxexmpt?prodprice*thetax/100.0:0):0))); 856 if(showtaxinclusive==1 || ectbody3layouttaxinc){ if(!taxexmpt&&prodprice!=0){ if(ectById(qbprefix+'pricedivti'+prodnum))ectById(qbprefix+'pricedivti'+prodnum).innerHTML=formatprice(prodprice+(prodprice*thetax/100.0)); }else{ if(ectById(qbprefix+'taxmsg'+prodnum))ectById(qbprefix+'taxmsg'+prodnum).style.display='none'; }} 857
858 if((currRate1!=0&&currSymbol1!='')||(currRate2!=0&&currSymbol2!='')||(currRate3!=0&&currSymbol3!='')){ 859 if(ectById(qbprefix+'pricedivec'+prodnum)){ 860 ectById(qbprefix+'pricedivec'+prodnum).innerHTML=prodprice==0?'': 861 (currRate1!=0&&currSymbol1!=''?formatprice(prodprice*currRate1,currSymbol1,currFormat1)+currencyseparator:'') + 862 (currRate2!=0&&currSymbol2!=''?formatprice(prodprice*currRate2,currSymbol2,currFormat2)+currencyseparator:'') + 863 (currRate3!=0&&currSymbol3!=''?formatprice(prodprice*currRate3,currSymbol3,currFormat3):''); 864 } 865 } 866 if(ectById(qbprefix+'listdivec'+prodnum)){var nlp=(baseprice>0?prodprice*(listprice/baseprice):listprice);ectById(qbprefix+'listdivec'+prodnum).style.display=(nlp>prodprice?'':'none');if(showtaxinclusive==2) nlp+=(!taxexmpt?nlp*thetax/100.0:0);var ysp=nlp-(prodprice+(showtaxinclusive==2?(!taxexmpt?prodprice*thetax/100.0:0):0));ectById(qbprefix+'listdivec'+prodnum).innerHTML=lpt.replace(/%s/,formatprice(nlp)) + (ysp>0?yst.replace(/%s/,formatprice(ysp)):'');} 867 } 868 } 869} 870function dependantopts(frmnum){ 871 var objid,thisdep,depopt='',grpid,alldeps=[]; 872 var allformelms=ectById('ectform'+frmnum).elements; 873 for (var iallelems=0; iallelems<allformelms.length; iallelems++){ 874 objid=allformelms[iallelems]; 875 thisdep=''; 876 if(objid.type=='select-one'){ 877 thisdep=dOP[objid[objid.selectedIndex].value]; 878 }else if(objid.type=='checkbox'||objid.type=='radio'){ 879 if(objid.checked)thisdep=dOP[objid.value]; 880 } 881 if(thisdep)alldeps=alldeps.concat(thisdep); 882 } 883 for(var iallelems=0;iallelems<allformelms.length;iallelems++){ 884 objid=allformelms[iallelems]; 885 if(grpid=parseInt(objid.getAttribute("data-optgroup"))){ 886 if(objid.getAttribute("data-isdep")){ 887 var isdisabled=(alldeps.indexOf(grpid)<0),haschanged=isdisabled!=objid.disabled; 888 objid.disabled=isdisabled; 889 var maxindex=0,cobj=objid.parentNode; 890 for(var cind=0; cind<3; cind++){ 891 cobj=cobj.parentNode; 892 if(cobj.id.substr(0,4)=='divc'){cobj.style.display=isdisabled?'none':'';break;} 893 } 894 if(haschanged){if(objid.onchange)objid.onchange();else if(objid.onclick)objid.onclick();} 895 } 896 } 897 } 898} 899var globBakOrdChk; 900function ectvalidate(theForm,numoptions,prodnum,stkbyopts,backorder){ 901 globBakOrdChk=false,oneoutofstock=false; 902 for(cnt=0; cnt<numoptions; cnt++){ 903 if(Math.abs(opttype[cnt])==4){ 904 var validmulti=''; 905 var cntnr=ectById('divc'+prodnum+'x'+cnt); 906 if(cntnr&&cntnr.style.display=='none')continue; 907 var intreg=/^(\d*)$/;var inputs=theForm.getElementsByTagName('input');var tt=''; 908 for(var i=0;i<inputs.length;i++){ 909 if(inputs[i].type=='text'&&inputs[i].id.substr(0,4)=='optm'){ 910 ectremoveclass(inputs[i],'ectwarning'); 911 validmulti=inputs[i]; 912 if(! inputs[i].value.match(intreg))return(enterDigits(inputs[i]));tt+=inputs[i].value; 913 if(usestockmanagement) if(inputs[i].value!=''&&oS[inputs[i].name.substr(4)]<=0)oneoutofstock=true; 914 } 915 } 916 if(tt=='')return(enterMultValue(validmulti.parentNode.parentNode)); 917 }else if(Math.abs(opttype[cnt])==3||Math.abs(opttype[cnt])==5){ 918 var voptn=eval('theForm.voptn'+cnt); 919 if(voptn.disabled)continue; 920 if(optacpc[cnt].length>0){try{var re=new RegExp("["+optacpc[cnt]+"]","g");}catch(err){alert(err.message);}if(voptn.value.replace(re,"")!='')return(invalidChars(voptn.value.replace(re,""))); } 921 if((opttype[cnt]==3||opttype[cnt]==5)&&voptn.value=='')return(enterValue(voptn)); 922 if(voptn.value.length>(optmaxc[cnt]>0?optmaxc[cnt]:txtcollen))return(dataLimit(voptn,optmaxc[cnt]>0?optmaxc[cnt]:txtcollen)); 923 ectremoveclass(voptn,'ectwarning'); 924 }else if(Math.abs(opttype[cnt])==2){ 925 optn=ectById("optn"+prodnum+"x"+cnt); 926 if(optn.disabled)continue; 927 if(opttype[cnt]==2){ if(optn.selectedIndex==0)return(chooseOption(eval('theForm.optn'+cnt))); } 928 if(stkbyopts&&optn.options[optn.selectedIndex].value!=''){ if(!checkStock(optn,optn.options[optn.selectedIndex].value,backorder))return(false); } 929 }else if(Math.abs(opttype[cnt])==1){ 930 havefound='';optns=document.getElementsByName('optn'+prodnum+'x'+cnt); 931 if(optns[0].disabled)continue; 932 if(opttype[cnt]==1){ for(var i=0; i<optns.length; i++) if(optns[i].checked)havefound=optns[i].value;if(havefound=='')return(chooseOption(optns[0])); }
933 if(stkbyopts){ if(havefound!=''){if(!checkStock(optns[0],havefound,backorder))return(false);} } 934 } 935 } 936 if(usestockmanagement){ 937 if(backorder&&oneoutofstock&&!globBakOrdChk){if(!confirm(xxBakOpt))return(false);} 938 } 939 if(oos[prodnum]&&oos[prodnum]!=''&&!backorder){ 940 if(notifybackinstock) notifyinstock(true,otid[prodnum],rid[prodnum],0); else alert(xxOptOOS); 941 ectById(oos[prodnum]).focus();return(false); 942 } 943 return(true); 944} 945function quantup(tobjid,qud){ 946 tobj=ectById('w'+tobjid+'quant'); 947 if(isNaN(parseInt(tobj.value)))tobj.value=1;else if(qud==1)tobj.value=parseInt(tobj.value)+1;else tobj.value=Math.max(1,parseInt(tobj.value)-1); 948 if(ectById('qnt'+tobjid+'x'))ectById('qnt'+tobjid+'x').value=tobj.value; 949} 950function ectgocheck(tloc){ 951 if(tloc.substr(0,1).toLowerCase()=='/'||tloc.substr(0,5).toLowerCase()=='http:'||tloc.substr(0,6).toLowerCase()=='https:') 952 ectgoabs(tloc); 953 else 954 ectgonoabs(tloc); 955} 956function ectgoabs(tloc){ 957document.location=tloc; 958} 959function ectgonoabs(tloc){ 960document.location=(((ECTbh=document.getElementsByTagName('base')).length>0&&tloc.charAt(0)!='/'?ECTbh[0].href+'/':'')+tloc).replace(/([^:]\/)\/+/g,'$1'); 961} 962// ECT Slider 963window.slidertimeout=[]; 964window.slide_index=[]; 965window.slide_repeat=[]; 966function changeectslider(n,sliderid){ 967 ect_displayslider(window.slide_index[sliderid]+=n,sliderid); 968} 969function ect_displayslider(n,sliderid){ 970 var slides; 971 if(sliderid!='') 972 slides = ectById(sliderid).getElementsByClassName("sliderimages"); 973 else 974 slides = document.getElementsByClassName("sliderimages"); 975 if(slides.length>0){ 976 if (n > slides.length){ window.slide_index[sliderid]=1 } 977 if (n < 1){ window.slide_index[sliderid]=slides.length } 978 for(var i = 0; i < slides.length; i++){ 979 slides[i].style.opacity=0; 980 slides[i].style.zIndex='1'; 981 } 982 slides[window.slide_index[sliderid]-1].style.opacity=1; 983 slides[window.slide_index[sliderid]-1].style.zIndex='2'; 984 clearTimeout(window.slidertimeout[sliderid]); 985 window.slidertimeout[sliderid]=setTimeout(function(){ changeectslider(1,sliderid); }, window.slide_repeat[sliderid]); 986 } 987} 988function ect_slider(sliderepeat,sliderid){ 989 if(sliderid===undefined)sliderid=''; 990 document.addEventListener("DOMContentLoaded",function(){doect_slider(sliderepeat,sliderid);}); 991} 992function doect_slider(sliderepeat,sliderid){ 993 var slides; 994 if(sliderid!='') 995 slides = ectById(sliderid) 996 else 997 slides = document.getElementsByClassName("slidercontainer")[0]; 998 slides.innerHTML+='<a class="sliderarrow sliderleft" onclick="changeectslider(-1,\''+sliderid+'\')">«</a><a class="sliderarrow sliderright" onclick="changeectslider(1,\''+sliderid+'\')">»</a>'; 999 window.slide_index[sliderid]=1; 1000 window.slide_repeat[sliderid]=sliderepeat; 1001 ect_displayslider(1,sliderid); 1002} 1003// Mega Menu 1004function ect_megamenu(hamburger_color){ 1005 document.addEventListener("DOMContentLoaded",function(){doect_megamenu(hamburger_color);}); 1006} 1007function doect_megamenu(hamburger_color){ 1008 if (hamburger_color===undefined) hamburger_color="#000000"; 1009 function fadeIn(el, time){ 1010 el.style.opacity = 0; 1011 el.style.display='block'; 1012 var tick = function(){ 1013 el.style.opacity=parseFloat(el.style.opacity) + (1 / (time / 10)); 1014 if(parseFloat(el.style.opacity) < 1) setTimeout(tick, 10); 1015 }; 1016 tick(); 1017 } 1018 function fadeOut(el, time){ 1019 el.style.opacity = 1; 1020 var tick = function(){ 1021 el.style.opacity=parseFloat(el.style.opacity) - (1 / (time / 10)); 1022 if(parseFloat(el.style.opacity) > 0) 1023 setTimeout(tick, 10); 1024 else 1025 el.style.display='none'; 1026 }; 1027 tick(); 1028 } 1029 function fadeToggle(el, time){ 1030 if(el.style.opacity > 0) 1031 fadeOut(el, time); 1032 else 1033 fadeIn(el, time); 1034 } 1035 function mouseovermega(event,isover){ 1036 if (document.documentElement.clientWidth > 950) { 1037 if(isover) event.target.classList.add('ectmega-is-open'); else event.target.classList.remove('ectmega-is-open'); 1038 var elems=event.target.querySelectorAll('ul'); 1039 for(var i=0, len=elems.length; i<len; ++i) 1040 if(isover) fadeIn(elems[i],150); else fadeOut(elems[i],150); 1041 event.preventDefault(); 1042 } 1043 } 1044 function clickmegasub(event){ 1045 if (document.documentElement.clientWidth <= 950) { 1046 var elems=event.target.querySelectorAll('ul'); 1047 for(var i=0, len=elems.length; i<len; ++i) 1048 fadeToggle(elems[i],150); 1049 } 1050 } 1051 function clickmegamain(event){ 1052 var elems=document.querySelectorAll('.ectmegamenu > ul'); 1053 for(var i=0, len=elems.length; i<len; ++i) 1054 ecttoggleclass(elems[i],'show-on-mobile'); 1055 event.preventDefault(); 1056 } 1057 var elems=document.querySelectorAll('.ectmegamenu > ul > li'); 1058 for(var i=0, len=elems.length; i<len; ++i){ 1059 if(elems[i].querySelector('ul')){ 1060 elems[i].classList.add('ectmega-has-dropdown'); 1061 elems[i].addEventListener('mouseenter', function(e){mouseovermega(e,true)}); 1062 elems[i].addEventListener('mouseleave', function(e){mouseovermega(e,false)}); 1063 elems[i].addEventListener('click', clickmegasub); 1064 } 1065 } 1066 var elems=document.querySelectorAll('.ectmegamenu > ul > li > ul'); 1067 for(var i=0, len=elems.length; i<len; ++i){ 1068 if(!elems[i].querySelector('ul')) 1069 elems[i].classList.add('normal-sub'); 1070 } 1071 var element = document.querySelector('.ectmegamenu > ul'); 1072 if(element){ 1073 var newDiv = document.createElement('div'); 1074 newDiv.className='ectmegamobile'; 1075 newDiv.style='cursor:pointer'; 1076 newDiv.addEventListener('click', clickmegamain); 1077 newDiv.innerHTML='<span class="megamobiletext"></span><svg class="megahamburger" width="32px" viewBox="0 0 181 135"><g><path style="fill:'+hamburger_color+';fill-opacity:1;stroke:'+hamburger_color+';stroke-width:18.465;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 30,27 H 165" /><path style="fill:'+hamburger_color+';fill-opacity:1;stroke:'+hamburger_color+';stroke-width:18.465;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 30,66 H 165" /><path style="fill:'+hamburger_color+';fill-opacity:1;stroke:'+hamburger_color+';stroke-width:18.465;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 30,105 H 165" /></g></svg>'; 1078 element.parentNode.insertBefore(newDiv,element); 1079 } 1080} 1081function ectexpandreview(reviewnum){ 1082 ectById('extracomments' + reviewnum).style.display=''; 1083 ectById('extracommentsdots' + reviewnum).style.display='none'; 1084} 1085// START: Auto Search Function 1086var ectAutoSearchTmr; 1087var ectAutoAjaxO 1088var ectAutoSrchCSI=-1; 1089var ectAutoSrchExt=''; 1090function ectAutoSrchOnClick(oSelect,objid){ 1091 ectById(objid).value=oSelect.innerText; 1092 ectById(objid+'form').submit(); 1093} 1094function ectAutoDoHideCombo(objid){ 1095 ectById('select'+objid).style.display='none'; 1096} 1097function ectAutoHideCombo(oText){ 1098 setTimeout("ectAutoDoHideCombo('"+oText.id+"')",300); 1099} 1100function ectAutoClrSrchClasses(objid){ 1101 var oSelect=ectById('select'+objid); 1102 for(var sind=0;sind<oSelect.childNodes.length;sind++){ 1103 oSelect.childNodes[sind].className=''; 1104 } 1105} 1106function ectAutoAjaxCB(objid){ 1107 if(ectAutoAjaxO.readyState==4){
1108 var resarr=ectAutoAjaxO.responseText.split('&'); 1109 var index,newy; 1110 var oSelect=ectById('select'+objid); 1111 oSelect.style.display=ectAutoAjaxO.responseText==''?'none':''; 1112 var act=resarr[0].replace(/\d/g,''); 1113 for(index=0; index<resarr.length-1; index++){ 1114 if(index<oSelect.childNodes.length) 1115 newy=oSelect.childNodes[index]; 1116 else 1117 newy=document.createElement('div'); 1118 newy.onclick=function(){ectAutoSrchOnClick(this,objid);}; 1119 newy.onmouseover=function(){ectAutoClrSrchClasses(objid);}; 1120 newy.innerHTML=decodeURIComponent(resarr[index]); 1121 if(index>=oSelect.childNodes.length) 1122 oSelect.appendChild(newy); 1123 } 1124 if(oSelect){ 1125 for(var ii=oSelect.childNodes.length-1;ii>=index;ii--) 1126 oSelect.removeChild(oSelect.childNodes[ii]); 1127 } 1128 } 1129 } 1130function ectAutoSrchPopList(objid){ 1131 var stext=ectById(objid).value.toLowerCase(); 1132 var catobj=ectById('scat'); 1133 var cattxt=''; 1134 if(catobj)cattxt='&listcat='+catobj[catobj.selectedIndex].value; 1135 ectAutoAjaxO=ectGetAjaxObj(); 1136 ectAutoAjaxO.onreadystatechange=function(){ectAutoAjaxCB(objid);}; 1137 ectAutoAjaxO.open("POST", "vsadmin/ajaxservice."+ectAutoSrchExt+"?action=autosearch", true); 1138 ectAutoAjaxO.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 1139 ectAutoAjaxO.send('listtext='+encodeURIComponent(stext)+cattxt); 1140} 1141function ectAutoSrchKeydown(oText,e,textn){ 1142 ectAutoSrchExt=textn; 1143 var objid=oText.id; 1144 var oSelect=ectById('select'+objid); 1145 var keyCode=e.keyCode; 1146 if(keyCode==40 || keyCode==38){ // Up / down arrows 1147 var numelements=0; 1148 for(var sind=0;sind<oSelect.childNodes.length;sind++){ 1149 if(oSelect.childNodes[sind].nodeType==1) numelements++; 1150 } 1151 if(numelements>0){ 1152 oSelect.style.display=''; 1153 if(keyCode==40){ 1154 ectAutoSrchCSI++; 1155 if(ectAutoSrchCSI>=numelements)ectAutoSrchCSI=numelements-1; 1156 }else{ 1157 ectAutoSrchCSI--; 1158 if(ectAutoSrchCSI<0)ectAutoSrchCSI=0; 1159 } 1160 var rowc=0; 1161 for(var sind=0;sind<oSelect.childNodes.length;sind++){ 1162 oSelect.childNodes[sind].className=rowc==ectAutoSrchCSI?'autosearchselected':''; 1163 rowc++; 1164 } 1165 if(oSelect.childNodes[ectAutoSrchCSI]){ 1166 ectById(objid).value=oSelect.childNodes[ectAutoSrchCSI].innerText; 1167 } 1168 } 1169 }else if(keyCode==13){ 1170 oText.form.submit(); 1171 return false; 1172 }else if((keyCode>=32||keyCode==8)&&keyCode!=36){ 1173 clearTimeout(ectAutoSearchTmr); 1174 ectAutoSearchTmr=setTimeout("ectAutoSrchPopList('"+objid+"')",600); 1175 } 1176 return true; 1177}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.