var bAllow=false;function enterKeyPressLive(evt){evt=(evt)?evt:event;var charCode=(evt.charCode)?evt.charCode:((evt.keyCode)?evt.keyCode:
((evt.which)?evt.which:0));if(charCode==13){__doPostBack('StandardSearchLive1:btnGo','');}}
function enterKeyPress(evt){evt=(evt)?evt:event;var charCode=(evt.charCode)?evt.charCode:((evt.keyCode)?evt.keyCode:
((evt.which)?evt.which:0));if(charCode==13){try{var temp=window.document.Form2.elements["Standardsearchcontrol1:txtKeyword"].type;__doPostBack('Standardsearchcontrol1:btnGo','');}
catch(er){try{var temp=window.document.Form2.elements["StandardSearchControl1:txtKeyword"].type;__doPostBack('StandardSearchControl1:btnGo','');}
catch(er2){__doPostBack('StandardSearchControl2:btnGo','');}}}}
function popUpWindow(){var sFeatures,h,w,myThanks,i
h=window.screen.availHeight
w=window.screen.availWidth
sFeatures="height="+h*.25+",width="+h*.50+",screenY="+(h*.30)+",screenX="+(w*.33)+",top="+(h*.30)+",left="+(w*.33)+",resizable,scrollbars=yes"
myThanks=window.open("AddProductPopUp.aspx","",sFeatures)}
function popUpInventory(spage){var sFeatures,h,w,myThanks,i
h=window.screen.availHeight
w=window.screen.availWidth
sFeatures="height="+200+",width="+h*.50+",screenY="+(h*.30)+",screenX="+(w*.33)+",top="+(h*.30)+",left="+(w*.33)+",resizable,scrollbars=no,location=no"
myThanks=window.open(spage,"",sFeatures)}
function closePopUpWindow(){window.close();}
function CheckoutFromPopUp(){window.opener.location.href="ShoppingCart.aspx";window.close();}
function ConfirmCancel(msg){var resp
resp=window.confirm(msg);return resp;}
function doHelp(topic){window.focus()
var w=window.screen.availWidth;var h=window.screen.availHeight;window.resizeTo(.75*w,h);window.moveTo(0.0);var sFeatures="height="+(h-(.05*h))+",width="+w*.23+",resizable,scrollbars=1,top=0,left="+w*.75;var helpPane=window.open(topic,"helpPane",sFeatures)
helpPane.focus();}
function SetValidationSearchResults(str){var e
if(str==""){str="::::::::::";}
ResetForm(window.document.Form2);for(var i=0;i<window.document.Form2.length;i++){e=window.document.Form2.elements[i];if(e.name.indexOf(str)>-1){if(e.type=="select-one"||e.type=="radio"){e.title="Product Attribute";e.required=true;}
if(e.type=="text"&&(e.name.indexOf("txtQty")>-1||e.name.indexOf("txtQuantity")>-1)){e.title="Product Quantity";e.quantitybox=true;e.required=true;}}}
return ValidateForm(window.document.Form2)}
function SetValidationProductBot(str,str2){var e
ResetForm(window.document.frmBot);if(str2==""){str2="::::::::"}
for(var i=0;i<window.document.frmBot.length;i++){e=window.document.frmBot.elements[i];if(e.name.indexOf(str)>-1||str2==e.name.substr(e.name.indexOf(str2))){if(e.type=="select-one"||e.type=="radio"){if(e.type=="radio"){e.title="Product Attribute";}else{e.title=e[0].text;}
e.required=true;}
if(e.type=="text"&&e.name.indexOf("txtQty")>-1){e.title="Product Quantity";e.quantitybox=true;e.required=true;}}}
return ValidateForm(window.document.frmBot)}
function isNumber(value){for(var i=0;i<value.length;i++){a=parseInt(value.charAt(i));if(isNaN(a)){return false;break;}}
return true;}
function isCardNumValid(num){var num1,num2,tempNum;if(!isNumber(num)){return true;}
num1=""
if(!(num.length%2==0)){for(var j=0;j<num.length;j++){if((j+1)%2==0){tempNum=2*num.charAt(j);}else{tempNum=1*num.charAt(j);}
num1=num1+tempNum.toString();}}else{for(var j=0;j<num.length;j++){if((j+1)%2==0){tempNum=1*num.charAt(j);}else{tempNum=2*num.charAt(j);}
num1=num1+tempNum.toString();}}
num2=0;for(var j=0;j<num1.length;j++){num2=num2+parseInt(num1.charAt(j));}
if(num2%10==0){return false;}else{return true;}}
function specialCase(obj){if(isCardNumValid(obj.value)){bAllow=false;alert("The Credit Card Number is in an invalid format.");}else
bAllow=true;}
function isDate(strDate){if(dateCheck(strDate,'%m/%d/%y')||dateCheck(strDate,'%d/%m/%y')||dateCheck(strDate,'%m-%d-%y')||dateCheck(strDate,'%d-%m-%y')){return true;}else{return false;}}
function ResetForm(form){var e
for(var i=0;i<form.length;i++){e=form.elements[i];e.required=false;e.number=false;e.email=false;e.creditcardnumber=false;e.phonenumber=false;e.password=false;e.ssn=false;e.quantitybox=false;}}
function checkValue(objForm){if(objForm.txtCardNumber==null){if(objForm.txtPONumber==null){bAllow=true;}else{if(objForm.txtPONumber.value==""){bAllow=false;Alert("Please enter something in PO");}else
bAllow=true;}}else{if(objForm.txtCardNumber.value==""){if(objForm.txtPONumber==null){bAllow=false;alert("Please put in credit card");}else{if(objForm.txtPONumber.value==""){bAllow=false;alert("Please put in something");}else{bAllow=true;}}}else{bAllow=true;}}
return bAllow;}
function stripChar(sValue,sChar){var i,tempChar,buildString;buildString=""
for(var i=0;i<sValue.length;i++){tempChar=sValue.charAt(i);if(tempChar !=sChar){buildString=buildString+tempChar;}}
return buildString;}
function ValidateForm(form){var e,title,empty_fields,char_check,invalid_faxNumber,invalid_card,month,year,invalid_date,eMail,invalid_eMail
var strDate
var iQuantity,quantity_check,checkSpecial,tempError,special_Error,msg,upperLine,lowerLine
var num,invalid_phoneNumber,passwd_mismatch,invalid_ssn
var strRadioButtonNames
var RadioExists
var RadioCnt
var RadioChecked
var ProdAttrCount
ProdAttrCount=1;strRadioButtonNames=";"
msg="";empty_fields="";char_check="";special_Error="";tempError="";num=form.length
var PasswordSet
var PasswordStr
for(var i=0;i<form.length;i++){e=form.elements[i]
if((e.title==null)||(e.title=="")){title=e.name;}else{title=e.title;}
if(((e.type=="text")||(e.type=="textarea")||(e.type=="password"))&&!e.special&&!e.disabled){if(e.value.length<=0&&e.required){empty_fields+="\n            "+title;continue;}
if(e.number){num=e.value;num=stripChar(num,".");num=stripChar(num,",");if(!isNumber(num)||num.length>10){char_check+="\n             "+title;}}
if(e.creditcardnumber){e.value=stripChar(e.value," ");e.value=stripChar(e.value,"-");invalid_card=isCardNumValid(e.value);}
if(e.email){eMail=e.value;if(eMail.length>0){if((eMail.indexOf("@")!=-1)&&(eMail.indexOf(".")!=-1)){invalid_eMail=false;}else{invalid_eMail=true;}}}
if(e.name=="txtEmail"){eMail=e.value;if((eMail.indexOf("@")!=-1)&&(eMail.indexOf(".")!=-1)){invalid_eMail=false;}else{invalid_eMail=true;}}
if(e.phonenumber){if(e.value !=""){var isFax=e.title.indexOf("Fax");if(isFax>=0){num=e.value;num=stripChar(num," ");num=stripChar(num,"-");num=stripChar(num,"+");if(num.length<10){invalid_faxNumber=true;}}else{num=e.value;num=stripChar(num," ");num=stripChar(num,"-");num=stripChar(num,"+");if(num.length<10){invalid_phoneNumber=true;}}}}
if(e.ssn){if(e.value !=""){num=e.value;num=stripChar(num,"-");if(num.length !=9||!isNumber(num)){invalid_ssn=true;}}}
if(e.date){if(e.value !=""){strDate=e.value;if(!isDate(strDate)){invalid_date=true;}}}}
if(e.quantitybox){iQuantity=e.value;if(!isNumber(iQuantity)){quantity_check=true;}
if(parseInt(iQuantity)<0){quantity_check=true;}
if((iQuantity)<1){quantity_check=true;}}
if(e.password){if(PasswordSet==true){if(e.value !=PasswordStr){passwd_mismatch=true;}}else{PasswordSet=true;PasswordStr=e.value;}}
if(e.type=="select-one"){if(e.required){if(e.options[e.options.selectedIndex].value==""||e.options[e.options.selectedIndex].value=="-1"||(e.options[e.options.selectedIndex].value=="NONE"&&e.name.indexOf("cboShipping")>-1)||(e.options[e.options.selectedIndex].value=="0"&&e.name.indexOf("cboShipChoices")>-1)){empty_fields+="\n            "+title;continue;}}}
if(e.type=="radio"&&e.required){if(strRadioButtonNames.indexOf(";"+e.name+";")==-1){RadioExists=true;RadioChecked=false;RadioCnt=0
strRadioButtonNames=strRadioButtonNames+e.name+";"
if(form.elements[e.name].checked==true){RadioChecked=true;}else if(form.elements[e.name].checked==false){empty_fields+="\n            "+title;}else{do{if(form.elements[e.name][RadioCnt]==undefined){RadioExists=false;}else{if(form.elements[e.name][RadioCnt].checked==true){RadioChecked=true;}}
RadioCnt=++RadioCnt}while(RadioExists==true);if(RadioChecked==false){empty_fields+="\n            "+title;continue;}}}}}
if(!empty_fields&&!char_check&&!invalid_ssn&&!special_Error&&!invalid_card&&!invalid_date&&!invalid_eMail&&!quantity_check&&!invalid_phoneNumber&&!passwd_mismatch){return true}
msg="The form was not submited due to the following error(s).\n";upperLine="\n_________________________________________________________\n\n";lowerLine="_________________________________________________________\n";if(empty_fields){msg+=upperLine;msg+="The following field(s) must be filled in:\n";msg+=lowerLine;msg+=empty_fields;}
if(char_check){msg+=upperLine;msg+="The following field(s) need a numeric value 10 characters long or less:\n";msg+=lowerLine;msg+=char_check;}
if(quantity_check){msg+=upperLine;msg+="Please Enter a Positive Integer.\n"
msg+=lowerLine;}
if(invalid_card){msg+=upperLine;msg+="The Credit Card Number is an invalid format.\n";msg+=lowerLine;}
if(invalid_date){msg+=upperLine;msg+="Please Enter a Valid Date.\n";msg+=lowerLine;}
if(invalid_eMail){msg+=upperLine;msg+="The Email Address is in an invalid format.\n";msg+=lowerLine;}
if(invalid_phoneNumber){msg+=upperLine;msg+="Please enter a valid Phone Number with area code.\n";msg+=lowerLine;}
if(invalid_faxNumber){msg+=upperLine;msg+="Please enter a valid Fax Number with area code.\n";msg+=lowerLine;}
if(invalid_ssn){msg+=upperLine;msg+="Please enter a valid Social Security Number.\n";msg+=lowerLine;}
if(special_Error){msg+=upperLine;msg+=special_Error+"\n";msg+=lowerLine;}
if(passwd_mismatch){msg+=upperLine;msg+="Your passwords did not match. Please enter them again.\n";msg+=lowerLine;}
alert(msg);return false;}
function ExpirationDateMessage(){var msg,upperLine,lowerLine
msg="The form was not submited due to the following error(s).\n";upperLine="\n_________________________________________________________\n\n";lowerLine="_________________________________________________________\n";msg+=upperLine;msg+="Expiration Date is not valid.\n";msg+=lowerLine;alert(msg);return false;}
function DateIssueNumMessage(){var msg,upperLine,lowerLine
msg="The form was not submited due to the following error(s).\n";upperLine="\n_________________________________________________________\n\n";lowerLine="_________________________________________________________\n";msg+=upperLine;msg+="Either a Start Date or Issue Number is required for Switch and Solo payments.\n";msg+=lowerLine;alert(msg);return false;}
function StartDateMessage(){var msg,upperLine,lowerLine
msg="The form was not submited due to the following error(s).\n";upperLine="\n_________________________________________________________\n\n";lowerLine="_________________________________________________________\n";msg+=upperLine;msg+="Start Date is not valid.\n";msg+=lowerLine;alert(msg);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(token,type){this.token=token;this.type=type;}
function parseFormatString(formatStr){var tokArr=new Array;var tokInd=0;var strInd=0;var foundTok=0;while(strInd<formatStr.length){if(formatStr.charAt(strInd)=="%"&&(matchArray=formatStr.substr(strInd+1).match(tokPat))!=null){strInd+=matchArray[0].length+1;tokArr[tokInd++]=new FormatToken(matchArray[0],"symbolic");}else{if(tokInd>0&&tokArr[tokInd-1].type=="literal"){tokArr[tokInd-1].token+=formatStr.charAt(strInd++);}else{tokArr[tokInd++]=new FormatToken(formatStr.charAt(strInd++),"literal");}}}
return tokArr;}
function buildDate(dateStr,formatStr){var tokArr=parseFormatString(formatStr);var strInd=0;var tokInd=0;var intMonth;var intDay;var intYear;var intHour;var intMin;var intSec;var ampm="";var strOffset;var curdate=new Date();intMonth=curdate.getMonth()+1;intDay=curdate.getDate();intYear=curdate.getFullYear();intHour=0;intMin=0;intSec=0;while(strInd<dateStr.length&&tokInd<tokArr.length){if(tokArr[tokInd].type=="literal"){if(dateStr.indexOf(tokArr[tokInd].token,strInd)==strInd){strInd+=tokArr[tokInd++].token.length;continue;}else{return "\""+dateStr+"\" does not conform to the expected format: "+formatStr;}}
switch(tokArr[tokInd].token){case 'm':
case 'M':
case 'd':
case 'D':
case 'h':
case 'H':
case 'min':
case 'MIN':
case 's':
case 'S':
curChar=dateStr.charAt(strInd);nextChar=dateStr.charAt(strInd+1);matchArr=dateStr.substr(strInd).match(/^\d{1,2}/);if(matchArr==null){switch(tokArr[tokInd].token.toLowerCase()){case 'd':var unit="day";break;case 'm':var unit="month";break;case 'h':var unit="hour";break;case 'min':var unit="minute";break;case 's':var unit="second";break;}
return "Bad "+unit+" \""+curChar+"\" or \""+curChar+nextChar+"\".";}
strOffset=matchArr[0].length;switch(tokArr[tokInd].token.toLowerCase()){case 'd':intDay=parseInt(matchArr[0],10);break;case 'm':intMonth=parseInt(matchArr[0],10);break;case 'h':intHour=parseInt(matchArr[0],10);break;case 'min':intMin=parseInt(matchArr[0],10);break;case 's':intSec=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':
strOffset=2;matchArr=dateStr.substr(strInd).match(/^\d{2}/);if(matchArr==null){switch(tokArr[tokInd].token.toLowerCase()){case 'dd':var unit="day";break;case 'mm':var unit="month";break;case 'hh':var unit="hour";break;case 'mins':var unit="minute";break;case 'ss':var unit="second";break;}
return "Bad "+unit+" \""+dateStr.substr(strInd,2)+"\".";}
switch(tokArr[tokInd].token.toLowerCase()){case 'dd':intDay=parseInt(matchArr[0],10);break;case 'mm':intMonth=parseInt(matchArr[0],10);break;case 'hh':intHour=parseInt(matchArr[0],10);break;case 'mins':intMin=parseInt(matchArr[0],10);break;case 'ss':intSec=parseInt(matchArr[0],10);break;}
break;case 'y':
case 'Y':
if(dateStr.substr(strInd,4).search(/\d{4}/)!=-1){intYear=parseInt(dateStr.substr(strInd,4),10);strOffset=4;}else{if(dateStr.substr(strInd,2).search(/\d{2}/)!=-1){intYear=parseInt(dateStr.substr(strInd,2),10);if(intYear>=cutoffYear){intYear+=1900;}else{intYear+=2000;}
strOffset=2;}else{return "Bad year \""+dateStr.substr(strInd,2)+"\". Must be two or four digits.";}}
break;case 'yy':
case 'YY':
if(dateStr.substr(strInd,2).search(/\d{2}/)!=-1){intYear=parseInt(dateStr.substr(strInd,2),10);if(intYear>=cutoffYear){intYear+=1900;}else{intYear+=2000;}
strOffset=2;}else{return "Bad year \""+dateStr.substr(strInd,2)+"\". Must be two digits.";}
break;case 'yyyy':
case 'YYYY':
if(dateStr.substr(strInd,4).search(/\d{4}/)!=-1){intYear=parseInt(dateStr.substr(strInd,4),10);strOffset=4;}else{return "Bad year \""+dateStr.substr(strInd,4)+"\". Must be four digits.";}
break;case 'mon':
case 'Mon':
case 'MON':
case 'mon_strict':
monPat=monPatArr[tokArr[tokInd].token];if(dateStr.substr(strInd,3).search(monPat)!=-1){intMonth=lowerMonArr[dateStr.substr(strInd,3).toLowerCase()];}else{switch(tokArr[tokInd].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 \""+dateStr.substr(strInd,3)+"\". Must be "+caseStat+".";}
strOffset=3;break;case 'month':
case 'Month':
case 'MONTH':
case 'month_strict':
monPat=monthPatArr[tokArr[tokInd].token];matchArray=dateStr.substr(strInd).match(monPat);if(matchArray==null){return "Can't find a month beginning at \""+dateStr.substr(strInd)+"\".";}
intMonth=lowerMonArr[matchArray[0].substr(0,3).toLowerCase()];strOffset=matchArray[0].length;break;case 'ampm':
case 'AMPM':
matchArr=dateStr.substr(strInd).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"){ampm="am";}else{ampm="pm";}
strOffset=matchArr[0].length;break;}
strInd+=strOffset;tokInd++;}
if(tokInd !=tokArr.length||strInd !=dateStr.length){return "\""+dateStr+"\" is either missing desired information or has more information than the expected format: "+formatStr;}
if(intMonth<1||intMonth>12){return "Month must be between 1 and 12.";}
if(intDay<1||intDay>31){return "Day must be between 1 and 31.";}
if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&intDay==31){return "Month "+intMonth+" doesn't have 31 days!";}
if(intMonth==2){var isleap=(intYear%4==0&&(intYear%100!=0||intYear%400==0));if(intDay>29||(intDay==29&&!isleap)){return "February "+intYear+" doesn't have "+intDay+" days!";}}
if(ampm==""){if(intHour<0||intHour>23){return "Hour must be between 0 and 23 for military time.";}}else{if(intHour<1||intHour>12){return "Hour must be between 1 and 12 for standard time.";}}
if(ampm=="am"&&intHour==12){intHour=0;}
if(ampm=="pm"&&intHour<12){intHour+=12;}
if(intMin<0||intMin>59){return "Minute must be between 0 and 59.";}
if(intSec<0||intSec>59){return "Second must be between 0 and 59.";}
return new Date(intYear,intMonth-1,intDay,intHour,intMin,intSec);}
function dateCheck(dateStr,formatStr){var myObj=buildDate(dateStr,formatStr);if(typeof myObj=="object"){return true;}else{return false;}}
function addr(sText){
  if(sText=='#')
  {
    sText='orch';
    sText+='ids&#64;';
    sText+='orchidweb.com';
  }
  var edress='<A HREF="mai';
  edress+='lto:orch';
  edress+='ids&#64;';
  edress+='orchidweb.com">'+sText;
  edress+='</A>';

  return edress;
}
