var TIMER=5,SPEED=10,WRAPPER="wrapper",TIMEOUTID,DIALOGACTIVE=0,DIALOGFOCUSTARGET;function pageWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body?document.body.clientWidth:null;}function pageHeight(){return window.innerHeight?window.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body?document.body.clientHeight:null;}function topPosition(){return typeof window.pageYOffset!=="undefined"?window.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop?document.body.scrollTop:0;}function leftPosition(){return typeof window.pageXOffset!=="undefined"?window.pageXOffset:document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft?document.body.scrollLeft:0;}function fadeDialog(flag){var value,dialog=document.getElementById("dialog");if(flag===null||flag===1){value=dialog.alpha+SPEED;}else{value=dialog.alpha-SPEED;}dialog.alpha=value;dialog.style.opacity=(value/100);dialog.style.filter="alpha(opacity="+String(value)+")";if(value>=99){clearInterval(dialog.timer);}else{if(value<=1){dialog.style.visibility="hidden";document.getElementById("dialog-mask").style.visibility="hidden";clearInterval(dialog.timer);}}}function hideDialog(){var dialog=document.getElementById("dialog");clearInterval(dialog.timer);dialog.timer=setInterval(function(){fadeDialog(0);},TIMER);if(TIMEOUTID){window.clearTimeout(TIMEOUTID);}if(DIALOGFOCUSTARGET){DIALOGFOCUSTARGET.focus();}DIALOGACTIVE=0;DIALOGFOCUSTARGET=null;}function showDialog(title,message,type,autohide,focustarget){var width=pageWidth(),height=pageHeight(),left=leftPosition(),top=topPosition(),dialog,dialogheader,dialogclose,dialogtitle,dialogcontent,dialogmask,dialogwidth,dialogheight,topposition,leftposition,content,closeTxt="<br/><br/><div id='dialog-cbdiv' style='text-align:center;'><input class='sbutton' type='button' id='dialog-cb' name='closeDiag' value='Close' onclick='javascript:hideDialog();' /></div>";if(!type){type="error";}if(!document.getElementById("dialog")){dialog=document.createElement("div");dialog.id="dialog";dialogheader=document.createElement("div");dialogheader.id="dialog-header";dialogtitle=document.createElement("div");dialogtitle.id="dialog-title";dialogclose=document.createElement("div");dialogclose.id="dialog-close";dialogcontent=document.createElement("div");dialogcontent.id="dialog-content";dialogmask=document.createElement("div");dialogmask.id="dialog-mask";document.body.appendChild(dialogmask);document.body.appendChild(dialog);dialog.appendChild(dialogheader);dialogheader.appendChild(dialogtitle);dialogheader.appendChild(dialogclose);dialog.appendChild(dialogcontent);dialogclose.setAttribute("onclick","hideDialog()");dialogclose.onclick=hideDialog;}else{dialog=document.getElementById("dialog");dialogheader=document.getElementById("dialog-header");dialogtitle=document.getElementById("dialog-title");dialogclose=document.getElementById("dialog-close");dialogcontent=document.getElementById("dialog-content");dialogmask=document.getElementById("dialog-mask");dialogmask.style.visibility="visible";dialog.style.visibility="visible";}dialog.style.opacity=0;dialog.style.filter="alpha(opacity=0)";dialog.alpha=0;if(autohide&&autohide!==0){dialogmask.style.opacity=0;dialogmask.style.filter="alpha(opacity=0)";dialogmask.alpha=0;}else{dialogmask.style.opacity=0.75;dialogmask.style.filter="alpha(opacity=75)";dialogmask.alpha=75;}dialogwidth=dialog.offsetWidth;dialogheight=dialog.offsetHeight;topposition=top+(height/2)-(dialogheight/2);leftposition=left+(width/2)-(dialogwidth/2);dialog.style.top=String(topposition)+"px";dialog.style.left=String(leftposition)+"px";dialogheader.className=type+"header";dialogtitle.innerHTML=title;dialogcontent.className=type;dialogcontent.innerHTML=message+closeTxt;content=document.getElementById(WRAPPER);dialogmask.style.height=String(document.body.scrollHeight+20)+"px";document.getElementById("dialog-cb").focus();DIALOGACTIVE=1;DIALOGFOCUSTARGET=focustarget;clearInterval(dialog.timer);dialog.timer=setInterval(function(){fadeDialog(1);},TIMER);if(autohide&&autohide!==0){dialogclose.style.visibility="hidden";TIMEOUTID=window.setTimeout("hideDialog()",(autohide*1000));}else{dialogclose.style.visibility="visible";}}function isNum(passed){var i;for(i=0;i<passed.length;i+=1){if(passed.charAt(i)<"0"||passed.charAt(i)>"9"){return false;}}return true;}function isNumDecimal(passed){var i;for(i=0;i<passed.length;i+=1){if(passed.charAt(i)!=="."&&passed.charAt(i)!=="$"&&(passed.charAt(i)<"0"||passed.charAt(i)>"9")){return false;}}return true;}function addToCart(key,quantity,feedback,reload){if(!isNum(quantity)){showDialog("Shopping Cart","The quantity must be numeric","error",0,document.getElementById("entry_"+key));return false;}var expireDate=new Date();expireDate.setHours(expireDate.getHours()+24);document.cookie=key+"="+quantity+";expires="+expireDate.toGMTString();if(feedback===1){showDialog("Shopping Cart","Item successfully added!","success",3);}if(reload===1){location.reload();}return true;}function addBadgeToCart(key,quantity,startnum,typ,feedback){var endnum,existing_data,expireDate=new Date();if(!isNum(quantity)){showDialog("Shopping Cart","The quantity must be numeric","error",0,document.getElementById("entry_"+key));return false;}if(!isNum(startnum)){showDialog("Shopping Cart","The starting number must be numeric","error",0,document.getElementById("entrysn_"+key));return false;}if(typ==="pcez"&&startnum.length>3){showDialog("Shopping Cart","PayClock EZ badges can only be 3 digits or less","error",0,document.getElementById("entrysn_"+key));return false;}if(typ==="am"&&startnum.length>3){showDialog("Shopping Cart","Amano badges can only be 3 digits or less","error",0,document.getElementById("entrysn_"+key));return false;}if(typ==="quest"&&startnum.length>3){showDialog("Shopping Cart","Quest ETC badges can only be 3 digits or less","error",0,document.getElementById("entrysn_"+key));return false;}if(quantity>0){endnum=String(Number(startnum)+(quantity*25)-1);if(endnum.length>startnum.length){showDialog("Shopping Cart","Based on quantity, ending number of digits ("+String(endnum.length)+") exceeds starting number of digits ("+String(startnum.length)+")","error",0,document.getElementById("entrysn_"+key));return false;}endnum=String(new Array(startnum.length+1).join("0")+endnum).slice(-(startnum.length));expireDate.setHours(expireDate.getHours()+24);existing_data=document.cookie.match("(^|;)[ ]?"+key+"=([^;]*)(;|$)");if(existing_data){document.cookie=key+"="+existing_data[2]+"|"+String(quantity)+"?"+startnum+"-"+endnum+"?"+typ+";expires="+expireDate.toGMTString();}else{document.cookie=key+"="+String(quantity)+"?"+startnum+"-"+endnum+"?"+typ+";expires="+expireDate.toGMTString();}}if(feedback===1){showDialog("Shopping Cart","Item successfully added!","success",3);}return true;}function removeFromCart(key,badge_part){var existing_data,existing_data_str,expireDate=new Date();if(badge_part){existing_data=document.cookie.match("(^|;)[ ]?"+key+"=([^;]*)(;|$)");if(existing_data){existing_data_str=existing_data[2];existing_data_str=existing_data_str.replace(badge_part,"").replace("||","|").replace(/^[|]/,"").replace(/[|]$/,"");if(existing_data_str!==""){expireDate.setHours(expireDate.getHours()+24);document.cookie=key+"="+existing_data_str+";expires="+expireDate.toGMTString();location.reload();return true;}}}expireDate.setDate(expireDate.getDate()-1);document.cookie=key+"=;expires="+expireDate.toGMTString();location.reload();return true;}function removeAll(){if(window.confirm("Are you sure you want to clear your cart?")&&document.cookie!==""){var i,cookieName,thisCookie=document.cookie.split("; "),expireDate=new Date();expireDate.setDate(expireDate.getDate()-1);for(i=0;i<thisCookie.length;i+=1){cookieName=thisCookie[i].split("=")[0];document.cookie=cookieName+"=;expires="+expireDate.toGMTString();}}location.reload();}function sendCart(){var expireDate=new Date();expireDate.setHours(expireDate.getHours()+24);document.cookie="subtotal="+document.forms.myCart.subtotal.value+";expires="+expireDate.toGMTString();document.forms.myCart.submit();}function orderEnableShip(checkVal){document.forms.myOrderForm.sfname.disabled=!checkVal;document.forms.myOrderForm.slname.disabled=!checkVal;document.forms.myOrderForm.scname.disabled=!checkVal;document.forms.myOrderForm.saddress1.disabled=!checkVal;document.forms.myOrderForm.saddress2.disabled=!checkVal;document.forms.myOrderForm.scity.disabled=!checkVal;document.forms.myOrderForm.sstate.disabled=!checkVal;document.forms.myOrderForm.szipcode.disabled=!checkVal;document.forms.myOrderForm.sphone.disabled=!checkVal;document.forms.myOrderForm.sphe.disabled=!checkVal;document.forms.myOrderForm.sfname.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.slname.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.scname.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.saddress1.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.saddress2.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.scity.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.sstate.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.szipcode.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.sphone.style.background=checkVal?"white":"#D3D3D3";document.forms.myOrderForm.sphe.style.background=checkVal?"white":"#D3D3D3";if(checkVal===false){document.forms.myOrderForm.sfname.value="";document.forms.myOrderForm.slname.value="";document.forms.myOrderForm.scname.value="";document.forms.myOrderForm.saddress1.value="";document.forms.myOrderForm.saddress2.value="";document.forms.myOrderForm.scity.value="";document.forms.myOrderForm.sstate.value="ZZ";document.forms.myOrderForm.szipcode.value="";document.forms.myOrderForm.sphone.value="";document.forms.myOrderForm.sphe.value="";document.forms.myOrderForm.diffShip.checked=false;}}function orderValidField(myField){var i,invalidChars="?!$%^*|<>";for(i=0;i<invalidChars.length;i+=1){if(myField.value.indexOf(invalidChars.charAt(i),0)>-1){return false;}}return true;}function orderValidEmail(myEm){var i,invalidChars=" /:,;!$%?^*|<>",atPos=myEm.indexOf("@",1),perPos=myEm.indexOf(".",atPos+2);for(i=0;i<invalidChars.length;i+=1){if(myEm.indexOf(invalidChars.charAt(i),0)>-1){return false;}}if(atPos===-1){return false;}if(myEm.indexOf("@",atPos+1)>-1){return false;}if(perPos===-1){return false;}if(perPos+3>myEm.length){return false;}return true;}function orderValidShipping(mf){if(mf.diffShip.checked===false){return true;}if(mf.sfname.value===""){showDialog("Order Form","You must enter a First Name","error",0,mf.sfname);return false;}if(!orderValidField(mf.sfname)){showDialog("Order Form","Invalid characters in First Name","error",0,mf.sfname);return false;}if(mf.slname.value===""){showDialog("Order Form","You must enter a Last Name","error",0,mf.slname);return false;}if(!orderValidField(mf.slname)){showDialog("Order Form","Invalid characters in Last Name","error",0,mf.slname);return false;}if(mf.scname.value===""){showDialog("Order Form","You must enter a Company Name","error",0,mf.scname);return false;}if(!orderValidField(mf.scname)){showDialog("Order Form","Invalid characters in Company Name","error",0,mf.scname);return false;}if(mf.saddress1.value===""){showDialog("Order Form","You must enter an Address","error",0,mf.saddress1);return false;}if(!orderValidField(mf.saddress1)){showDialog("Order Form","Invalid characters in Address","error",0,mf.saddress1);return false;}if(!orderValidField(mf.saddress2)){showDialog("Order Form","Invalid characters in Address","error",0,mf.saddress2);return false;}if(mf.scity.value===""){showDialog("Order Form","You must enter a City","error",0,mf.scity);return false;}if(!orderValidField(mf.scity)){showDialog("Order Form","Invalid characters in City","error",0,mf.scity);return false;}if(mf.sstate.value==="ZZ"){showDialog("Order Form","You must enter a State","error",0,mf.sstate);return false;}if(mf.szipcode.value===""){showDialog("Order Form","You must enter a Zip Code","error",0,mf.szipcode);return false;}if(!isNum(mf.szipcode.value)){showDialog("Order Form","Zip Code must be numeric","error",0,mf.szipcode);return false;}if(mf.szipcode.value.length<5){showDialog("Order Form","Zip Code must be 5 digits","error",0,mf.szipcode);return false;}if(mf.sphone.value===""){showDialog("Order Form","You must enter a Phone Number","error",0,mf.sphone);return false;}if(!isNum(mf.sphone.value)){showDialog("Order Form","Phone Number must be numeric","error",0,mf.sphone);return false;}if(mf.sphone.value.length<10){showDialog("Order Form","Phone Number must be 10 digits","error",0,mf.sphone);return false;}if(!isNum(mf.sphe.value)){showDialog("Order Form","Phone Extension must be numeric","error",0,mf.sphe);return false;}return true;}function orderContinue(){var mf=document.forms.myOrderForm;if(mf.fname.value===""){showDialog("Order Form","You must enter a First Name","error",0,mf.fname);return false;}if(!orderValidField(mf.fname)){showDialog("Order Form","Invalid characters in First Name","error",0,mf.fname);return false;}if(mf.lname.value===""){showDialog("Order Form","You must enter a Last Name","error",0,mf.lname);return false;}if(!orderValidField(mf.lname)){showDialog("Order Form","Invalid characters in Last Name","error",0,mf.lname);return false;}if(mf.cname.value===""){showDialog("Order Form","You must enter a Company Name","error",0,mf.cname);return false;}if(!orderValidField(mf.cname)){showDialog("Order Form","Invalid characters in Company Name","error",0,mf.cname);return false;}if(mf.address1.value===""){showDialog("Order Form","You must enter an Address","error",0,mf.address1);return false;}if(!orderValidField(mf.address1)){showDialog("Order Form","Invalid characters in Address","error",0,mf.address1);return false;}if(!orderValidField(mf.address2)){showDialog("Order Form","Invalid characters in Address","error",0,mf.address2);return false;}if(mf.city.value===""){showDialog("Order Form","You must enter a City","error",0,mf.city);return false;}if(!orderValidField(mf.city)){showDialog("Order Form","Invalid characters in City","error",0,mf.city);return false;}if(mf.state.value==="ZZ"){showDialog("Order Form","You must enter a State","error",0,mf.state);return false;}if(mf.zipcode.value===""){showDialog("Order Form","You must enter a Zip Code","error",0,mf.zipcode);return false;}if(!isNum(mf.zipcode.value)){showDialog("Order Form","Zip Code must be numeric","error",0,mf.zipcode);return false;}if(mf.zipcode.value.length<5){showDialog("Order Form","Zip Code must be 5 digits","error",0,mf.zipcode);return false;}if(mf.phone.value===""){showDialog("Order Form","You must enter a Phone Number","error",0,mf.phone);return false;}if(!isNum(mf.phone.value)){showDialog("Order Form","Phone Number must be numeric","error",0,mf.phone);return false;}if(mf.phone.value.length<10){showDialog("Order Form","Phone Number must be 10 digits","error",0,mf.phone);return false;}if(!isNum(mf.phe.value)){showDialog("Order Form","Phone Extension must be numeric","error",0,mf.phe);return false;}if(!isNum(mf.fax.value)){showDialog("Order Form","Fax Number must be numeric","error",0,mf.fax);return false;}if(mf.fax.value.length>0&&mf.fax.value.length<10){showDialog("Order Form","Fax Number must be 10 digits","error",0,mf.fax);return false;}if(mf.email.value===""){showDialog("Order Form","You must enter an E-mail address","error",0,mf.email);return false;}if(!orderValidEmail(mf.email.value)){showDialog("Order Form","Invalid E-mail address","error",0,mf.email);return false;}if(mf.email.value.toLowerCase()!==mf.email2.value.toLowerCase()){showDialog("Order Form","E-mail addresses do not match","error",0,mf.email);return false;}if(orderValidShipping(mf)){mf.submit();return true;}return false;}function resetOnlineOrder(){var mf=document.forms.myOrderForm;mf.cctype.value="ZZ";mf.ccnum.value="";mf.ccmon.value="  ";mf.ccyear.value="  ";mf.ccccv.value="";mf.terms.checked=false;mf.submitb.disabled=false;return true;}function mod10(cardNumber){var ar=[],i,sum=0;for(i=0;i<cardNumber.length;i+=1){ar[i]=parseInt(cardNumber.charAt(i),10);}for(i=ar.length-2;i>=0;i-=2){ar[i]*=2;if(ar[i]>9){ar[i]-=9;}}for(i=0;i<ar.length;i+=1){sum+=ar[i];}return(((sum%10)===0)?true:false);}function sendOnlineOrder(){var mf=document.forms.myOrderForm,length,prefix;if(mf.cctype.value==="ZZ"){showDialog("Order Form","You must select a Credit Card Type","error",0,mf.cctype);return false;}if(mf.ccnum.value===""){showDialog("Order Form","You must enter a Credit Card Number","error",0,mf.ccnum);return false;}if(!isNum(mf.ccnum.value)){showDialog("Order Form","Credit Card Number must be numeric","error",0,mf.ccnum);return false;}if(mf.ccmon.value==="  "){showDialog("Order Form","You must select an Expiration Month","error",0,mf.ccmon);return false;}if(mf.ccyear.value==="  "){showDialog("Order Form","You must select an Expiration Year","error",0,mf.ccyear);return false;}if(mf.ccccv.value===""){showDialog("Order Form","You must enter a Card Code (CCV)","error",0,mf.ccccv);return false;}if(!isNum(mf.ccccv.value)){showDialog("Order Form","Card Code (CCV) must be numeric","error",0,mf.ccccv);return false;}length=mf.ccnum.value.length;if(mf.cctype.value==="AM"){if(length!==15){showDialog("Order Form","Please enter a valid American Express Card number","error",0,mf.ccnum);return false;}prefix=parseInt(mf.ccnum.value.substring(0,2),10);if(prefix!==34&&prefix!==37){showDialog("Order Form","Please enter a valid American Express Card number","error",0,mf.ccnum);return false;}}else{if(mf.cctype.value==="DC"){if(length!==16){showDialog("Order Form","Please enter a valid Discover Card number","error",0,mf.ccnum);return false;}prefix=parseInt(mf.ccnum.value.substring(0,4),10);if(prefix!==6011){showDialog("Order Form","Please enter a valid Discover Card number","error",0,mf.ccnum);return false;}}else{if(mf.cctype.value==="MC"){if(length!==16){showDialog("Order Form","Please enter a valid MasterCard number","error",0,mf.ccnum);return false;}prefix=parseInt(mf.ccnum.value.substring(0,2),10);if(prefix<51||prefix>55){showDialog("Order Form","Please enter a valid MasterCard number","error",0,mf.ccnum);return false;}}else{if(mf.cctype.value==="VS"){if(length!==16&&length!==13){showDialog("Order Form","Please enter a valid Visa Card number","error",0,mf.ccnum);return false;}prefix=parseInt(mf.ccnum.value.substring(0,1),10);if(prefix!==4){showDialog("Order Form","Please enter a valid Visa Card number","error",0,mf.ccnum);return false;}}}}}if(!mod10(mf.ccnum.value)){showDialog("Order Form","Not a valid credit card number","error",0,mf.ccnum);return false;}if(!isNumDecimal(mf.subtot.value)||!isNumDecimal(mf.tax.value)||!isNumDecimal(mf.shipping.value)){alert("Cookie Error! Make sure cookies are enabled.");return false;}if(mf.terms.checked===false){showDialog("Order Form","You must agree to the Terms and Conditions to proceed","error");return false;}mf.submitb.disabled=true;document.forms.myOrderForm.submit();return true;}function stopRKey(e){var evt=e?e:(event?event:null),node=evt.target?evt.target:(evt.srcElement?evt.srcElement:null);if((DIALOGACTIVE===1)&&(evt.keyCode===27)){hideDialog();return false;}if((evt.keyCode===13)&&(node.type==="text")){return false;}return true;}document.onkeypress=stopRKey;function addToBookmark(){var title="TimeClockSupply.com - ID Badges Unlimited Inc.",url="http://www.timeclocksupply.com",elem;if(window.sidebar){window.sidebar.addPanel(title,url,"");}else{if(window.opera&&window.print){elem=document.createElement("a");elem.setAttribute("href",url);elem.setAttribute("title",title);elem.setAttribute("rel","sidebar");elem.click();}else{if(document.all){window.external.AddFavorite(url,title);}}}}var hexcase=0,b64pad="",chrsz=8;function bit_rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt));}function safe_add(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&65535);}function md5_cmn(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}function md5_ff(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}function md5_gg(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);}function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);}function str2binl(str){var bin=[],mask=(1<<chrsz)-1,i;for(i=0;i<str.length*chrsz;i+=chrsz){bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);}return bin;}function binl2str(bin){var str="",mask=(1<<chrsz)-1,i;for(i=0;i<bin.length*32;i+=chrsz){str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);}return str;}function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef",str="",i;for(i=0;i<binarray.length*4;i+=1){str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&15)+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&15);}return str;}function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",str="",i,j,triplet;for(i=0;i<binarray.length*4;i+=3){triplet=(((binarray[i>>2]>>8*(i%4))&255)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&255)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&255);for(j=0;j<4;j+=1){if(i*8+j*6>binarray.length*32){str+=b64pad;}else{str+=tab.charAt((triplet>>6*(3-j))&63);}}}return str;}function core_md5(x,len){x[len>>5]|=128<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193,b=-271733879,c=-1732584194,d=271733878,i,olda,oldb,oldc,oldd,ret=[];for(i=0;i<x.length;i+=16){olda=a;oldb=b;oldc=c;oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}ret[0]=a;ret[1]=b;ret[2]=c;ret[3]=d;return ret;}function core_hmac_md5(key,data){var bkey=str2binl(key),ipad=[],opad=[],hash,i;if(bkey.length>16){bkey=core_md5(bkey,key.length*chrsz);}for(i=0;i<16;i+=1){ipad[i]=bkey[i]^909522486;opad[i]=bkey[i]^1549556828;}hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);}function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}function md5_vm_test(){return hex_md5("abc")==="900150983cd24fb0d6963f7d28e17f72";}function serviceVerify(){var mf,mycookie,ind;mf=document.forms.myServiceForm;mycookie=String(document.cookie);ind=mycookie.indexOf("service");if(ind===-1){alert("Session expired! Reload page and try again.");return false;}if(mf.cname.value===""){showDialog("Service Form","You must enter a Company Name","error",0,mf.cname);return false;}if(!orderValidField(mf.cname)){showDialog("Service Form","Invalid characters in Company Name","error",0,mf.cname);return false;}if(mf.name.value===""){showDialog("Service Form","You must enter a Name","error",0,mf.name);return false;}if(!orderValidField(mf.name)){showDialog("Service Form","Invalid characters in Name","error",0,mf.name);return false;}if(mf.add1.value===""){showDialog("Service Form","You must enter an Address","error",0,mf.add1);return false;}if(!orderValidField(mf.add1)){showDialog("Service Form","Invalid characters in Address","error",0,mf.add1);return false;}if(!orderValidField(mf.add2)){showDialog("Service Form","Invalid characters in Address","error",0,mf.add2);return false;}if(mf.city.value===""){showDialog("Service Form","You must enter a City","error",0,mf.city);return false;}if(!orderValidField(mf.city)){showDialog("Service Form","Invalid characters in City","error",0,mf.city);return false;}if(mf.state.value==="ZZ"){showDialog("Service Form","You must enter a State","error",0,mf.state);return false;}if(mf.zip.value===""){showDialog("Service Form","You must enter a Zip Code","error",0,mf.zip);return false;}if(!isNum(mf.zip.value)){showDialog("Service Form","Zip Code must be numeric","error",0,mf.zip);return false;}if(mf.zip.value.length<5){showDialog("Service Form","Zip Code must be 5 digits","error",0,mf.zip);return false;}if(mf.servemail.value===""){showDialog("Service Form","You must enter an E-mail address","error",0,mf.servemail);return false;}if(!orderValidEmail(mf.servemail.value)){showDialog("Service Form","Invalid E-mail address","error",0,mf.servemail);return false;}if(mf.phone.value===""){showDialog("Service Form","You must enter a Phone Number","error",0,mf.phone);return false;}if(mf.fax.value===""){showDialog("Service Form","You must enter a Fax Number","error",0,mf.fax);return false;}if(mf.manufacturer.value===""){showDialog("Service Form","You must enter a Manufacturer","error",0,mf.manufacturer);return false;}if(!orderValidField(mf.manufacturer)){showDialog("Service Form","Invalid characters in Manufacturer","error",0,mf.manufacturer);return false;}if(mf.model.value===""){showDialog("Service Form","You must enter a Model Number","error",0,mf.model);return false;}if(!orderValidField(mf.model)){showDialog("Service Form","Invalid characters in Model Number","error",0,mf.model);return false;}if(mf.problem.value===""){showDialog("Service Form","You must enter a description of the problem","error",0,mf.problem);return false;}if(mf.problem.value.length>2000){showDialog("Service Form","The description of the problem cannot exceed 2000 characters","error",0,mf.problem);return false;}if(mf.captcha.value===""||hex_md5(mf.captcha.value.toUpperCase())!==mf.kdata.value){showDialog("Service Form","Security Phrase failed","error",0,mf.captcha);return false;}document.forms.myServiceForm.submit();return true;}function rmaVerify(){var mf,mycookie,ind;mf=document.forms.rmaform;mycookie=String(document.cookie);ind=mycookie.indexOf("rma");if(ind===-1){alert("Session expired! Reload page and try again.");return false;}if(mf.name.value===""){showDialog("RMA Form","You must enter a Name","error",0,mf.name);return false;}if(!orderValidField(mf.name)){showDialog("RMA Form","Invalid characters in Name","error",0,mf.name);return false;}if(mf.company.value===""){showDialog("RMA Form","You must enter a Company Name","error",0,mf.company);return false;}if(!orderValidField(mf.company)){showDialog("RMA Form","Invalid characters in Company Name","error",0,mf.company);return false;}if(mf.phone.value===""){showDialog("RMA Form","You must enter a Phone Number","error",0,mf.phone);return false;}if(mf.email.value===""){showDialog("RMA Form","You must enter an E-mail address","error",0,mf.email);return false;}if(!orderValidEmail(mf.email.value)){showDialog("RMA Form","Invalid E-mail address","error",0,mf.email);return false;}if(mf.invoice.value===""){showDialog("RMA Form","You must enter an Invoice Number","error",0,mf.invoice);return false;}if(!isNum(mf.invoice.value)){showDialog("RMA Form","Invoice Number must be numeric","error",0,mf.invoice);return false;}if(mf.reason.value===""){showDialog("RMA Form","You must enter a reason for return","error",0,mf.reason);return false;}if(mf.reason.value.length>5000){showDialog("RMA Form","The reason for return cannot exceed 5000 characters","error",0,mf.reason);return false;}if(mf.captcha.value===""||hex_md5(mf.captcha.value.toUpperCase())!==mf.kdata.value){showDialog("RMA Form","Security Phrase failed","error",0,mf.captcha);return false;}document.forms.rmaform.submit();return true;}function acrotimeVerify(){var mf,mycookie,ind;mf=document.forms.acrotimeform;mycookie=String(document.cookie);ind=mycookie.indexOf("acrotime");if(ind===-1){alert("Session expired! Reload page and try again.");return false;}if(mf.name.value===""){showDialog("AcroTime Form","You must enter a Name","error",0,mf.name);return false;}if(!orderValidField(mf.name)){showDialog("AcroTime Form","Invalid characters in Name","error",0,mf.name);return false;}if(mf.company.value===""){showDialog("AcroTime Form","You must enter a Company Name","error",0,mf.company);return false;}if(!orderValidField(mf.company)){showDialog("AcroTime Form","Invalid characters in Company Name","error",0,mf.company);return false;}if(mf.add1.value===""){showDialog("AcroTime Form","You must enter an Address","error",0,mf.add1);return false;}if(!orderValidField(mf.add1)){showDialog("AcroTime Form","Invalid characters in Address","error",0,mf.add1);return false;}if(!orderValidField(mf.add2)){showDialog("AcroTime Form","Invalid characters in Address","error",0,mf.add2);return false;}if(mf.city.value===""){showDialog("AcroTime Form","You must enter a City","error",0,mf.city);return false;}if(!orderValidField(mf.city)){showDialog("AcroTime Form","Invalid characters in City","error",0,mf.city);return false;}if(mf.state.value==="ZZ"){showDialog("AcroTime Form","You must enter a State","error",0,mf.state);return false;}if(mf.zip.value===""){showDialog("AcroTime Form","You must enter a Zip Code","error",0,mf.zip);return false;}if(!isNum(mf.zip.value)){showDialog("AcroTime Form","Zip Code must be numeric","error",0,mf.zip);return false;}if(mf.zip.value.length<5){showDialog("AcroTime Form","Zip Code must be 5 digits","error",0,mf.zip);return false;}if(mf.email.value===""){showDialog("AcroTime Form","You must enter an E-mail address","error",0,mf.email);return false;}if(!orderValidEmail(mf.email.value)){showDialog("AcroTime Form","Invalid E-mail address","error",0,mf.email);return false;}if(mf.phone.value===""){showDialog("AcroTime Form","You must enter a Phone Number","error",0,mf.phone);return false;}if(!isNum(mf.employees.value)){showDialog("AcroTime Form","Number of Employees must be numeric","error",0,mf.employees);return false;}if(!orderValidField(mf.industry)){showDialog("AcroTime Form","Invalid characters in Industry","error",0,mf.industry);return false;}if(mf.additional.value.length>1000){showDialog("AcroTime Form","The Additional Information field cannot exceed 1000 characters","error",0,mf.additional);return false;}if(mf.captcha.value===""||hex_md5(mf.captcha.value.toUpperCase())!==mf.kdata.value){showDialog("AcroTime Form","Security Phrase failed","error",0,mf.captcha);return false;}document.forms.acrotimeform.submit();return true;}
