
function setFocusOnForms(){try{document.Quick_Order_LSide.txtItemID0.focus();}
catch(e){try{document.Product_Search_LSide.txtSearchText.focus();}
catch(e){try{document.Logon_LSide.txtEmail.focus();}
catch(e){try{document.Product_Search_Header.txtSearchText.focus();}
catch(e){try{document.Logon_Header.txtEmail.focus();}
catch(e){}}}}}}
var errmsg;function validateMyForm(frmTemp){var bReturn=true;var intLoop;var e;errmsg='';for(var intLoop=0;intLoop<frmTemp.length;intLoop++){e=frmTemp.elements[intLoop]
if(e.phone){bReturn=validatePhoneNumber(e)&&bReturn;}
else if(e.email){bReturn=validateEmailAddress(e)&&bReturn;}
else if(e.name=='validateDecimal'){bReturn=validateDecimal(e,frmTemp)&&bReturn;}}
if(!bReturn){alert(errmsg);}
return bReturn;}
function validatePhoneNumber(e){var bValid=true;var regX=/^(([1]|(\+\d{1,3}))(\.| |\-)?)?((\(\d{2,3}\))|\d{2,3})(\.| |\-)?\d{3}(\.| |\-)?\d{4}$/;if(!regX.test(e.value)){bValid=false;errmsg+='Please enter a valid phone number\n - International numbers must begin with a "+"\n';}
return bValid;}
function validateEmailAddress(e){var bValid=true;var regX=/^\w(\.?\w)*@\w(\.?[-\w])*\.[a-z]{2,4}$/;if(!regX.test(e.value)){bValid=false;errmsg+='Please enter a valid email address\n';}
return bValid;}
function validateDecimal(e,frmTemp){var arrFields=e.value.split(',')
var bValid=true;var regX=/^(\d+)?(.\d+)?$/;var myField
for(var i=0;i<arrFields.length;i++){myField=document.forms[frmTemp.name].elements[arrFields[i]];if(!regX.test(myField.value)){bValid=false;errmsg+='Please enter a valid numeric value for '+myField.id+'\n';}}
return bValid;}
function resetQOP(QOPForm,intCount){var itemid;var qty;for(var i=0;i<intCount;i++){itemid=QOPForm.elements["txtItemID"+i].value='';qty=QOPForm.elements["txtQuantity"+i].value='';}}
function allDigits(str)
{return inValidCharSet(str,"0123456789");}
function inValidCharSet(str,charset)
{var result=true;for(var i=0;i<str.length;i++){if(charset.indexOf(str.substr(i,1))<0)
{result=false;break;}}
return result;}
function validDate(formField)
{var result=true;var elems=formField.value.split("/");result=(elems.length==3);if(result)
{var month=parseInt(elems[0],10);var day=parseInt(elems[1],10);var year=parseInt(elems[2],10);result=allDigits(elems[0])&&(month>0)&&(month<13)&&allDigits(elems[1])&&(day>0)&&(day<32)&&allDigits(elems[2])&&((elems[2].length==2)||(elems[2].length==4));}
if(!result)
{alert('Date must be in format MM/DD/YYYY or MM/DD/YY');formField.focus();}
return result;}
function reqdatechange()
{if(validDate(document.Shopping_Cart_Content.hdrreqdate)){for(i=0;i<document.Shopping_Cart_Content.elements.length;i++){var e=document.Shopping_Cart_Content.elements[i];if(e.name.indexOf("reqdate")==0){e.value=document.Shopping_Cart_Content.hdrreqdate.value;}}}}
function totalChanged(){var totalAmt=document.My_Account_Open_AR_List_Content.txtTotalAmt.value.replace(",","");if(totalAmt.replace(/^\s+|\s+$/g,'').length==0){totalAmt="0";}
if(isNaN(totalAmt)){alert("You must enter a number.");document.My_Account_Open_AR_List_Content.txtTotalAmt.value=document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value;}
else{totalAmt=twoDecimals(Math.abs(parseFloat(totalAmt)))
var aTotalAmountApplied=parseFloat(document.My_Account_Open_AR_List_Content.TotalAmountApplied.value.replace(",",""));var aTotalPaymentAmount=parseFloat(document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value.replace(",",""));if(parseFloat(totalAmt)-aTotalAmountApplied<0){var bConfirm=confirm("This change will reduce the Total Amount to Apply to be less than the total amount you have allocated.  Continuing with this change will cause all payment amounts on invoices to revert back to '0'.  Continue with this change?");if(bConfirm==true){var i;for(i=0;i<document.My_Account_Open_AR_List_Content.elements.length;i++){var anElement=document.My_Account_Open_AR_List_Content.elements[i];if(anElement.name.indexOf("txtPayment")==0){anElement.value="0.00";}
else{if(anElement.name.indexOf("txtPrevious")==0){anElement.value="0.00";}}}
aTotalAmountApplied=0
document.My_Account_Open_AR_List_Content.TotalAmountApplied.value=twoDecimals(aTotalAmountApplied);aTotalPaymentAmount=parseFloat(totalAmt)
document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value=twoDecimals(aTotalPaymentAmount);document.My_Account_Open_AR_List_Content.txtTotalAmt.value=document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value;document.My_Account_Open_AR_List_Content.AmountLeftToApply.value=twoDecimals(aTotalPaymentAmount-aTotalAmountApplied);var oAmtLeft=document.getElementById("divAmtLeft");if(oAmtLeft.firstChild!=null){oAmtLeft.firstChild.nodeValue="$"+document.My_Account_Open_AR_List_Content.AmountLeftToApply.value;}
document.My_Account_Open_AR_List_Content.RowID.value="0";document.My_Account_Open_AR_List_Content.Action.value="ClearSession";document.My_Account_Open_AR_List_Content.submit();}
else{document.My_Account_Open_AR_List_Content.txtTotalAmt.value=twoDecimals(aTotalPaymentAmount);}}
else{document.My_Account_Open_AR_List_Content.TotalAmountApplied.value=twoDecimals(aTotalAmountApplied);aTotalPaymentAmount=parseFloat(totalAmt)
document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value=twoDecimals(aTotalPaymentAmount);document.My_Account_Open_AR_List_Content.txtTotalAmt.value=document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value;document.My_Account_Open_AR_List_Content.AmountLeftToApply.value=twoDecimals(aTotalPaymentAmount-aTotalAmountApplied);var oAmtLeft=document.getElementById("divAmtLeft");if(oAmtLeft.firstChild!=null){oAmtLeft.firstChild.nodeValue="$"+document.My_Account_Open_AR_List_Content.AmountLeftToApply.value;}}}}
function paymentChanged(PmtAmt,PrevAmt,MaxAmt){var paymentAmt=PmtAmt.value.replace(",","");var previousAmt=PrevAmt.value.replace(",","");var maxAmt=MaxAmt.value.replace(",","");if(paymentAmt.replace(/^\s+|\s+$/g,'').length==0){paymentAmt="0";}
if(isNaN(paymentAmt)){alert("You must enter a number.");PmtAmt.value=PrevAmt.value}
else{if(Math.abs(parseFloat(paymentAmt))>Math.abs(parseFloat(maxAmt))){paymentAmt=maxAmt;if((document.getElementById("OverpaymentMessage").firstChild!=null)&&(document.getElementById("OverpaymentMessage").firstChild.nodeValue.length>0)){alert(document.getElementById("OverpaymentMessage").firstChild.nodeValue);}}
else{if(parseFloat(maxAmt)>0){paymentAmt=twoDecimals(Math.abs(parseFloat(paymentAmt)))}
else{paymentAmt=twoDecimals(-1*Math.abs(parseFloat(paymentAmt)))}}
var aTotalAmountApplied=parseFloat(document.My_Account_Open_AR_List_Content.TotalAmountApplied.value.replace(",",""));var aTotalPaymentAmount=parseFloat(document.My_Account_Open_AR_List_Content.txtTotalAmt.value.replace(",",""));var difference=parseFloat(paymentAmt)-parseFloat(previousAmt);aTotalAmountApplied=aTotalAmountApplied+difference;document.My_Account_Open_AR_List_Content.TotalAmountApplied.value=twoDecimals(aTotalAmountApplied);if(aTotalAmountApplied>aTotalPaymentAmount){aTotalPaymentAmount=aTotalAmountApplied;}
document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value=twoDecimals(aTotalPaymentAmount);document.My_Account_Open_AR_List_Content.txtTotalAmt.value=document.My_Account_Open_AR_List_Content.TotalPaymentAmount.value;document.My_Account_Open_AR_List_Content.AmountLeftToApply.value=twoDecimals(aTotalPaymentAmount-aTotalAmountApplied);var oAmtLeft=document.getElementById("divAmtLeft");if(oAmtLeft.firstChild!=null){oAmtLeft.firstChild.nodeValue="$"+document.My_Account_Open_AR_List_Content.AmountLeftToApply.value;}
PrevAmt.value=twoDecimals(parseFloat(paymentAmt));PmtAmt.value=twoDecimals(Math.abs(parseFloat(paymentAmt)));}}
function checkTotal(For,By,Start,End,CompleteAR){document.My_Account_Open_AR_List_Content.Action.value="MakePayment";document.My_Account_Open_AR_List_Content.submit();}
function setRedirect(url){document.My_Account_Open_AR_List_Content.Redirect.value=url;document.My_Account_Open_AR_List_Content.Action.value="Redirect";document.My_Account_Open_AR_List_Content.submit();}
function twoDecimals(n){var s=""+Math.round(n*100)/100
var i=s.indexOf('.')
if(i<0)return s+".00"
var t=s.substring(0,i+1)+s.substring(i+1,i+3)
if(i+2==s.length)t+="0"
return t}
function openWindow(url,title,width,height,scrollbars,resizable,toolbar,menubar){var properties="width="+width+","+"height="+height+",left="+((screen.width/2)-width/2)+",top="+((screen.height/2)-height/2)+",scrollbars="+scrollbars+",resizable="+resizable+",toolbar="+toolbar+",menubar="+menubar;NFW=window.open(url,title,properties)
NFW.focus()}
function popupImage(sImgSrc){if(sImgSrc.substring(0,9)=='customer/'){sImgSrc='../../'+sImgSrc;}
window.open("customer/p21customerpages/PopupImage.html?"+sImgSrc,"PopupImage","resizable=0,location=0,height=250,width=250");}
function locationSelect(page,sel){var s=document.getElementById(sel);if(s!=null){location.href=page+s.options[s.selectedIndex].value;}}
function checkValue(btnName){var isNetscape=false;var isIE=false;var isW3Dom=false;var isIEMac=false;var isWhoKnows=false
var df=document.forms[0];var theButtonPressed;if(document.layers){isNetscape=true;}
else if(document.all){isIE=true;}
else if(document.getElementById){isW3Dom=true;}
else{isWhoKnows=true;}
if(isNetscape){theButtonPressed=evt.which;}
else if(isIE){theButtonPressed=window.event.keyCode;}
else if(isW3Dom){theButtonPressed=evt.keyCode;}
else{alert("Please hit the submit button to process form");theButtonPressed=0;}
if(theButtonPressed==13){document.Form1.ButtonPressed.value=btnName;}
else{document.Form1.ButtonPressed.value='';}}
function shipChange(ddown){if(ddown.selectedIndex==0){document.Form1._ctl3_txtAddr1.readonly=false;document.Form1._ctl3_txtAddr2.readonly=false;document.Form1._ctl3_txtCity.readonly=false;document.Form1._ctl3_txtState.readonly=false;document.Form1._ctl3_txtZip.readonly=false;document.Form1._ctl3_txtCountry.readonly=false;}
else{document.Form1._ctl3_txtAddr1.readonly=true;document.Form1._ctl3_txtAddr2.readonly=true;document.Form1._ctl3_txtCity.readonly=true;document.Form1._ctl3_txtState.readonly=true;document.Form1._ctl3_txtZip.readonly=true;document.Form1._ctl3_txtCountry.readonly=true;}}
function billChange(ddown){if(ddown.selectedIndex.value==0){document.Form1._ctl3_txtCreditCardName.readonly=false;document.Form1._ctl3_txtCreditCardNumber.readonly=false;document.Form1._ctl3_txtCreditCardMonth.readonly=false;document.Form1._ctl3_txtCreditCardYear.readonly=false;}
else{document.Form1.txtCreditCardName.readonly=true;document.Form1.txtCreditCardNumber.readonly=true;document.Form1.txtCreditCardMonth.readonly=true;document.Form1.txtCreditCardYear.readonly=true;}}
function initializeCalendar(){calDateFormat="MM/DD/YY";topBackground="#D2DDC8";bottomBackground="#D2DDC8";tableBGColor="black";cellColor="lightgrey";headingCellColor="510367";headingTextColor="white";dateColor="510367";focusColor="#ff0000";hoverColor="darkred";fontStyle="12pt arial, helvetica";headingFontStyle="bold 12pt arial, helvetica";bottomBorder=false;tableBorder=0;isNav=false;isIE=false;if(navigator.appName=="Netscape"){isNav=true;}
else{isIE=true;}
selectedLanguage=navigator.language;buildCalParts();}
function getCalendar(inputfield){setDateField(inputfield);showCalendar(inputfield);}
function showCalendar(dateField){setDateField(dateField);calDocFrameset="<HTML><HEAD><TITLE>Calendar</TITLE></HEAD>\n"+"<FRAMESET ROWS='70,*' FRAMEBORDER='0'>\n"+"  <FRAME NAME='topCalFrame' SRC='javascript:parent.opener.calDocTop' SCROLLING='no'>\n"+"  <FRAME NAME='bottomCalFrame' SRC='javascript:parent.opener.calDocBottom' SCROLLING='no'>\n"+"</FRAMESET>\n";top.newWin=window.open("javascript:parent.opener.calDocFrameset",'cal','dependant=yes, width=210, height=230, left=600,top=350,titlebar=yes');top.newWin.focus();}
function setDateField(dateField){calDateField=dateField;inDate=dateField.value;setInitialDate();calDocTop=buildTopCalFrame();calDocBottom=buildBottomCalFrame();}
function setInitialDate(){calDate=new Date(inDate);if(isNaN(calDate)){calDate=new Date();}
calDay=calDate.getDate();calDate.setDate(1);}
function buildTopCalFrame(){var calDoc="<HTML>"+"<HEAD>"+"</HEAD>"+"<BODY BGCOLOR='"+topBackground+"'>"+"<FORM NAME='calControl' onSubmit='return false;'>"+"<CENTER>"+"<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0>"+"<TR><TD COLSPAN=7>"+"<CENTER>"+
getMonthSelect()+"<INPUT NAME='year' VALUE='"+calDate.getFullYear()+"'TYPE=TEXT SIZE=4 MAXLENGTH=4 onChange='parent.opener.setYear()'>"+"</CENTER>"+"</TD>"+"</TR>"+"<TR>"+"<TD COLSPAN=7>"+"<INPUT "+"TYPE=BUTTON NAME='previousYear' VALUE='<<'    onClick='parent.opener.setPreviousYear()'><INPUT "+"TYPE=BUTTON NAME='previousMonth' VALUE=' < '   onClick='parent.opener.setPreviousMonth()'><INPUT "+"TYPE=BUTTON NAME='today' VALUE='Today' onClick='parent.opener.setToday()'><INPUT "+"TYPE=BUTTON NAME='nextMonth' VALUE=' > '   onClick='parent.opener.setNextMonth()'><INPUT "+"TYPE=BUTTON NAME='nextYear' VALUE='>>'    onClick='parent.opener.setNextYear()'>"+"</TD>"+"</TR>"+"</TABLE>"+"</CENTER>"+"</FORM>"+"</BODY>"+"</HTML>";return calDoc;}
function buildBottomCalFrame(){var calDoc=calendarBegin;month=calDate.getMonth();year=calDate.getFullYear();day=calDay;var i=0;var days=getDaysInMonth();if(day>days){day=days;}
var firstOfMonth=new Date(year,month,1);var startingPos=firstOfMonth.getDay();days+=startingPos;var columnCount=0;for(i=0;i<startingPos;i++){calDoc+=blankCell;columnCount++;}
var currentDay=0;var dayType="weekday";for(i=startingPos;i<days;i++){var paddingChar="&nbsp;";if(i-startingPos+1<10){padding="&nbsp;&nbsp;";}
else{padding="&nbsp;";}
currentDay=i-startingPos+1;if(currentDay==day){dayType="focusDay";}
else{dayType="weekDay";}
calDoc+="<TD align=center bgcolor='"+cellColor+"'>"+"<a class='"+dayType+"' href='javascript:parent.opener.returnDate("+
currentDay+")'>"+padding+currentDay+paddingChar+"</a></TD>";columnCount++;if(columnCount%7==0){calDoc+="</TR><TR>";}}
for(i=days;i<42;i++){calDoc+=blankCell;columnCount++;if(columnCount%7==0){calDoc+="</TR>";if(i<41){calDoc+="<TR>";}}}
calDoc+=calendarEnd;return calDoc;}
function writeCalendar(){calDocBottom=buildBottomCalFrame();top.newWin.frames['bottomCalFrame'].document.open();top.newWin.frames['bottomCalFrame'].document.write(calDocBottom);top.newWin.frames['bottomCalFrame'].document.close();}
function setToday(){calDate=new Date();var month=calDate.getMonth();var year=calDate.getFullYear();top.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex=month;top.newWin.frames['topCalFrame'].document.calControl.year.value=year;inDate="";setInitialDate();writeCalendar();}
function setYear(){var year=top.newWin.frames['topCalFrame'].document.calControl.year.value;if(isFourDigitYear(year)){calDate.setFullYear(year);writeCalendar();}
else{top.newWin.frames['topCalFrame'].document.calControl.year.focus();top.newWin.frames['topCalFrame'].document.calControl.year.select();}}
function setCurrentMonth(){var month=top.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex;calDate.setMonth(month);writeCalendar();}
function setPreviousYear(){var year=top.newWin.frames['topCalFrame'].document.calControl.year.value;if(isFourDigitYear(year)&&year>1000){year--;calDate.setFullYear(year);top.newWin.frames['topCalFrame'].document.calControl.year.value=year;writeCalendar();}}
function setPreviousMonth(){var year=top.newWin.frames['topCalFrame'].document.calControl.year.value;if(isFourDigitYear(year)){var month=top.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex;if(month==0){month=11;if(year>1000){year--;calDate.setFullYear(year);top.newWin.frames['topCalFrame'].document.calControl.year.value=year;}}
else{month--;}
calDate.setMonth(month);top.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex=month;writeCalendar();}}
function setNextMonth(){var year=top.newWin.frames['topCalFrame'].document.calControl.year.value;if(isFourDigitYear(year)){var month=top.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex;if(month==11){month=0;year++;calDate.setFullYear(year);top.newWin.frames['topCalFrame'].document.calControl.year.value=year;}
else{month++;}
calDate.setMonth(month);top.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex=month;writeCalendar();}}
function setNextYear(){var year=top.newWin.frames['topCalFrame'].document.calControl.year.value;if(isFourDigitYear(year)){year++;calDate.setFullYear(year);top.newWin.frames['topCalFrame'].document.calControl.year.value=year;writeCalendar();}}
function getDaysInMonth(){var days;var month=calDate.getMonth()+1;var year=calDate.getFullYear();if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){days=31;}
else if(month==4||month==6||month==9||month==11){days=30;}
else if(month==2){if(isLeapYear(year)){days=29;}
else{days=28;}}
return(days);}
function isLeapYear(Year){if(((Year%4)==0)&&((Year%100)!=0)||((Year%400)==0)){return(true);}
else{return(false);}}
function isFourDigitYear(year){if(year.length!=4){top.newWin.frames['topCalFrame'].document.calControl.year.value=calDate.getFullYear();top.newWin.frames['topCalFrame'].document.calControl.year.select();top.newWin.frames['topCalFrame'].document.calControl.year.focus();}
else{return true;}}
function getMonthSelect(){if(selectedLanguage=="fr"){monthArray=new Array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','Décembre');}
else if(selectedLanguage=="de"){monthArray=new Array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');}
else if(selectedLanguage=="es"){monthArray=new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');}
else{monthArray=new Array('January','February','March','April','May','June','July','August','September','October','November','December');}
var activeMonth=calDate.getMonth();monthSelect="<SELECT NAME='month' onChange='parent.opener.setCurrentMonth()'>";for(i in monthArray){if(i==activeMonth){monthSelect+="<OPTION SELECTED>"+monthArray[i]+"\n";}
else{monthSelect+="<OPTION>"+monthArray[i]+"\n";}}
monthSelect+="</SELECT>";return monthSelect;}
function createWeekdayList(){if(selectedLanguage=="fr"){weekdayList=new Array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');weekdayArray=new Array('Di','Lu','Ma','Me','Je','Ve','Sa');}
else if(selectedLanguage=="de"){weekdayList=new Array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');weekdayArray=new Array('So','Mo','Di','Mi','Do','Fr','Sa');}
else if(selectedLanguage=="es"){weekdayList=new Array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado')
weekdayArray=new Array('Do','Lu','Ma','Mi','Ju','Vi','Sa');}
else{weekdayList=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');weekdayArray=new Array('Su','Mo','Tu','We','Th','Fr','Sa');}
var weekdays="<TR BGCOLOR='"+headingCellColor+"'>";for(i in weekdayArray){weekdays+="<TD class='heading' align=center>"+weekdayArray[i]+"</TD>";}
weekdays+="</TR>";return weekdays;}
function buildCalParts(){weekdays=createWeekdayList();blankCell="<TD align=center bgcolor='"+cellColor+"'>&nbsp;&nbsp;&nbsp;</TD>";calendarBegin="<HTML>"+"<HEAD>"+"<STYLE type='text/css'>"+"<!--"+"TD.heading { text-decoration: none; color:"+headingTextColor+"; font: "+headingFontStyle+"; }"+"A.focusDay:link { color: "+focusColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.focusDay:hover { color: "+focusColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.weekday:link { color: "+dateColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.weekday:hover { color: "+hoverColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.focusDay:visited { color: "+focusColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.weekday:visited { color: "+dateColor+"; text-decoration: none; font: "+fontStyle+"; }"+"-->"+"</STYLE>"+"</HEAD>"+"<BODY BGCOLOR='"+bottomBackground+"'"+"<CENTER>";if(isNav){calendarBegin+="<TABLE CELLPADDING=0 CELLSPACING=1 BORDER="+tableBorder+" ALIGN=CENTER BGCOLOR='"+tableBGColor+"'><TR><TD>";}
calendarBegin+="<TABLE CELLPADDING=0 CELLSPACING=1 BORDER="+tableBorder+" ALIGN=CENTER BGCOLOR='"+tableBGColor+"'>"+
weekdays+"<TR>";calendarEnd="";if(bottomBorder){calendarEnd+="<TR></TR>";}
if(isNav){calendarEnd+="</TD></TR></TABLE>";}
calendarEnd+="</TABLE>"+"</CENTER>"+"</BODY>"+"</HTML>";}
function jsReplace(inString,find,replace){var outString="";if(!inString){return"";}
if(inString.indexOf(find)!=-1){t=inString.split(find);return(t.join(replace));}
else{return inString;}}
function doNothing(){}
function makeTwoDigit(inValue){var numVal=parseInt(inValue,10);if(numVal<10){return("0"+numVal);}
else{return numVal;}}
function returnDate(inDay)
{calDate.setDate(inDay);var day=calDate.getDate();var month=calDate.getMonth()+1;var year=calDate.getFullYear();var monthString=monthArray[calDate.getMonth()];var monthAbbrev=monthString.substring(0,3);var weekday=weekdayList[calDate.getDay()];var weekdayAbbrev=weekday.substring(0,3);outDate=calDateFormat;if(calDateFormat.indexOf("DD")!=-1){day=makeTwoDigit(day);outDate=jsReplace(outDate,"DD",day);}
else if(calDateFormat.indexOf("dd")!=-1){outDate=jsReplace(outDate,"dd",day);}
if(calDateFormat.indexOf("MM")!=-1){month=makeTwoDigit(month);outDate=jsReplace(outDate,"MM",month);}
else if(calDateFormat.indexOf("mm")!=-1){outDate=jsReplace(outDate,"mm",month);}
if(calDateFormat.indexOf("yyyy")!=-1){outDate=jsReplace(outDate,"yyyy",year);}
else if(calDateFormat.indexOf("yy")!=-1){var yearString=""+year;var yearString=yearString.substring(2,4);outDate=jsReplace(outDate,"yy",yearString);}
else if(calDateFormat.indexOf("YY")!=-1){outDate=jsReplace(outDate,"YY",year);}
if(calDateFormat.indexOf("Month")!=-1){outDate=jsReplace(outDate,"Month",monthString);}
else if(calDateFormat.indexOf("month")!=-1){outDate=jsReplace(outDate,"month",monthString.toLowerCase());}
else if(calDateFormat.indexOf("MONTH")!=-1){outDate=jsReplace(outDate,"MONTH",monthString.toUpperCase());}
if(calDateFormat.indexOf("Mon")!=-1){outDate=jsReplace(outDate,"Mon",monthAbbrev);}
else if(calDateFormat.indexOf("mon")!=-1){outDate=jsReplace(outDate,"mon",monthAbbrev.toLowerCase());}
else if(calDateFormat.indexOf("MON")!=-1){outDate=jsReplace(outDate,"MON",monthAbbrev.toUpperCase());}
if(calDateFormat.indexOf("Weekday")!=-1){outDate=jsReplace(outDate,"Weekday",weekday);}
else if(calDateFormat.indexOf("weekday")!=-1){outDate=jsReplace(outDate,"weekday",weekday.toLowerCase());}
else if(calDateFormat.indexOf("WEEKDAY")!=-1){outDate=jsReplace(outDate,"WEEKDAY",weekday.toUpperCase());}
if(calDateFormat.indexOf("Wkdy")!=-1){outDate=jsReplace(outDate,"Wkdy",weekdayAbbrev);}
else if(calDateFormat.indexOf("wkdy")!=-1){outDate=jsReplace(outDate,"wkdy",weekdayAbbrev.toLowerCase());}
else if(calDateFormat.indexOf("WKDY")!=-1){outDate=jsReplace(outDate,"WKDY",weekdayAbbrev.toUpperCase());}
calDateField.value=outDate;calDateField.focus();top.newWin.close()}
initializeCalendar();function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function KeyPressed()
{if(event.keyCode==13)
{event.cancelBubble=true;event.keyCode=9;event.returnValue=true;}}
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');function LZ(x){return(x<0||x>9?"":"0")+x}
function isDate(val,format){var date=getDateFromFormat(val,format);if(date==0){return false;}
return true;}
function compareDates(date1,dateformat1,date2,dateformat2){var d1=getDateFromFormat(date1,dateformat1);var d2=getDateFromFormat(date2,dateformat2);if(d1==0||d2==0){return-1;}
else if(d1>d2){return 1;}
return 0;}
function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length<4){y=""+(y-0+1900);}
value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["d"]=d;value["dd"]=LZ(d);value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}
else if(H>12){value["h"]=H-12;}
else{value["h"]=H;}
value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}
value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H>11){value["a"]="PM";}
else{value["a"]="AM";}
value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}
if(value[token]!=null){result=result+value[token];}
else{result=result+token;}}
return result;}
function _isInteger(val){var digits="1234567890";for(var i=0;i<val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}
return true;}
function _getInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length<minlength){return null;}
if(_isInteger(token)){return token;}}
return null;}
function getDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getYear();var month=now.getMonth()+1;var date=now.getDate();var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}
if(token=="yyyy"||token=="yy"||token=="y"){if(token=="yyyy"){x=4;y=4;}
if(token=="yy"){x=2;y=2;}
if(token=="y"){x=2;y=4;}
year=_getInt(val,i_val,x,y);if(year==null){return 0;}
i_val+=year.length;if(year.length==2){if(year>70){year=1900+(year-0);}
else{year=2000+(year-0);}}}
else if(token=="MMM"){month=0;for(var i=0;i<MONTH_NAMES.length;i++){var month_name=MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){month=i+1;if(month>12){month-=12;}
i_val+=month_name.length;break;}}
if((month<1)||(month>12)){return 0;}}
else if(token=="MM"||token=="M"){month=_getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return 0;}
i_val+=month.length;}
else if(token=="dd"||token=="d"){date=_getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0;}
i_val+=date.length;}
else if(token=="hh"||token=="h"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}
i_val+=hh.length;}
else if(token=="HH"||token=="H"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}
i_val+=hh.length;}
else if(token=="KK"||token=="K"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}
i_val+=hh.length;}
else if(token=="kk"||token=="k"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}
i_val+=hh.length;hh--;}
else if(token=="mm"||token=="m"){mm=_getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}
i_val+=mm.length;}
else if(token=="ss"||token=="s"){ss=_getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}
i_val+=ss.length;}
else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}
else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}
else{return 0;}
i_val+=2;}
else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}
else{i_val+=token.length;}}}
if(i_val!=val.length){return 0;}
if(month==2){if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29){return false;}}
else{if(date>28){return false;}}}
if((month==4)||(month==6)||(month==9)||(month==11)){if(date>30){return false;}}
if(hh<12&&ampm=="PM"){hh+=12;}
else if(hh>11&&ampm=="AM"){hh-=12;}
var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();}
function confirmUpload(form,val){var answer=confirm(val)
if(answer){return true;}
else{return false;}}
function openChild(file,window){childWindow=open(file,window,'resizable=no, scrollbars=1, width=610, height=580, left=212, top=50');if(childWindow.opener==null)
childWindow.opener=self;}
function openChildWithAttributes(file,window,attributes){childWindow=open(file,window,attributes);if(childWindow.opener==null)
childWindow.opener=self;}
function updateQtyToOrder(checkboxID,item_id){oElemOrigQty=document.getElementById("SelectItemToOrder_txtOrigQty"+item_id);oElemOrderQty=document.getElementById("SelectItemToOrder_txtQuantity"+item_id);if(oElemOrderQty!=null){if(oElemOrigQty!=null){if(checkboxID.checked)
oElemOrderQty.value=oElemOrigQty.value;else
oElemOrderQty.value='';}
else{if(checkboxID.checked)
oElemOrderQty.value=1;else
oElemOrderQty.value='';}}}
function updateSelectedCheckBox(QuantityToOrderID,item_id){if(document.getElementById)
oElemCB=document.getElementById("SelectItemToOrder_item"+item_id);if(oElemCB!=null){if(QuantityToOrderID.value!='')
oElemCB.checked=true;else
oElemCB.checked=false;}}
function updatePlacedOrder(iLines){if(validateAllQtyToOrder(iLines)){;if(confirm('Are you sure you want to submit this order?')){if(document.getElementById)
oElemCB=document.getElementById("PlacedOrder");if(oElemCB!=null){oElemCB.value='Y';return true;}}}
return false;}
function validateQtyToOrder(QuantityToOrderID,item_id){if(document.getElementById){oElemCB=document.getElementById("SelectItemToOrder_item"+item_id);oElemOrigQty=document.getElementById("SelectItemToOrder_txtOrigQty"+item_id);}
if(oElemCB!=null){if((QuantityToOrderID.value!='')&&(QuantityToOrderID.value!=0)&&(!isNaN(parseFloat(QuantityToOrderID.value)))){oElemCB.checked=true;if(parseFloat(QuantityToOrderID.value)<parseFloat(oElemOrigQty.value)){alert('Please enter a quantity greater than or equal to the quoted quantity.');QuantityToOrderID.focus();QuantityToOrderID.select();return;}
QuantityToOrderID.value=parseFloat(QuantityToOrderID.value);}else{oElemCB.checked=false;QuantityToOrderID.value='';}}}
function validateAllQtyToOrder(iLines){var bItemToAdd=false;for(var i=0;i<iLines;i++){oElem=document.getElementById("SelectItemToOrder_txtQuantity"+i);if(oElem!=null){if((oElem.value!='')&&(oElem.value!=0)&&(!isNaN(parseFloat(oElem.value)))){bItemToAdd=true;break;}}}
if(!bItemToAdd){alert('Please select at least one item before submiting order.');return false;}else
return true;}
function changeCssWidthRuleToContents(className){var cssRules=new Array();var sContent='.Content';var sContentWidth;var x;if(document.styleSheets[0].cssRules)
cssRules=document.styleSheets[0].cssRules;else if(document.styleSheets[0].rules)
cssRules=document.styleSheets[0].rules;for(x=0;x<cssRules.length;x++){if(cssRules[x].selectorText==sContent){sContentWidth=cssRules[x].style.width;}}
for(x=0;x<cssRules.length;x++){if(cssRules[x].selectorText==className){cssRules[x].style.width=sContentWidth;}}}
function CheckMaxRowsChars(textarea,iMaxRows,iMaxCharsPerRow,iMaxCharacters){var lines=textarea.value.replace(/\r/g,'').split('\n');if(iMaxRows&&lines.length>iMaxRows){for(var i=0;i<lines.length;i++){if(lines[i]=='')
textarea.value=lines.slice(0,i).concat(lines.slice(i+1,lines.length)).join('\n');}
lines=textarea.value.replace(/\r/g,'').split('\n');if(lines.length>iMaxRows)
textarea.value=lines.slice(0,iMaxRows).join('\n');alert('Only '+iMaxRows+' lines are allowed.');}
for(var i=0;iMaxCharsPerRow&&(i<lines.length);i++){if(lines[i].length>iMaxCharsPerRow){lines[i]=lines[i].substring(0,iMaxCharsPerRow);textarea.value=lines.join('\n');alert('Only '+iMaxCharsPerRow+' characters are allowed per row.');}}
if(iMaxCharacters){lines=textarea.value.replace(/^\s+|\s+$/g,'');if(lines.length>iMaxCharacters){textarea.value=lines.substring(0,iMaxCharacters);alert('Only '+iMaxCharacters+' characters are allowed.');}}}
function getElementById(id){if(document.getElementById)
return document.getElementById(id);if(document.all)
return document.all[id];}
if(!Number.toFixed){Number.prototype.toFixed=function(x){var temp=this;temp=Math.round(temp*Math.pow(10,x))/Math.pow(10,x);return temp;};}
var ie=document.all;function IsNumeric(sText)
{var ValidChars="$0123456789.";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber==true;i++)
{Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1)
{IsNumber=false;}}
return IsNumber;}
function AppendZeros(number,length){var str=''+number;if(number==0)
str='0.00';if(str.split('.')[1]==null)
return str;while(str.split('.')[1].length<length){str=str+'0';}
return str;}
function getObjInnerText(obj){return(obj.innerText)?obj.innerText:(obj.textContent)?obj.textContent:"";}
function updateFreight(NewFreightAmount,replaceZeroFreight){var TotalAmount,FreightAmount,iDecimalNumbers;if(NewFreightAmount==null)
NewFreightAmount=0.00;eFreightAmount=getElementById('FreightAmount');if(eFreightAmount==null)
return;eInvoiceTotal=getElementById('InvoiceTotal');if(eInvoiceTotal==null)
return;if(getObjInnerText(eFreightAmount).indexOf('.')<0){if(!IsNumeric(getObjInnerText(eFreightAmount))){if(ie)
eFreightAmount.innerText='$0.00';else
eFreightAmount.textContent='$0.00';}
else{if(ie)
eFreightAmount.innerText=AppendZeros(getObjInnerText(eFreightAmount)+'.',2);else
eFreightAmount.textContent=AppendZeros(getObjInnerText(eFreightAmount)+'.',2);}}
if(getObjInnerText(eInvoiceTotal).indexOf('.')<0){if(ie)
eInvoiceTotal.innerText=AppendZeros(getObjInnerText(eInvoiceTotal)+'.',2);else
eInvoiceTotal.textContent=AppendZeros(getObjInnerText(eInvoiceTotal)+'.',2);}
iDecimalNumbers=getObjInnerText(eInvoiceTotal).split('.')[1].length;FreightAmount=parseFloat(getObjInnerText(eFreightAmount).split('$')[1]);if(FreightAmount==null)
FreightAmount=0;TotalAmount=parseFloat(getObjInnerText(eInvoiceTotal).split('$')[1]);if(TotalAmount==null)
TotalAmount=0;TotalAmount=(TotalAmount.toFixed(iDecimalNumbers)-FreightAmount.toFixed(iDecimalNumbers)).toFixed(iDecimalNumbers);if(TotalAmount<0)
TotalAmount=0;TotalAmount=(TotalAmount.toFixed(iDecimalNumbers)+parseFloat(NewFreightAmount).toFixed(iDecimalNumbers)).toFixed(iDecimalNumbers);if((parseFloat(NewFreightAmount)<=0)&&(replaceZeroFreight.length>0)){if(ie)
eFreightAmount.innerText=replaceZeroFreight;else
eFreightAmount.textContent=replaceZeroFreight;}
else{if(ie)
eFreightAmount.innerText='$'+AppendZeros(NewFreightAmount,iDecimalNumbers);else
eFreightAmount.textContent='$'+AppendZeros(NewFreightAmount,iDecimalNumbers);}
if(ie)
eInvoiceTotal.innerText='$'+AppendZeros(TotalAmount,iDecimalNumbers);else
eInvoiceTotal.textContent='$'+AppendZeros(TotalAmount,iDecimalNumbers);}
function printBabyprint(){var browser=navigator.appName;if((browser=="Microsoft Internet Explorer")){window.print();}
else{window.print();}}
function setFonts()
{var myRatio=parseInt((parseInt(parent.document.body.offsetWidth)/640)*100);myRatio=(myRatio>100?myRatio:100);document.styleSheets[document.styleSheets.length-1].rules[0].style.zoom=myRatio+"%";}
function trimAll(sString)
{while(sString.substring(0,1)==' ')
sString=sString.substring(1,sString.length);while(sString.substring(sString.length-1,sString.length)==' ')
sString=sString.substring(0,sString.length-1);return sString;}