/* ====== request for /Store/ajax.js ======= *//*---------- Copyright 2012 Neotek Limited (http://www.neotek.co.nz). All rights reserved. -----------*/
 
/* ---------- ajax.js ---------- */
var debug=0;if(top.location.protocol!="https:"){if(top.location.href.indexOf("local")<0){top.location.href="https://"+top.location.href.substr(7)}}function IncludeJS(a){document.write('<script type="text/javascript" src="'+a+'"></script>')}IncludeJS("/neotek/js/format.js");var UserId;var InvoiceId;var discount=0;function logout(){document.getElementById("fullname").innerHTML="";document.getElementById("signout").style.display="none";document.getElementById("signin").style.display="block"}function passwordEnter(a){if(a){}else{a=window.event}if(isEnter(a)){signin();return false}else{return true}}function statechange(){setValue("txtstate",getValue("liststate"))}function zipchange(){setValue("txtpostcode",getValue("txtzip"))}function countrychange(){try{if(getValue("listcountry")=="US"){document.getElementById("txtstate").parentNode.style.display="none";document.getElementById("liststate").parentNode.style.display="block"}else{document.getElementById("liststate").parentNode.style.display="none";document.getElementById("txtstate").parentNode.style.display="block"}}catch(a){}}function checklicense(){try{if(getValue("LicenseNumber")==""){msgbox(document.getElementById("LicenseNumber"),18);return false}showprocessing();hideUpgradeOptions();var b=append("LicenseNumber","");neotekscript("/neotek/store.aspx?stage=7",b)}catch(a){alert(a)}return false}function showUpgradeOptions(a){document.getElementById(a).style.display="block";hideprocessing()}function hideUpgradeOptions(){try{document.getElementById("licensetypeupgrade").style.display="none";document.getElementById("licenseversionupgrade13").style.display="none";document.getElementById("licenseversionupgrade23").style.display="none";document.getElementById("licenseversionupgrade12").style.display="none";document.getElementById("licensesizeupgrade").style.display="none"}catch(a){}}function eventhandlers(){var c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("type","text/css");c.setAttribute("href","/neotek/popup.css");document.getElementsByTagName("head")[0].appendChild(c);if(debug==1){alert("loading event handlers ...")}document.getElementById("storetitle").innerHTML="";document.getElementById("StoreSelect").style.display="block";document.getElementById("StoreFail").style.display="none";document.getElementById("StorePassword").onkeypress=passwordEnter;document.getElementById("liststate").onchange=statechange;document.getElementById("txtzip").onchange=zipchange;document.getElementById("listcountry").onchange=countrychange;hideUpgradeOptions();var d=document.forms[0];try{for(var f=0;f<d.elements.length;f++){formElem=d.elements[f];if(formElem.getAttribute("prodcode")!=null){switch(formElem.type){case"checkbox":formElem.onclick=setTotal;break;case"text":formElem.onfocus=SelectAllOnEnter;formElem.onkeypress=numericKeyPress;formElem.onchange=setTotal;break}try{var j=formElem.parentNode.parentNode.parentNode;var h=formElem.getAttribute("prodcode");iterateChildNodes(j,setElementID,h)}catch(b){alert(formElem.getAttribute("prodcode")+": "+b)}}}}catch(b){}setTotal();ct=document.getElementById("listcardtype");ct.innerHTML="";addoption(ct,"Visa","Visa");addoption(ct,"Mastercard","Mastercard");addoption(ct,"Amex","Amex");lm=document.getElementById("listmonth");lm.innerHTML="";for(f=1;f<=12;f++){addoption(lm,f,f)}ly=document.getElementById("listyear");ly.innerHTML="";var a=new Date();var g=a.getFullYear();for(f=g;f<=g+10;f++){addoption(ly,f,f)}neotekscript("/neotek/xml/country.xml",null,loadCountries);neotekscript("/neotek/xml/state.xml",null,loadStates)}addonloadcallback(eventhandlers);function iterateChildNodes(b,a,d){for(var c=0;c<b.childNodes.length;c++){a(b.childNodes[c],d);if(b.childNodes[c].childNodes.length>0){iterateChildNodes(b.childNodes[c],a,d)}}}function setElementID(a,b){switch(a.className){case"storeitemname":a.id=b+"name";break;case"storeitemtype":a.id=b+"type";break;case"storeitempriceamount":a.id=b+"amount";break}}var total=0;function setTotal(b,g){try{if(g==null){setValue("StoreCouponNumber","");discount=0}var j=1;var h=0;total=0;var c=document.forms[0];var d;for(var f=0;f<c.elements.length;f++){d=c.elements[f];if(d.getAttribute("prodcode")!=null){j=0;h=0;switch(d.type){case"text":if(isNumeric(d.value)&&d.value>0){j=d.value}break;case"checkbox":if(d.checked){j=1}break}if(j>0){try{h=Number(document.getElementById(d.getAttribute("prodcode")+"amount").innerHTML.substr(1,10))}catch(a){}total+=j*h}}}total=total*((100-discount)/100);document.getElementById("StoreSelectTotal1").innerHTML=total.numberFormat("$0.00");document.getElementById("StoreSelectTotal2").innerHTML=total.numberFormat("$0.00");setValue("StoreCouponNumber2",getValue("StoreCouponNumber"))}catch(a){}return true}function getProducts(a){var d="";var b;for(var c=0;c<a.elements.length;c++){b=a.elements[c];if(b.getAttribute("prodcode")!=null){switch(b.type){case"text":if(isNumeric(b.value)&&b.value>0){d+="#"+b.getAttribute("prodcode")+"="+escape(b.value)+"&"}break;case"checkbox":if(b.checked){d+="#"+b.getAttribute("prodcode")+"=1&"}break}}}d=d.substr(0,(d.length-1));return d}function SelectNext(){try{showprocessing();var b=getProducts(document.forms[0]);if(b==""){msgbox(null,17);return false}}catch(a){alert(a)}neotekscript("/neotek/store.aspx",b);return false}function showProductSelector(){hideDivs();document.getElementById("storetitle").innerHTML="";document.getElementById("StoreProgressBar1").style.display="block";document.getElementById("StoreSelect").style.display="block";hideprocessing()}function showCustDetails(){hideDivs();countrychange();setValue("liststate",getValue("txtstate"));setValue("txtzip",getValue("txtpostcode"));document.getElementById("storetitle").innerHTML=" - Customer Details";document.getElementById("StoreProgressBar2").style.display="block";document.getElementById("StoreDetails").style.display="block";try{hidesignin()}catch(a){}hideprocessing()}function showCardDetails(){if(total==0){BuyNow()}hideDivs();document.getElementById("storetitle").innerHTML=" - Card Details";document.getElementById("StoreCardDetails").style.display="block";document.getElementById("StoreProgressBar3").style.display="block";document.getElementById("listcardtype").focus();hideprocessing()}function msgbox(a,b){hideprocessing();var c={URL:"/neotek/alert.aspx?msgId="+b,Title:"",ShowClose:false,Width:500,Height:100,DoFade:false,CloseOnLoseFocus:true};top.NeotekPopup.Show(c)}function CustDetailsNext(){try{if(getValue("txtfirstname")==""){msgbox(document.getElementById("txtfirstname"),1);return false}if(getValue("txtfirstname").toLowerCase().indexOf("evaluation")>-1){msgbox(document.getElementById("txtfirstname"),21);return false}if(getValue("txtlastname")==""){msgbox(document.getElementById("txtfirstname"),2);return false}if(getValue("txtaddress1")==""){msgbox(document.getElementById("txtaddress1"),3);return false}if(getValue("txtcity")==""){msgbox(document.getElementById("txtcity"),13);return false}if(getValue("txtpostcode")==""){msgbox(document.getElementById("txtpostcode"),5);return false}if(getValue("txtemail")==""){msgbox(document.getElementById("txtemail"),7);return false}if(getValue("txtcreatepassword")==""){msgbox(document.getElementById("txtaddress1"),8);return false}if(getValue("txtcreatepassword")!=getValue("txtretypepassword")){msgbox(document.getElementById("txtretypepassword"),9);return false}showprocessing();var b=append("txtfirstname","");b=append("txtlastname",b);b=append("txtemail",b);b=append("txtorganization",b);b=append("txtaddress1",b);b=append("txtaddress2",b);b=append("txtaddress3",b);b=append("txtcity",b);b=append("txtstate",b);b=append("txtpostcode",b);b=append("listcountry",b);b=append("txtphone",b);b=append("txtcreatepassword",b);if(total==0){b+=getProducts(document.forms[0])+"&";b=append("LicenseNumber",b);b=append("StoreCouponNumber",b);b+="total=0"}neotekscript("/neotek/store.aspx?stage=3",b)}catch(a){hideprocessing();alert(a)}return false}function register(){showprocessing();showCustDetails()}function ApplyCoupon(){try{showprocessing();if(getValue("StoreCouponNumber")==""){msgbox(document.getElementById("StoreCouponNumber"),20);return false}showprocessing();var b=append("StoreCouponNumber","");b+=getProducts(document.forms[0])}catch(a){alert(a)}neotekscript("/neotek/store.aspx?stage=6",b);return false}function SetDiscount(a){discount=a;setTotal(null,1);hideprocessing()}function storesignin(){try{showprocessing();var b=append("StoreLogin","");b=append("StorePassword",b);neotekscript("/neotek/store.aspx?stage=2",b)}catch(a){alert(a)}return false}function invoiceitem(c,d){try{var b=Number(document.getElementById(c+"amount").innerHTML.substr(1,10));str='<div class="storeitem">';str+='<div class="storeitemdescription">';str+='<div class="storeitemname">'+document.getElementById(c+"name").innerHTML+"</div>";str+='<div class="storeitemtype">'+document.getElementById(c+"type").innerHTML+"</div>";str+="</div>";str+='<div class="storeitemsmallspacer"> </div>';str+='<div class="storeitemprice">';str+='<div class="storeitempriceheader">Price</div>';str+='<div class="storeitempriceamount">'+b.numberFormat("$0.00")+"</div>";str+="</div>";str+='<div class="storeitemsmallspacer"> </div>';str+='<div class="storeitemselect">';str+='<div class="storeitemselectheader">Qty</div>';str+='<div class="storeitemqtyselected">'+d+"</div>";str+="</div>";str+='<div class="storeitemsmallspacer"> </div>';str+='<div class="storeitemtotal">';str+='<div class="storeitemtotalheader">Total</div>';var f=b*d;str+='<div class="storeitemtotalamount">'+f.numberFormat("$0.00")+"</div>";str+="</div>";str+="</div>";return str}catch(a){return""}}function invoiceitems(){var f="";try{var b=document.forms[0];var c;for(var d=0;d<b.elements.length;d++){c=b.elements[d];if(c.getAttribute("prodcode")!=null){switch(c.type){case"text":if(isNumeric(c.value)&&c.value>0){f+=invoiceitem(c.getAttribute("prodcode"),c.value)}break;case"checkbox":if(c.checked){f+=invoiceitem(c.getAttribute("prodcode"),1)}break}}}}catch(a){}return f}function showLogin(){hideDivs();document.getElementById("storetitle").innerHTML=" - Sign In";document.getElementById("StoreProgressBar2").style.display="block";document.getElementById("StoreSignIn").style.display="block";document.getElementById("StoreLogin").focus();hideprocessing()}function showCheckout(){document.getElementById("BuyNowButton").disabled=false;var c=document.getElementById("storeitems");c.innerHTML="";c.innerHTML+=invoiceitems();str=getValue("txtfirstname");str+=" "+getValue("txtlastname");if(getValue("txtorganization")!=""){str+="<br/>"+getValue("txtorganization")}str+="<br/>"+getValue("txtaddress1");if(getValue("txtaddress2")!=""){str+="<br/>"+getValue("txtaddress2")}if(getValue("txtaddress3")!=""){str+="<br/>"+getValue("txtaddress3")}if(getValue("txtcity")!=""){str+="<br/>"+getValue("txtcity")}str+="<br/>"+getValue("txtstate");str+=" "+getValue("txtpostcode");var a=document.getElementById("listcountry");var b=a.options[a.selectedIndex].innerHTML;if(b!=""){str+="<br/>"+b}if(getValue("txtphone")!=""){str+="<br/>"+getValue("txtphone")}document.getElementById("storeconfirmcustomerdetails").innerHTML=str;str=getValue("txtccnumber");str="XXXX...XX"+str.substr(str.length-4,4);str=getValue("listcardtype")+": "+str;str+="<br/> security code: "+getValue("txtsecuritycode");str+="<br/>Expires "+getValue("listmonth");str+="-"+getValue("listyear");document.getElementById("storeconfirmcarddetails").innerHTML=str;hideDivs();document.getElementById("storetitle").innerHTML=" - Checkout";document.getElementById("StoreCheckout").style.display="block";document.getElementById("StoreProgressBar4").style.display="block";document.getElementById("StoreChangeCustomerDetails").focus();hideprocessing()}var LicStr="";function showLicense(d,b,e,f,a){if(LicStr==""){LicStr=document.getElementById("productlicenses").innerHTML;document.getElementById("productlicenses").innerHTML=""}var c=LicStr;c=c.replace("{0}",document.getElementById(d+"name").innerHTML);c=c.replace("{1}",document.getElementById(d+"type").innerHTML);c=c.replace("{2}",b);c=c.replace("{3}",e);c=c.replace("{4}",f);c=c.replace("{5}",a);document.getElementById("productlicenses").innerHTML+=c}function showSuccess(a,b,c){document.getElementById("purchaserfirstname").innerHTML=getValue("txtfirstname");document.getElementById("SuccessLogin").innerHTML=getValue("txtemail");document.getElementById("SuccessPassword").innerHTML=getValue("txtcreatepassword");document.getElementById("invoicedate").innerHTML=a;document.getElementById("invoicenumber").innerHTML=b;document.getElementById("invoicetotal").innerHTML=c;hideDivs();document.getElementById("storetitle").innerHTML=" - Confirmation of Purchase";document.getElementById("StoreSuccess").style.display="block";hideprocessing()}function showFailure(a){hideDivs();document.getElementById("storetitle").innerHTML=" - Problem with Purchase";document.getElementById("StoreFail").style.display="block";document.getElementById("StoreFailDeclined").style.display="none";document.getElementById("StoreFailTimeout").style.display="none";if(a==2){document.getElementById("StoreFailDeclined").style.display="block"}else{document.getElementById("StoreFailTimeout").style.display="block"}hideprocessing()}function hideDivs(){document.getElementById("StoreDetails").style.display="none";document.getElementById("StoreSelect").style.display="none";document.getElementById("StoreSignIn").style.display="none";document.getElementById("StoreCardDetails").style.display="none";document.getElementById("StoreSuccess").style.display="none";document.getElementById("StoreCheckout").style.display="none";document.getElementById("StoreFail").style.display="none";document.getElementById("StoreProgressBar1").style.display="none";document.getElementById("StoreProgressBar2").style.display="none";document.getElementById("StoreProgressBar3").style.display="none";document.getElementById("StoreProgressBar4").style.display="none"}function CardDetailsNext(){try{if(getValue("txtccnumber")==""){msgbox(document.getElementById("txtccnumber"),10);return false}if(getValue("txtsecuritycode")==""&&!getValue("ChkBoxNoCode")){msgbox(document.getElementById("txtsecuritycode"),11);return false}var b=new Date();b.setFullYear(getValue("listyear"));b.setMonth(getValue("listmonth")-1);b.setDate(20);var c=new Date();if(b<c){msgbox(document.getElementById("listmonth"),12);return false}showprocessing();var d=append("listcardtype","");d=append("txtccnumber",d);d=append("txtsecuritycode",d);d=append("ChkBoxNoCode",d);d=append("listmonth",d);d=append("listyear",d)}catch(a){alert(a)}neotekscript("/neotek/store.aspx?stage=4",d);return false}function BuyNow(){try{document.getElementById("BuyNowButton").disabled=true;showprocessing();var b=getProducts(document.forms[0])+"&";b=append("LicenseNumber",b);b=append("StoreCouponNumber",b);b=append("listcardtype",b);b=append("txtccnumber",b);b=append("txtsecuritycode",b);b=append("ChkBoxNoCode",b);b=append("listmonth",b);b=append("listyear",b);b+="UserId="+UserId;b+="InvoiceId="+InvoiceId}catch(a){alert(a)}neotekscript("/neotek/store.aspx?stage=5",b);return false}function loadCountries(a){control=document.getElementById("listcountry");control.innerHTML="";loadXMLOptions(a,control,"countries")}function loadStates(a){control=document.getElementById("liststate");control.innerHTML="";loadXMLOptions(a,control,"states")}; 
/* -------- ajax.js End -------- */
 
/*  Created in 280.8005 milliseconds */
