var bAllow=false;function enterKeyPressLive(B){B=(B)?B:event;var A=(B.charCode)?B.charCode:((B.keyCode)?B.keyCode:((B.which)?B.which:0));if(A==13){__doPostBack("StandardSearchLive1:btnGo","")}}function enterKeyPress(B){B=(B)?B:event;var A=(B.charCode)?B.charCode:((B.keyCode)?B.keyCode:((B.which)?B.which:0));if(A==13){try{var C=window.document.Form2.elements["Standardsearchcontrol1:txtKeyword"].type;__doPostBack("Standardsearchcontrol1:btnGo","")}catch(E){try{var C=window.document.Form2.elements["StandardSearchControl1:txtKeyword"].type;__doPostBack("StandardSearchControl1:btnGo","")}catch(D){__doPostBack("StandardSearchControl2:btnGo","")}}}}function popUpWindow(){var E,D,B,A,C;D=window.screen.availHeight;B=window.screen.availWidth;E="height="+D*0.25+",width="+D*0.5+",screenY="+(D*0.3)+",screenX="+(B*0.33)+",top="+(D*0.3)+",left="+(B*0.33)+",resizable,scrollbars=yes";A=window.open("AddProductPopUp.aspx","",E)}function popUpInventory(D){var F,E,B,A,C;E=window.screen.availHeight;B=window.screen.availWidth;F="height="+200+",width="+E*0.5+",screenY="+(E*0.3)+",screenX="+(B*0.33)+",top="+(E*0.3)+",left="+(B*0.33)+",resizable,scrollbars=no,location=no";A=window.open(D,"",F)}function closePopUpWindow(){window.close()}function CheckoutFromPopUp(){window.opener.location.href="ShoppingCart.aspx";window.close()}function ConfirmCancel(B){var A;A=window.confirm(B);return A}function doHelp(B){window.focus();var A=window.screen.availWidth;var D=window.screen.availHeight;window.resizeTo(0.75*A,D);window.moveTo(0);var E="height="+(D-(0.05*D))+",width="+A*0.23+",resizable,scrollbars=1,top=0,left="+A*0.75;var C=window.open(B,"helpPane",E);C.focus()}function SetValidationSearchResults(C){var B;if(C==""){C="::::::::::"}ResetForm(window.document.Form2);for(var A=0;A<window.document.Form2.length;A++){B=window.document.Form2.elements[A];if(B.name.indexOf(C)>-1){if(B.type=="select-one"||B.type=="radio"){B.title="Product Attribute";B.required=true}if(B.type=="text"&&(B.name.indexOf("txtQty")>-1||B.name.indexOf("txtQuantity")>-1)){B.title="Product Quantity";B.quantitybox=true;B.required=true}}}return ValidateForm(window.document.Form2)}function SetValidationProductBot(D,B){var C;ResetForm(window.document.frmBot);if(B==""){B="::::::::"}for(var A=0;A<window.document.frmBot.length;A++){C=window.document.frmBot.elements[A];if(C.name.indexOf(D)>-1||B==C.name.substr(C.name.indexOf(B))){if(C.type=="select-one"||C.type=="radio"){if(C.type=="radio"){C.title="Product Attribute"}else{C.title=C[0].text}C.required=true}if(C.type=="text"&&C.name.indexOf("txtQty")>-1){C.title="Product Quantity";C.quantitybox=true;C.required=true}}}return ValidateForm(window.document.frmBot)}function isNumber(B){for(var A=0;A<B.length;A++){a=parseInt(B.charAt(A));if(isNaN(a)){return false;break}}return true}function isCardNumValid(B){var E,D,C;if(!isNumber(B)){return true}E="";if(!(B.length%2==0)){for(var A=0;A<B.length;A++){if((A+1)%2==0){C=2*B.charAt(A)}else{C=1*B.charAt(A)}E=E+C.toString()}}else{for(var A=0;A<B.length;A++){if((A+1)%2==0){C=1*B.charAt(A)}else{C=2*B.charAt(A)}E=E+C.toString()}}D=0;for(var A=0;A<E.length;A++){D=D+parseInt(E.charAt(A))}if(D%10==0){return false}else{return true}}function specialCase(A){if(isCardNumValid(A.value)){bAllow=false;alert("The Credit Card Number is in an invalid format.")}else{bAllow=true}}function isDate(A){if(dateCheck(A,"%m/%d/%y")||dateCheck(A,"%d/%m/%y")||dateCheck(A,"%m-%d-%y")||dateCheck(A,"%d-%m-%y")){return true}else{return false}}function ResetForm(B){var C;for(var A=0;A<B.length;A++){C=B.elements[A];C.required=false;C.number=false;C.email=false;C.creditcardnumber=false;C.phonenumber=false;C.password=false;C.ssn=false;C.quantitybox=false}}function checkValue(A){if(A.txtCardNumber==null){if(A.txtPONumber==null){bAllow=true}else{if(A.txtPONumber.value==""){bAllow=false;Alert("Please enter something in PO")}else{bAllow=true}}}else{if(A.txtCardNumber.value==""){if(A.txtPONumber==null){bAllow=false;alert("Please put in credit card")}else{if(A.txtPONumber.value==""){bAllow=false;alert("Please put in something")}else{bAllow=true}}}else{bAllow=true}}return bAllow}function stripChar(E,D){var B,C,A;A="";for(var B=0;B<E.length;B++){C=E.charAt(B);if(C!=D){A=A+C}}return A}function ValidateForm(C){var f,k,Q,B,E,V,h,S,R,g,H;var M;var P,c,G,j,F,K,N,U;var O,b,d,T;var L;var W;var Y;var X;var J;J=1;L=";";K="";Q="";B="";F="";j="";O=C.length;var A;var I;for(var Z=0;Z<C.length;Z++){f=C.elements[Z];if((f.title==null)||(f.title=="")){k=f.name}else{k=f.title}if(((f.type=="text")||(f.type=="textarea")||(f.type=="password"))&&!f.special&&!f.disabled){if(f.value.length<=0&&f.required){Q+="\n            "+k;continue}if(f.number){O=f.value;O=stripChar(O,".");O=stripChar(O,",");if(!isNumber(O)||O.length>10){B+="\n             "+k}}if(f.creditcardnumber){f.value=stripChar(f.value," ");f.value=stripChar(f.value,"-");V=isCardNumValid(f.value)}if(f.email){g=f.value;if(g.length>0){if((g.indexOf("@")!=-1)&&(g.indexOf(".")!=-1)){H=false}else{H=true}}}if(f.name=="txtEmail"){g=f.value;if((g.indexOf("@")!=-1)&&(g.indexOf(".")!=-1)){H=false}else{H=true}}if(f.phonenumber){if(f.value!=""){var D=f.title.indexOf("Fax");if(D>=0){O=f.value;O=stripChar(O," ");O=stripChar(O,"-");O=stripChar(O,"+");if(O.length<10){E=true}}else{O=f.value;O=stripChar(O," ");O=stripChar(O,"-");O=stripChar(O,"+");if(O.length<10){b=true}}}}if(f.ssn){if(f.value!=""){O=f.value;O=stripChar(O,"-");if(O.length!=9||!isNumber(O)){T=true}}}if(f.date){if(f.value!=""){M=f.value;if(!isDate(M)){R=true}}}}if(f.quantitybox){P=f.value;if(!isNumber(P)){c=true}if(parseInt(P)<0){c=true}if((P)<1){c=true}}if(f.password){if(A==true){if(f.value!=I){d=true}}else{A=true;I=f.value}}if(f.type=="select-one"){if(f.required){if(f.options[f.options.selectedIndex].value==""||f.options[f.options.selectedIndex].value=="-1"||(f.options[f.options.selectedIndex].value=="NONE"&&f.name.indexOf("cboShipping")>-1)||(f.options[f.options.selectedIndex].value=="0"&&f.name.indexOf("cboShipChoices")>-1)){Q+="\n            "+k;continue}}}if(f.type=="radio"&&f.required){if(L.indexOf(";"+f.name+";")==-1){W=true;X=false;Y=0;L=L+f.name+";";if(C.elements[f.name].checked==true){X=true}else{if(C.elements[f.name].checked==false){Q+="\n            "+k}else{do{if(C.elements[f.name][Y]==undefined){W=false}else{if(C.elements[f.name][Y].checked==true){X=true}}Y=++Y}while(W==true);if(X==false){Q+="\n            "+k;continue}}}}}}if(!Q&&!B&&!T&&!F&&!V&&!R&&!H&&!c&&!b&&!d){return true}K="The form was not submited due to the following error(s).\n";N="\n_________________________________________________________\n\n";U="_________________________________________________________\n";if(Q){K+=N;K+="The following field(s) must be filled in:\n";K+=U;K+=Q}if(B){K+=N;K+="The following field(s) need a numeric value 10 characters long or less:\n";K+=U;K+=B}if(c){K+=N;K+="Please Enter a Positive Integer.\n";K+=U}if(V){K+=N;K+="The Credit Card Number is an invalid format.\n";K+=U}if(R){K+=N;K+="Please Enter a Valid Date.\n";K+=U}if(H){K+=N;K+="The Email Address is in an invalid format.\n";K+=U}if(b){K+=N;K+="Please enter a valid Phone Number with area code.\n";K+=U}if(E){K+=N;K+="Please enter a valid Fax Number with area code.\n";K+=U}if(T){K+=N;K+="Please enter a valid Social Security Number.\n";K+=U}if(F){K+=N;K+=F+"\n";K+=U}if(d){K+=N;K+="Your passwords did not match. Please enter them again.\n";K+=U}alert(K);return false}function ExpirationDateMessage(){var C,B,A;C="The form was not submited due to the following error(s).\n";B="\n_________________________________________________________\n\n";A="_________________________________________________________\n";C+=B;C+="Expiration Date is not valid.\n";C+=A;alert(C);return false}function DateIssueNumMessage(){var C,B,A;C="The form was not submited due to the following error(s).\n";B="\n_________________________________________________________\n\n";A="_________________________________________________________\n";C+=B;C+="Either a Start Date or Issue Number is required for Switch and Solo payments.\n";C+=A;alert(C);return false}function StartDateMessage(){var C,B,A;C="The form was not submited due to the following error(s).\n";B="\n_________________________________________________________\n\n";A="_________________________________________________________\n";C+=B;C+="Start Date is not valid.\n";C+=A;alert(C);return false}var tokPat=new RegExp("^month_strict|month|Month|MONTH|yyyy|YYYY|mins|MINS|mon_strict|ampm|AMPM|mon|Mon|MON|min|MIN|dd|DD|mm|MM|yy|YY|hh|HH|ss|SS|m|M|d|D|y|Y|h|H|s|S");var lowerMonArr={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12};var monPatArr=new Array();monPatArr["mon_strict"]=new RegExp(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/);monPatArr["Mon"]=new RegExp(/Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec/);monPatArr["MON"]=new RegExp(/JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC/);monPatArr["mon"]=new RegExp("jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec","i");var monthPatArr=new Array();monthPatArr["month"]=new RegExp(/^january|february|march|april|may|june|july|august|september|october|november|december/i);monthPatArr["Month"]=new RegExp(/^January|February|March|April|May|June|July|August|September|October|November|December/);monthPatArr["MONTH"]=new RegExp(/^JANUARY|FEBRUARY|MARCH|APRIL|MAY|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER/);monthPatArr["month_strict"]=new RegExp(/^january|february|march|april|may|june|july|august|september|october|november|december/);var cutoffYear=50;function FormatToken(A,B){this.token=A;this.type=B}function parseFormatString(A){var E=new Array;var D=0;var C=0;var B=0;while(C<A.length){if(A.charAt(C)=="%"&&(matchArray=A.substr(C+1).match(tokPat))!=null){C+=matchArray[0].length+1;E[D++]=new FormatToken(matchArray[0],"symbolic")}else{if(D>0&&E[D-1].type=="literal"){E[D-1].token+=A.charAt(C++)}else{E[D++]=new FormatToken(A.charAt(C++),"literal")}}}return E}function buildDate(D,G){var H=parseFormatString(G);var K=0;var C=0;var N;var A;var I;var B;var M;var P;var J="";var E;var O=new Date();N=O.getMonth()+1;A=O.getDate();I=O.getFullYear();B=0;M=0;P=0;while(K<D.length&&C<H.length){if(H[C].type=="literal"){if(D.indexOf(H[C].token,K)==K){K+=H[C++].token.length;continue}else{return'"'+D+'" does not conform to the expected format: '+G}}switch(H[C].token){case"m":case"M":case"d":case"D":case"h":case"H":case"min":case"MIN":case"s":case"S":curChar=D.charAt(K);nextChar=D.charAt(K+1);matchArr=D.substr(K).match(/^\d{1,2}/);if(matchArr==null){switch(H[C].token.toLowerCase()){case"d":var L="day";break;case"m":var L="month";break;case"h":var L="hour";break;case"min":var L="minute";break;case"s":var L="second";break}return"Bad "+L+' "'+curChar+'" or "'+curChar+nextChar+'".'}E=matchArr[0].length;switch(H[C].token.toLowerCase()){case"d":A=parseInt(matchArr[0],10);break;case"m":N=parseInt(matchArr[0],10);break;case"h":B=parseInt(matchArr[0],10);break;case"min":M=parseInt(matchArr[0],10);break;case"s":P=parseInt(matchArr[0],10);break}break;case"mm":case"MM":case"dd":case"DD":case"hh":case"HH":case"mins":case"MINS":case"ss":case"SS":E=2;matchArr=D.substr(K).match(/^\d{2}/);if(matchArr==null){switch(H[C].token.toLowerCase()){case"dd":var L="day";break;case"mm":var L="month";break;case"hh":var L="hour";break;case"mins":var L="minute";break;case"ss":var L="second";break}return"Bad "+L+' "'+D.substr(K,2)+'".'}switch(H[C].token.toLowerCase()){case"dd":A=parseInt(matchArr[0],10);break;case"mm":N=parseInt(matchArr[0],10);break;case"hh":B=parseInt(matchArr[0],10);break;case"mins":M=parseInt(matchArr[0],10);break;case"ss":P=parseInt(matchArr[0],10);break}break;case"y":case"Y":if(D.substr(K,4).search(/\d{4}/)!=-1){I=parseInt(D.substr(K,4),10);E=4}else{if(D.substr(K,2).search(/\d{2}/)!=-1){I=parseInt(D.substr(K,2),10);if(I>=cutoffYear){I+=1900}else{I+=2000}E=2}else{return'Bad year "'+D.substr(K,2)+'". Must be two or four digits.'}}break;case"yy":case"YY":if(D.substr(K,2).search(/\d{2}/)!=-1){I=parseInt(D.substr(K,2),10);if(I>=cutoffYear){I+=1900}else{I+=2000}E=2}else{return'Bad year "'+D.substr(K,2)+'". Must be two digits.'}break;case"yyyy":case"YYYY":if(D.substr(K,4).search(/\d{4}/)!=-1){I=parseInt(D.substr(K,4),10);E=4}else{return'Bad year "'+D.substr(K,4)+'". Must be four digits.'}break;case"mon":case"Mon":case"MON":case"mon_strict":monPat=monPatArr[H[C].token];if(D.substr(K,3).search(monPat)!=-1){N=lowerMonArr[D.substr(K,3).toLowerCase()]}else{switch(H[C].token){case"mon_strict":caseStat="lower-case";break;case"Mon":caseStat="mixed-case";break;case"MON":caseStat="upper-case";break;case"mon":caseStat="between Jan and Dec";break}return'Bad month "'+D.substr(K,3)+'". Must be '+caseStat+"."}E=3;break;case"month":case"Month":case"MONTH":case"month_strict":monPat=monthPatArr[H[C].token];matchArray=D.substr(K).match(monPat);if(matchArray==null){return"Can't find a month beginning at \""+D.substr(K)+'".'}N=lowerMonArr[matchArray[0].substr(0,3).toLowerCase()];E=matchArray[0].length;break;case"ampm":case"AMPM":matchArr=D.substr(K).match(/^(am|pm|AM|PM|a\.m\.|p\.m\.|A\.M\.|P\.M\.)/);if(matchArr==null){return"Missing am/pm designation."}if(matchArr[0].substr(0,1).toLowerCase()=="a"){J="am"}else{J="pm"}E=matchArr[0].length;break}K+=E;C++}if(C!=H.length||K!=D.length){return'"'+D+'" is either missing desired information or has more information than the expected format: '+G}if(N<1||N>12){return"Month must be between 1 and 12."}if(A<1||A>31){return"Day must be between 1 and 31."}if((N==4||N==6||N==9||N==11)&&A==31){return"Month "+N+" doesn't have 31 days!"}if(N==2){var F=(I%4==0&&(I%100!=0||I%400==0));if(A>29||(A==29&&!F)){return"February "+I+" doesn't have "+A+" days!"}}if(J==""){if(B<0||B>23){return"Hour must be between 0 and 23 for military time."}}else{if(B<1||B>12){return"Hour must be between 1 and 12 for standard time."}}if(J=="am"&&B==12){B=0}if(J=="pm"&&B<12){B+=12}if(M<0||M>59){return"Minute must be between 0 and 59."}if(P<0||P>59){return"Second must be between 0 and 59."}return new Date(I,N-1,A,B,M,P)}function dateCheck(B,A){var C=buildDate(B,A);if(typeof C=="object"){return true}else{return false}}function open_window(B,C,A){if(C==null){var C=1028}if(A==null){var A=800}popUpWin=window.open(B,"NewWindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+(C)+",height="+(A))}var intImageCount=0;var intUsed=new Array(16);var flgGood=false;function loadjqueryimages(){$("span.flipbox").each(function(A){var B=$(this).children("a");B.attr("href",arrSearchLink[A]);B.children("img.imgAdRotator").attr("src",arrImgLink[A]);B.children("img.imgAdRotator").attr("alt",("Click here for details on "+arrNameLink[intImageCount]));B.children("img.imgAdRotator").attr("title",("Click here for details on "+arrNameLink[intImageCount]));intUsed[intImageCount]=intImageCount;intImageCount++})}function changejqueryimage(){if(intImageCount>35){intImageCount=0}var B=Math.floor(Math.random()*16);var A="div#box"+(B+1);flgGood=true;for(var D=0;D<15;D++){if(intUsed[D]==intImageCount){flgGood=false}}if(flgGood==true){var C=$(A).children("span.flipbox").children("a");C.attr("href",arrSearchLink[intImageCount]);C.children("img.imgAdRotator").attr("src",arrImgLink[intImageCount]);C.children("img.imgAdRotator").attr("alt",("Click here for details on "+arrNameLink[intImageCount]));C.children("img.imgAdRotator").attr("title",("Click here for details on "+arrNameLink[intImageCount]));intUsed[B]=intImageCount;intImageCount++}}window.name="ICat";var catWindow;function open_catalog(A){catWindow=window.open(A,"DIAShopCatalog","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");catWindow.focus();return false}function mapClick(B){if(window.opener&&!window.opener.closed){var A="http://www.diashop.org/detail.aspx?ID="+B+"&Promotion=Virtual";window.opener.location.href=A;window.opener.focus()}}