<!-- Begin
var isNN = (navigator.appName.indexOf("Netscape")!=-1);


function ChatWin(){
window.open('http://www.BasesToWeave.com/Chat/chat.html','','color=#A3ACC2,scrollbars=0,width=320,height=360,status=1,screenX=35,screenY=35,top=35,left=35');
}


function isNumeric(strString)
   //  check for valid numeric strings 
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function CheckOut1(){
window.location="https://BasesToWeave.com/html/OrderPage1.asp";
}

function arr2rs(arr, rs) {
    for(var f in arr)
      if(rs.fields(f))
        {rs.fields(f).value = arr[f];}
  } 
  
function CartItemCheck(Qid,QVal){
var qLine=GetDCookie("btwCust;CartList");
if (qLine==undefined || qLine==null || qLine.length==0)
	{qRetVal=false;return false;}
DeleteDCookie("btwCust;CartList");
var qList=qLine.split("^");
var qItemID="";
var NewLen=qList.length-1;
var NewLine="";
var qElement="";
var ToReplace="";
var ReplaceWith="QTY:"+QVal;
var qRetVal=false;
var pLine="";
var qString="";
var delim="|";

// Process each line item of the parent array 
for(i=0; i<=qList.length-1; i++) 
	{// break down each line item into it's various values: ID,Number,Name,Price,Qty,Extended
		qElement=qList[i];
		qItemID=qElement.substr(qElement.indexOf("ID:")+3,qElement.indexOf("|NUM")-3);
		qNum=qElement.substring(qElement.indexOf("|NUM:")+5,qElement.indexOf("|NAME:"));
		qName=qElement.substring(qElement.indexOf("|NAME:")+6,qElement.indexOf("|QTY:"));
		qQty=qElement.substring(qElement.indexOf("|QTY:")+5,qElement.indexOf("|PRICE:"));
		qPrice=qElement.substring(qElement.indexOf("|PRICE:")+7,qElement.indexOf("|EXTENDED:"));
		qExtended=qElement.substr(qElement.indexOf("|EXTENDED:")+10,qElement.length-qElement.indexOf("|EXTENDED:"));
		if (qItemID==Qid)  // If this Item's ItemID is the one we're trying to add to, ..
			{qRetVal=true;qQty=(QVal*1);} //replace the old Qty with the new Qty and calc the Extended amount
			qQty=(qQty*1);
			qPrice=(qPrice*1);
			qExtended=(qQty*qPrice);
			qString =  "ID:"+qItemID+delim+"NUM:"+qNum+delim+"NAME:"+qName+delim+"QTY:"+qQty+delim+"PRICE:"+qPrice+delim+"EXTENDED:"+qExtended;
			NewLine=NewLine+qString+"^"
	} // end of the first FOR loop

	if (NewLine.substr(NewLine.length-1,1)=="^")
			{NewLine=NewLine.substr(0,NewLine.length-1);}
	SetDCookie("btwCust;CartList",NewLine);
	return qRetVal;
} // End of Function 

//  Add a new Item to the Shopping Cart Cookie Array
function CartAdd(HotItem){

var xPrev = GetDCookie("btwCust;CartList");

var delim = "|";

var kQtyName = HotItem+"QTY";
//alert("kQtyName = "+kQtyName);

var kQty = "QTY:"+document.getElementById(kQtyName).value;
//alert("kQty = "+kQty);

var kQtyVal = document.getElementById(kQtyName).value;
//alert("kQtyVal = "+kQtyVal);

if (kQtyVal=="" || kQtyVal==" " || kQtyVal==null)
	{alert("   Please Enter a Number in the Quantity Box...   ");return;}
// Check to see if they already have one of these Items in the SHopping Cart and adjust it.//

	if (kQtyVal>=36)
		{kQtyVal="";document.getElementById(kQtyName).value=kQtyVal;
			alert("Sorry, You can order only 36 or less of any Item.");document.getElementById(kQtyName).focus();return;}

//alert("yPrev = "+yPrev);

var cReturn = CartItemCheck(HotItem,kQtyVal);

// Test line added drk  07/22/06
xPrev = GetDCookie("btwCust;CartList");

//alert("xPrev = "+xPrev);

if (cReturn==true)
	{document.getElementById(kQtyName).value="";
	document.getElementById(kQtyName).focus();alert("The Item Qty has been Updated.");return;}

var kNameName = HotItem+"NAME";
//alert("kNameName = "+kNameName);
var kNumName = HotItem+"NUM";
//alert("kNumName = "+kNumName);
var kPriceName = HotItem+"PRICE";
//alert("kPriceName = "+kPriceName);
var kItemID = "ID:"+HotItem;
//alert("kItemID = "+kItemID);

var kName = "NAME:"+document.getElementById(kNameName).value;
//alert("kName = "+kName);
var kNameShow=document.getElementById(kNameName).value;
//alert("kNameShow = "+kNameShow);
var kNum = "NUM:"+document.getElementById(kNumName).value;
//alert("kNum = "+kNum);
var kNumShow=document.getElementById(kNumName).value;
//alert("kNumShow = "+kNumShow);
var kPrice = "PRICE:"+document.getElementById(kPriceName).value;
//alert("kPrice = "+kPrice);
var kPriceShow=FmtCurrency(document.getElementById(kPriceName).value);
//alert("kPriceShow = "+kPriceShow);
var kExtended ="EXTENDED:"+ (document.getElementById(kQtyName).value * document.getElementById(kPriceName).value);
//alert("kExtended = "+kExtended);
var kExtendedShow= FmtCurrency((document.getElementById(kQtyName).value * document.getElementById(kPriceName).value));
//alert("kExtendedShow = "+kExtendedShow);

//alert(kNameName+"\n"+kNumName+"\n"+kPriceName+"\n"+kItemID+"\n"+kName+"\n"+kNum+"\n"+kPrice+"\n"+kExtended);
// drk 07/22/06
//	if (kQtyVal>36)
//		{kQtyVal="";document.getElementById(kQtyName).value=kQtyVal;
//			alert("Sorry, You can order only 36 or less of any Item.");document.getElementById(kQtyName).focus();return;}

	var kString =  kItemID+delim+kNum+delim+kName+delim+kQty+delim+kPrice+delim+kExtended 
//alert("kString = "+kString);

//	var xPrev = GetDCookie("btwCust;CartList");

//alert("xPrev = "+xPrev);

	if (xPrev=="" || xPrev==" " || xPrev==null)
		{SetDCookie("btwCust;CartList",kString);}
	else
		{SetDCookie("btwCust;CartList",xPrev+"^"+kString);}		 

document.getElementById(kQtyName).value="";
document.getElementById(kQtyName).focus();
alert("The following Item has been added to your Shopping Cart..."+"\n\n"+"Item:  "+kNameShow+" \n"+"Number:  "+kNumShow+"\n"+"Qty:  "+kQtyVal+"\n"+"Price:  "+kPriceShow+"\n\n"+"Item Total:  "+kExtendedShow+"\n\n"+"                               Thank You");		 
}

//  Remove an Item from the Shopping Cart Cookie Array
function CartRemove(tItemID){
var tLine=GetDCookie("btwCust;CartList");
DeleteDCookie("btwCust;CartList");
var tList=tLine.split("^");
var xItemID="";
var NewLen=tList.length-1;
var NewLine="";

//alert("CartRemove: tItemID = "+tItemID);
// Process each line item of the parent array 
for(i=0; i<=tList.length-1; i++) 
	{// break down each line item into it's various values: ID,Number,Name,Price,Qty,Extended
		tElement=tList[i];
		xItemID=tElement.substr(3,11);
		if (xItemID==tItemID)  // If the Item's ItemID is the one we're deleting, bypass it..
			{NewLine=NewLine}
		else
			{if (i==tList.length-1)
				{NewLine=NewLine+tElement;}
			else
				{NewLine=NewLine+tElement+"^";}}
	} // end of the first FOR loop

if (NewLine.substr(NewLine.length-1,1)=="^")
	{NewLine=NewLine.substr(0,NewLine.length-1);}
SetDCookie("btwCust;CartList",NewLine);
document.form1.submit();
}


//  Remove an Item from the Shopping Cart Cookie Array
function OrderRemove(tItemID){
var tLine=GetDCookie("btwCust;CartList");
DeleteDCookie("btwCust;CartList");
var tList=tLine.split("^");
var xItemID="";
var NewLen=tList.length-1;
var NewLine="";

//alert("OrderRemove: tItemID = "+tItemID);
// Process each line item of the parent array 
for(i=0; i<=tList.length-1; i++) 
	{// break down each line item into it's various values: ID,Number,Name,Price,Qty,Extended
		tElement=tList[i];
		xItemID=tElement.substr(3,11);
		if (xItemID==tItemID)  // If the Item's ItemID is the one we're deleting, bypass it..
			{NewLine=NewLine;}
		else
			{if (i==tList.length-1)
				{NewLine=NewLine+tElement;}
			else
				{NewLine=NewLine+tElement+"^";}}
	} // end of the first FOR loop
if (NewLine.substr(NewLine.length-1,1)=="^")
	{NewLine=NewLine.substr(0,NewLine.length-1);}
SetDCookie("btwCust;CartList",NewLine);
document.form1.submit();
}



//  Recalc the Extended and Total when a qty has been changed. We do this by deleting the Cookie,rebuilding it, and rewriting it.
function CartRecalc(HotItem){

//      alert(HotItem);
if (!HotItem=="ALL"){
		var hotQty=HotItem+"QTY";
		var QtyCheck=document.getElementById(hotQty).value;
//		alert("hotQty = "+hotQty+"\n"+"QtyCheck = "+QtyCheck);
			if (QtyCheck>36)
				{alert("Sorry, You can order only 36 or less of any Item.");document.getElementById(hotQty).focus();return;}
		}

var cList=GetDCookie("btwCust;CartList");
var cHit =cList.split("^");
DeleteDCookie("btwCust;CartList");
var zItem="";
var zName="";
var zNum="";
var zQty=0;
var zPrice=0;
var zExtended = 0;
var zTotal=0;
var CartTot=0;
var SubTot=0;
var dQ="";
var dE="";
var dP="";
var dE="";
var zeChk = 0;
var zE = "";
var delim ="|";
var kString = "";
var NewLine = "";
for(i=0; i<=cHit.length-1; i++) {
	kString = "";
	tElement = trim(cHit[i]);
	zItem = tElement.substr(tElement.indexOf("ID:")+3,tElement.indexOf("|NUM")-3);
	zNum=tElement.substring(tElement.indexOf("|NUM:")+5,tElement.indexOf("|NAME:"));
	zName=tElement.substring(tElement.indexOf("|NAME:")+6,tElement.indexOf("|QTY:"));
	zQty=tElement.substring(tElement.indexOf("|QTY:")+5,tElement.indexOf("|PRICE:"));
	zPrice=tElement.substring(tElement.indexOf("|PRICE:")+7,tElement.indexOf("|EXTENDED:"));
	zExtended=tElement.substr(tElement.indexOf("|EXTENDED:")+10,tElement.length-tElement.indexOf("|EXTENDED:"));
	zExtended=zExtended.replace("$","");
	dQ = zItem+"QTY";
	zQty = document.getElementById(dQ).value;
	zQty=zQty.replace("$","");
	dP=zItem+"PRICE";
	zPrice = document.getElementById(dP).value;
	zPrice = zPrice.replace("$","");
	SubTot = SubTot+(zQty*zPrice);
	CartTot = CartTot+(zQty*zPrice);
	// This is Cookie Array string being built.
	zExtended = FmtCurrency(zQty*zPrice);
	kString =  "ID:"+zItem+delim+"NUM:"+zNum+delim+"NAME:"+zName+delim+"QTY:"+zQty+delim+"PRICE:"+zPrice+delim+"EXTENDED:"+zExtended;
	NewLine=NewLine+kString+"^"
//	zExtended = FmtCurrency(zQty*zPrice);
	dE=zItem+"EXTENDED";
	document.getElementById(dE).value=(zExtended);
}
// Remove the delimiter character ^ from the end of the string.
if (NewLine.substr(NewLine.length-1,1)=="^")
	{NewLine=NewLine.substr(0,NewLine.length-1);}
// Create the new, updated cookie
//alert("NewLine Before the SetDCookie = "+NewLine);
//alert("Before the SetDCookie...");
SetDCookie("btwCust;CartList",NewLine);
//alert("After the SetDCookie...");
//alert("Before the xHandCharge...");
ChargeCalc();
var xHandCharge = document.getElementById("HandCharge").value;
//alert("HandCharge1 = "+xHandCharge);
xHandCharge = Number(xHandCharge.replace("$",""))
//alert("HandCharge2 = "+xHandCharge);
CartTot = CartTot+xHandCharge;
//alert("CartTot = "+Number(CartTot));
document.getElementById("SubTotal").value = FmtCurrency(SubTot);
document.getElementById("CartTotal").value = FmtCurrency(CartTot);
}
// End of ReCalc Shopping Cart funtion.

function ChargeCalc(){
var HandCharge = 0

//alert("HandCharge1 = "+HandCharge);

var From1 = document.getElementById("hFrom1").value;
var From2 = document.getElementById("hFrom2").value;
var From3 = document.getElementById("hFrom3").value;
var From4 = document.getElementById("hFrom4").value;
var From5 = document.getElementById("hFrom5").value;

var To1 = document.getElementById("hTo1").value;
var To2 = document.getElementById("hTo2").value;
var To3 = document.getElementById("hTo3").value;
var To4 = document.getElementById("hTo4").value;
var To5 = document.getElementById("hTo5").value;

var Charge1 = document.getElementById("hCharge1").value;
var Charge2 = document.getElementById("hCharge2").value;
var Charge3 = document.getElementById("hCharge3").value;
var Charge4 = document.getElementById("hCharge4").value;
var Charge5 = document.getElementById("hCharge5").value;
var SubTot = document.getElementById("SubTotal").value;
var CartTot = document.getElementById("CartTotal").value;

SubTot = Number(SubTot.replace("$",""))
CartTot = Number(CartTot.replace("$",""))

if (From5 > 0  &&  SubTot >= From5)
	{HandCharge=Charge5;}
else
if (From4 > 0)
	if (To4 > 0  &&  SubTot >= From4  &&  SubTot <= To4) 
		{HandCharge=Charge4;}
	else
		if (To4 == 0 && SubTot >= From4)  
	{HandCharge=Charge4;}
	
if (From3 > 0)
	if (To3 > 0  &&  SubTot >= From3  &&  SubTot <= To3) 
		{HandCharge=Charge3;}
	else
		if (To3 == 0 && SubTot >= From3)  
	{HandCharge=Charge3;}

if (From2 > 0)
	if (To2 > 0  &&  SubTot >= From2  &&  SubTot <= To2) 
		{HandCharge=Charge2;}
	else
		if (To2 == 0 && SubTot >= From2)  
	{HandCharge=Charge2;}

if (From1 > 0)
	if (To1 > 0  &&  SubTot >= From1  &&  SubTot <= To1) 
		{HandCharge=Charge1;}
	else
		if (To1 == 0 && SubTot >= From1)  
	{HandCharge=Charge1;}

else
	{HandCharge=HandCharge;}

//alert("My HandCharge = "+HandCharge);
HandCharge=Number(HandCharge);
CartTot = SubTot+HandCharge;
document.getElementById("HandCharge").value = FmtCurrency(HandCharge);
document.getElementById("CartTotal").value = FmtCurrency(CartTot);

}



function ClearCart(){
DeleteDCookie("btwCust;CartList");
SetDCookie("btwCust;CartList","");
}

function CookieShow(){
alert(unescape(document.cookie));
//window.location="../html/CookieViewer.asp";
}

function CartShow(){
//window.open('../html/CartShow1.asp','','scrollbars=0,status=0');
window.open('../html/CartShow1.asp','','toolbar=0,location=0,menubar=0,resizable=0,scrollbars=1,width=665,height=600,status=0,screenX=35,screenY=35,top=35,left=35');
/*	toolbar[=yes|no]|[=1|0]
   location[=yes|no]|[=1|0]
   directories[=yes|no]|[=1|0]
   status[=yes|no]|[=1|0]
   menubar[=yes|no]|[=1|0]
   scrollbars[=yes|no]|[=1|0]
   resizable[=yes|no]|[=1|0]
   width=pixels
   height=pixels*/
}
// CursorTrim forces the cursor to the End of the entered text. 
// used as:  onMouseUp="CursorTrim(this)"
function CursorTrim(txt){
	txt.value=trim(txt.value)+" ";
}

function CursorPos(el) {
	el.value=trim(el.value);
  if (el.createTextRange) {
    var v = el.value;
    var r = el.createTextRange();
    r.moveStart('character', v.length);
    r.select();
  }
}

function insertAtEnd (el, txt) {
  el.value += txt;
  CursorPos (el);
}

function Mid(str, start, len){
                if (start < 0 || len < 0) return "";

                var iEnd, iLen = String(str).length;
                if (start + len > iLen)
                        iEnd = iLen;
                else
                        iEnd = start + len;
                return String(str).substring(start,iEnd);}

function Len(str){  return String(str).length;  }

function InStr(strSearch, charSearchFor){
	for (i=0; i < Len(strSearch); i++)
	{
	    if (charSearchFor == Mid(strSearch, i, 1))
	    {
			return i;
	    }
	}
	return -1;}

function Right(str, n){
                if (n <= 0)     // Invalid bound, return blank string
                   return "";
                else if (n > String(str).length)   // Invalid bound, return
                   return str;                     // entire string
                else { // Valid bound, return appropriate substring
                   var iLen = String(str).length;
                   return String(str).substring(iLen, iLen - n);}}

function Left(str, n){
                if (n <= 0)     // Invalid bound, return blank string
                        return "";
                else if (n > String(str).length)   // Invalid bound, return
                        return str;                // entire string
                else // Valid bound, return appropriate substring
                        return String(str).substring(0,n);}

function ShowTimeoutWarning ()
{
window.alert( "YOUR TIME ON THIS PAGE IS ABOUT TO EXPIRE!.\n\nClick 'OK' to Save your work and continue working." );
SetCookie("GoOrStay","Stay");
document.forms[0].submit();
}

function onDateIntervalSelect2() {
document.all.BeginDate2.value = document.all.MyCalendar2.intervalstart
document.all.EndDate2.value = document.all.MyCalendar2.intervalfinish
}

function onDateSelect1() {
document.all.Date1.value = document.all.MyCalendar1.intervalstart
document.all.mydiv1.style.visibility = 'hidden'
}
function ShowCalendar1() {
  var e = window.event.srcElement
  document.all.mydiv1.style.left = e.offsetLeft + e.offsetWidth - document.all.mydiv1.offsetWidth + 21
  document.all.mydiv1.style.top = e.offsetTop + e.offsetHeight + 70
  document.all.mydiv1.style.visibility = 'visible'
  return false;
}

function onDateSelect2() {
document.all.Date2.value = document.all.MyCalendar2.intervalstart
document.all.mydiv2.style.visibility = 'hidden'
}
function ShowCalendar2() {
  var e = window.event.srcElement
  document.all.mydiv2.style.left = e.offsetLeft + e.offsetWidth - document.all.mydiv2.offsetWidth + 21
  document.all.mydiv2.style.top = e.offsetTop + e.offsetHeight + 70
  document.all.mydiv2.style.visibility = 'visible'
  return false;
}
   
function stopError() {
  return true;
}
window.onerror = stopError;

//window.onerror = ErrorHandler;
//function ErrorHandler(msg, url, lno) {alert(msg + " : " + lno);}


var expdate = new Date();
expdate.setTime (expdate.getTime() +  (24 * 60 * 60 * 1000 * 365)); 

//----------------------------------------------------------------------------------------
// Limit the size of a textarea.  Allows only the number of characters designated
// in the <input   tag.  Example:
// <textarea name=message wrap=physical cols=28 rows=4 onKeyDown="sizecheck(this.form.message,125);" onKeyUp="sizecheck(this.form.message125);"></textarea>
<!-- Begin
//---------------------------------------------------------------------
function caretpos(text){
var tval = text.value;
text.value = trim(tval);
}

function carettrim(text){
var tval = text.value;
text.value = trim(tval);
}

//---------------------------------------------------------------------
function PagePrint(){
text=document;
print(text);
}
//----------------------------------------------------------------------------------------
function notYet(){
alert("This Option Is Not Currently Available");
}
//----------------------------------------------------------------------------------------
function BTWInfo()
{
window.open('html/BTWInfo.asp','','scrollbars=0,width=602,height=790,resizable=0,status=0')
}
//----------------------------------------------------------------------------------------
function goReadError() {
var ThisReader = "../html/ReadErrors.asp";
window.open('../html/ReadErrors.asp','','scrollbars=no,width=559,height=473,resizable=no,status=yes');
//window.open('../html/ReadErrors.asp','','scrollbars=no,width=559,height=473,resizable=no,status=yes');
}
//----------------------------------------------------------------------------------------
function goReadErrorHist() {
var ThisReader = "../html/ReadHistErrors.asp";
window.open('../html/ReadHistErrors.asp','','scrollbars=no,width=559,height=473,resizable=no,status=yes');
}
//----------------------------------------------------------------------------------------


function amcascheck(field,minlimit){
var xVal = field.value;
var xLength = field.value.length;
if (xLength == 0)
{return true;}
else
{
if (xLength < minlimit)
	{
		if (xVal == "123" || xVal == "524" || xVal == "905" || xVal == "405")
      	 {return true;}
		 else
		 	{field.value=xVal;
		    field.focus();	
			return false;}
 	}
else
	{return true;}
}
}
function sizecheck(field,maxlimit,minlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
}

//alert("You have reached the maximum number of letters/words allowed for this input box.\n\nPlease consolidate your answer.\n\nThe maximum number allowed is"+maxlimit+" characters");
// otherwise, update 'characters left' counter
// End -->
//----------------------------------------------------------------------------------------
// This version can use a text box to show the remaining available characters.  It uses a slightly different 
//  < textarea call:
// <textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
// Here's the display text box showing remaing available characters. Place in convenient location on page.
// <input readonly type=text name=remLen size=3 maxlength=3 value="125"> 
//----------------------------------------------------------------------------------------
<!-- Begin
/*
Displays the Date in 05/01/2004 format
*/
function DateSay(){
var myDate = new Date();
var Tday = myDate.getMonth()+1 + "/" + myDate.getDay()+1 + "/" + myDate.getYear()
return Tday
}
// End -->
//----------------------------------------------------------------------------------------
// Force password to be min of 6 characters and let the user hit the Enter key to submit
<!-- Begin
function keycheck(field,e){
var kcode = e.keyCode;
var minlimit = 3;
var myblank = ""
if (kcode == 13 || kcode == 9)
	{
			if (field.value.length < minlimit)
				{
				alert("Please use a Minimum of 3 characters for your Password"+"\n\n"+"Hitting the ESC key will Clear the field"+"\n\n"+"You can Mouse-Click to go to the User ID field");
				field.focus();
				return false;
				}
			else
				{SetDCookie("btw;UserName",trim(document.getElementById("mUserID").value));
				LoginProc();
				return true;
//  The following would simply move focus to the next field.....not used in  Login page.
//  document.forms[0].elements[1].focus();
				}
	}
else
	{
	if (kcode == 27) // escape key pressed
	   {
		field.value = "";
		return true;
		}
	}
}
//alert("You have reached the maximum number of letters/words allowed for this input box.\n\nPlease consolidate your answer.\n\nThe maximum number allowed is"+maxlimit+" characters");
// otherwise, update 'characters left' counter
// End -->
//----------------------------------------------------------------------------------------
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}
// End -->
<!-- Begin
//function textCounter(field, countfield, maxlimit) {
//alert(field);
//if (field.value.length > maxlimit) // if too long...trim it! and tell the user.
//field.value = field.value.substring(0, maxlimit);
//alert("You have reached the maximum number of letters/words allowed for this input box.\n\nPlease consolidate your answer.\n\nThe maximum number allowed is"+maxlimit+" characters");
// otherwise, update 'characters left' counter
//else 
//countfield.value = maxlimit - field.value.length;
//}
//----------------------------------------------------------------------------------------
<!-- Begin
function mask(fld,fmt){
var str = fld.value
var textbox = fld
if (fmt == "ssno")
{
var loc = '3,6'
var delim = '-'
var maxlen = 11
}
if (fmt =="phone")
{
var loc = '3,7'
var delim = '-'
var maxlen = 12
}
if (fmt == "date")
{
var loc = '2,5'
var delim = '/'
var maxlen = 10
}
//this.value,this,'3,6','-'
var input = fld
var locs = loc.split(',');
for (var i = 0; i <= locs.length; i++){
	for (var k = 0; k <= str.length; k++){
	 if (k == locs[i]){
	  if (str.substring(k, k+1) != delim){
	    str = str.substring(0,k) + delim + str.substring(k,str.length);
	  }
	 }
	}
	}
str = str.substring(0,maxlen);
textbox.value = str;
//if (input.value.length >= maxlen) 
}
// End -->
//----------------------------------------------------------------------------------------

// End -->
//----------------------------------------------------------------------------------------
<!-- Begin
function ssnofmt(fld){
//this.value,this,'3,6','-'
var str = fld.value
var textbox = fld
var loc = '3,6'
var delim = '-'
var maxlen = 11
var locs = loc.split(',');
for (var i = 0; i <= locs.length; i++){
	for (var k = 0; k <= str.length; k++){
	 if (k == locs[i]){
	  if (str.substring(k, k+1) != delim){
	    str = str.substring(0,k) + delim + str.substring(k,str.length)
	  }
	 }
	}
 }
str = str.substring(0,maxlen);
textbox.value = str
}
// End -->
//----------------------------------------------------------------------------------------
<!-- Begin
// End -->

//----------------------------------------------------------------------------------------
// Example:  <INPUT name="amcasid" type="text"  onKeyPress="javascript:return dFilter(event, this, '########');" onKeyUp="return autoTab(this, 8, event);">
//--Begin AutoTab
function autoTab(input,len,e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
// AutoTab Related Function.......................................................
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
// AutoTab Related Function.......................................................
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
//----------------------------------------------------------------------------------------
// Begin SetFocus
function SetFocus(fInst, eInst) {
fInst=fInst-1;
eInst=eInst-1;
  if (document.forms.length > 0) 
  {
   document.forms[fInst].elements[eInst].focus();
  }
 }
//----------------------------------------------------------------------------------------

function SetCookie(name, value, expires, path, domain, secure) {
var now = new Date();
now.setTime(now.getTime() + 31536000000);
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + now.toGMTString() : "") +
      ((path) ? "; path=/;" : "") +
      ((domain) ? "; domain="+domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function GetCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function DeleteCookie(name, path, domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=/" : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function FixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

//...............................................................................................................
function CookieSetup(){
var sID = document.getElementById("Session").value;
var CurID = GetDCookie("user;id");
if (CurID=="" || CurID==null || CurID=="undefined")
	/*If it's a blank user id, force-clean the "user" cookie and assign the Session Id to the user id.*/
	{DeleteCookie("user;");
	  SetDCookie("user;id",sID);}
}

var expdate = new Date();
    expdate.setTime (expdate.getTime() +  (24 * 60 * 60 * 1000 * 365)); 
//----------------------------------------------------------------------------------------
/* Cookie Dictionary Array Handler */
        function GetDCookie(name) {
          var cookies = document.cookie;            // cookies for site
          var ix1;                                  // loop index
          var n1 = name;                            // main cookie name
          var n2;                                   // crumb name
          var out;                                  // returned value
          ix1 = n1.indexOf(";");                    // cookie/crumb break
          if (ix1 != -1) {
            n2 = n1.substring(ix1 + 1);             // crumb name
            n1 = n1.substring(0, ix1);              // main cookie name
          }
          out = GetDCookieCrumb(cookies, n1);
          if (n2 && out) { out = GetDCookieCrumb(out, n2); }
          cookie = rest;
          return out;
        }

        function SetDCookie(name, value) {
		/*modified 10/01/05 drk to handle just name and value being passed...defaults to one day expire...added path*/
		/*Example:   SetDCookie("CookieName;SlotName","Value")       SetDCookie("btw;UserName","Darth Vader")  */
		  var expr = "";
		  var dayz = "";
		  var cookies = document.cookie;            // cookies for site
          var ix1;                                  // index
          var n1 = name;                            // main cookie name
          var n2 = "";                              // crumb name
          var out;                                  // returned value
          var p2 = value;                           // new value
          var p3;                         // param work area
          var p4;
          var msd = 1000 * 60 * 60 * 24 * 365;            // millisecs per day
          var path = "/";                              // path
          if (!p3) {                                // no expiration
            if (!p4) { p4 = 1; }                    // no days: use 1
            p3 = new Date();
            p3.setTime(p3.getTime() + msd * p4);
          }
          ix1 = n1.indexOf(";");                    // cookie/crumb break
          if (ix1 != -1) {
            n2 = n1.substring(ix1 + 1);             // crumb name
            n1 = n1.substring(0, ix1);              // main cookie name
          }
          out = GetDCookieCrumb(cookies, n1);
          if (n2) {
            if (out) { out = GetDCookieCrumb(out, n2); }
            else { rest = ""; }
            if (rest) { p2 = rest + ";" + n2 + "=" + p2; }
            else      { p2 =              n2 + "=" + p2; }
          }
          document.cookie=n1+"="+escape(p2)+"; expires="+p3.toGMTString()+";path=/";
          return true;
        }

        function GetDCookieCrumb(instring, seeking) {
          var c1;                                   // cookies work area
          var c2;                                   // cookie work area
          var c3;                                   // cookie name
          var c4;                                   // cookie value
          var ix1; var ix2; var ix3; var ix4;       // indexes
          var out;                                  // return value
          rest = "";          
          c1 = instring;
          c1 = c1.replace(/\n/g, "");               // drop nl chars
          c1 = c1.replace(/\r/g, "");               // drop cr chars
          c1 = c1 + ";";                            // for final cookie
          ix1 = 0;                                  // from beginning
          if (seeking.substring(0, 1) == "#") {
            if (seeking == "#0" && !instring) { return 0; }
            ix4 = seeking.substring(1);             // which item wanten
            ix3 = 0;                                // none so far
            while (c1.indexOf(";", ix1) != -1) {
              ix2 = c1.indexOf(";", ix1);
              cookie = c1.substring(ix1, ix2);
              ix3 += 1;
              if (ix3 == ix4) { return cookie; }
              ix1 = ix2 + 1;
            }
            if (ix4 == 0) { return ix3; }           // count of items
            return "";
          }
          while (c1.indexOf(";", ix1) != -1) {
            ix2 = c1.indexOf(";", ix1);             // next cookie break
            if (ix2 == -1) { ix2 = c1.length; }
            cookie = c1.substring(ix1, ix2);        // a single cookie
            c2 = cookie;                            // cookie work area
            ix1 = ix2 + 1;
            ix3 = c2.indexOf("=", 0);               // name=value break
            if (ix3 == -1) { ix3 = c2.length; }
            c3 = c2.substring(0, ix3);              // get the name
            c4 = c2.substring(ix3 + 1);             // get the value
            c3 = c3.replace(/ /g, "");              // drop all space
            if (c3 == seeking) {
              out = unescape(c4);
            } else {
              if (rest) { rest = rest + ";" + cookie; }
              else      { rest = cookie; }
            }
          }
          return out;
        }

function DeleteDCookie(ThisCookie){
//alert("Cookie To Delete = "+ThisCookie);
SetDCookie(ThisCookie,"");
}
/*var tCookie = GetDCookie(ThisCookie);
alert(tCookie);
var tSplit = tCookie.split
tCookie=document.cookie
var tRootPos = tCookie.indexOf(ThisCookie,2);
var tRoot=tCookie.substring(0,tRootPos);
alert(tRoot);
*/
/*
        function DeleteDCookie(name) {
          var cookies = document.cookie;    // cookies for site
          var ix1;                                     // loop index
          var n1 = name;                          // main cookie name
          var n2;                                     // crumb name
          var out;                                    // returned value
          ix1 = n1.indexOf(";");                // cookie/crumb break
          if (ix1 != -1) {
            n2 = n1.substring(ix1 + 1);       // crumb name
            n1 = n1.substring(0, ix1);         // main cookie name
          }
          out = GetDCookieCrumb(cookies, n1);
          if (n2 && out) { out = GetDCookieCrumb(out, n2); }
          cookie = rest;
          return out;
        }
*/
// End of Cookie Dictionary Array handler -----------------------------------------------

//----------------------------------------------------------------------------------------
// [dFilter] - A Numerical Input Mask for JavaScript
// Written By Dwayne Forehand - March 27th, 2003
// Please reuse & redistribute while keeping this notice.
//----------------------------------------------------------------------------------
// Modified By David R. Katz - October 20, 2003
// to be Netscape aware and allow 2 'types' of input: only numeric, or both alpha and numeric.
// Using the '#' for the Mask results in a Numeric-Only formatted string.
// Using the 'X' for the Mask results in an Upper,Lower,Numeric formatted string.
// Replaced the onKeyDown with onKeyPress because onKeyDown causes 
// numeric keypad problems in IE  and  wierd alpha characters in Netscape.
//----------------------------------------------------------------------------------
// Example 1: Allows Combined Alpha and Numeric input
// <input type="text" name="text1" onKeyPress="javascript:return dFilter(event, this, 'XXXXX-XXXX');" >
// Example 2: Allows only Numeric input
// <input type="text" name="text1" onKeyPress="javascript:return dFilter(event, this, '###-##-####');" >
//----------------------------------------------------------------------------------
//==================================================================================
// Function dFilter - a field format function
// var isNN = (navigator.appName.indexOf("Netscape")!=-1);
var dFilterSymbol;
var dLowVal;
var dHighVal;
var dFilterStep;
//----------------------------------------------------------------------------------
function dFilterStrip (dFilterTemp, dFilterMask)
{
   dFilterMask = replace(dFilterMask,dFilterSymbol,'');
   for (dFilterStep = 0; dFilterStep < dFilterMask.length++; dFilterStep++)
         {
             dFilterTemp = replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');
         }
         return dFilterTemp;
}
//----------------------------------------------------------------------------------
function dFilterMax (dFilterMask)
{
          dFilterTemp = dFilterMask;
   for (dFilterStep = 0; dFilterStep < (dFilterMask.length+1); dFilterStep++)
         {
                    if (dFilterMask.charAt(dFilterStep)!=dFilterSymbol)
                   {
                 dFilterTemp = replace(dFilterTemp,dFilterMask.charAt(dFilterStep),'');
                   }
         }
         return dFilterTemp.length;
}
//----------------------------------------------------------------------------------
// Main Program Code Function
function dFilter (key, textbox, dFilterMask)
{
//alert("Text Box Value = "+textbox.value);

         var keycode = (isNN) ? key.which : key.keyCode; 
         var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
         var isSick = containsElement(filter,keycode);
         
				 dFilterSymbol = dFilterMask.substring(0,1);

if (dFilterSymbol=='#')  // if they want only numeric input they pass the '#'
{
dLowVal = 47;
dHighVal = 58;
}
else   //  They want both Numeric and Alpha input if they pass the 'X'
{
dLowVal = 47;
dHighVal = 123;
}
//alert("KeyCode = "+keycode+"\n"+"dLowVal = "+dLowVal+"\n"+"dHighVal = "+dHighVal);
//alert("isSick = "+isSick);

         dFilterNum = dFilterStrip(textbox.value, dFilterMask);

         if (isSick)
         {
             return true;
         }
         else if (keycode==8&&dFilterNum.length!=0)
         {
                     dFilterNum = dFilterNum.substring(0,dFilterNum.length-1);
         }
       else if ( (keycode>dLowVal&&keycode<dHighVal) && dFilterNum.length<dFilterMax(dFilterMask) )
         {
       dFilterNum=dFilterNum+String.fromCharCode(keycode);
         }
         var dFilterFinal='';
   for (dFilterStep = 0; dFilterStep < dFilterMask.length; dFilterStep++)
         {
       if (dFilterMask.charAt(dFilterStep)==dFilterSymbol)
                   {
                        if (dFilterNum.length!=0)
												  {
                           dFilterFinal = dFilterFinal + dFilterNum.substring(0,1);
                           dFilterNum = dFilterNum.substring(1,dFilterNum.length);
                          }
                       else
                       {
                           dFilterFinal = dFilterFinal + "";
                       }
                   }
         else if (dFilterMask.charAt(dFilterStep)!=dFilterSymbol)
                   {
                       dFilterFinal = dFilterFinal + dFilterMask.charAt(dFilterStep);                
                   }
         }
         textbox.value = dFilterFinal;
   return false;
}
//----------------------------------------------------------------------------------
function replace(fullString,text,by) {
// Replaces text with by in string
   var strLength = fullString.length, txtLength = text.length;
   if ((strLength == 0) || (txtLength == 0)) return fullString;
   var i = fullString.indexOf(text);
   if ((!i) && (text != fullString.substring(0,txtLength))) return fullString;
   if (i == -1) return fullString;
   var newstr = fullString.substring(0,i) + by;
   if (i+txtLength < strLength)
       newstr += replace(fullString.substring(i+txtLength,strLength),text,by);
   return newstr;
}
//----------------------------------------------------------------------------------
//-- Function to deal with IE/Netscape keycode differences
/* function containsElement(arr, ele) 
{
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
*/
//--End Netscape discovery handler
//----------------------------------------------------------------------------------------
// Begin InstructionWinddow
function instwin()
{
window.open('../html/GeneralInstructions.asp','','scrollbars=yes,width=608,height=829,resizable=no,status=no')
}

function instwin1()
{
window.open('html/GeneralInstructions.asp','','scrollbars=yes,width=608,height=800,resizable=no,status=no')
}

function InstructPrint() {
window.open('../html/InstPrint.asp','','scrollbars=yes,width=608,height=810,resizable=no,status=no')
}

function AppProcess() {
window.open('../html/AppProcess.asp','','scrollbars=yes,width=608,height=800,resizable=no,status=no')
}
function AppProcess1() {
window.open('html/AppProcess.asp','','scrollbars=yes,width=608,height=800,resizable=no,status=no')
}

//function InstructPrint() {
//var ThisRpt = "../html/InstPrint.asp";
//biggerhelpwin(ThisRpt) ;
//}

// Begin HelpWin
function alertwin(ThisAlert)
{
alert("We Made It To The AlertWin Proc....."+ThisAlert);
var ThisCookie="AlertMsg";
SetCookie("AlertMsg",ThisAlert);
var AlertPage = "../html/AlertMesssage.asp";
winpops=window.open(AlertPage,"","width=700,height=325,help=no")
}
//----------------------------------------------------------------------------------------
// Begin HelpWin
function cchelpwin(ThisHelp)
{
//alert("We Made It To The HelpWin Proc---"+ThisHelp);
SetCookie("HelpMsg" ,ThisHelp);
var HelpPage = "../ccard/ccHelp1.asp";
winpops=window.open(HelpPage,'','scrollbars=no,width=545,height=330,resizable=no,status=no,help=no');
}

function helpwin(ThisHelp)
{
//alert("We Made It To The HelpWin Proc---"+ThisHelp);
SetCookie("HelpMsg" ,ThisHelp);
var HelpPage = "../html/BTWHelp.asp";
winpops=window.open(HelpPage,'','scrollbars=no,width=480,height=600,resizable=no,status=no,help=no');
}
//----------------------------------------------------------------------------------------
function biggerhelpwin(ThisHelp)
{
//alert("We Made It To The HelpWin Proc---"+ThisHelp);
SetCookie("HelpMsg",ThisHelp);
var HelpPage = "../html/BTWShow.asp";
winpops=window.open(HelpPage,'','scrollbars=yes,width=820,height=810,resizable=yes,status=yes,help=no');
}
//----------------------------------------------------------------------------------------
// End Instruction Page
//----------------------------------------------------------------------------------------
//function InstructionWindow(ThisInst)
//{
//winpops=window.open(ThisInst,"","width=600")
//}
// End Instruction Page
//----------------------------------------------------------------------------------------
// Begin Trim Function
//function Trim(s) {
 //s.replace(/^[ ]*(.*?)[ ]*$/,"$1");
// return s
//}
// End Trim Function 
//----------------------------------------------------------------------------------------
// Begin Trim Function
function FTRIM(tbox) {
  var _sval = tbox.value;
  tbox.value = _sval.replace(/^[ ]*(.*?)[ ]*$/,"$1");
	tbox.focus();
  return 
}
// End Trim Function 
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
// Begin Trim Function
//function ALLTRIM(x) {
// x.replace(/^[ ]*(.*?)[ ]*$/ ,"");
//var yx
//yx = x.replace(/^\s*(.*)\s*$/\1/,"");
 //return yx
//}
// End Trim Function 
//----------------------------------------------------------------------------------------
// Begin MsgPopUp Function
<!-- Begin
//  End -->
// End MsgPopUp Function 
//----------------------------------------------------------------------------------------
// Begin Trim Function
function ltrim(argvalue) {
  while (1) {
    if (argvalue.substring(0, 1) != " ")
      break;
    argvalue = argvalue.substring(1, argvalue.length);
  }
  return argvalue;
}
//  End lTrim Function-->
//----------------------------------------------------------------------------------------
// Begin rTrim Function
function rtrim(argvalue) {
  while (1) {
    if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
      break;
    argvalue = argvalue.substring(0, argvalue.length - 1);
  }
  return argvalue;
}
//  End rTrim Function-->
//----------------------------------------------------------------------------------------
// Begin Trim Function
function trim(argvalue) {
  var tmpstr = ltrim(argvalue);
  return rtrim(tmpstr);
}
//  End Trim Function-->
//----------------------------------------------------------------------------------------
<!-- Begin the Email Function
//function EmailCheck (emailStr) {
function emailcheck (fieldname) {
if (trim(fieldname.value)=="")
	{return true;}
var fldname = fieldname;
var emailStr = fieldname.value;
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
alert("Email address seems incorrect (check @ and .'s)");
fldname.focus();
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
fldname.focus();
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
fldname.focus();
return false;
   }
}
if (user.match(userPat)==null) {
// user is not valid
alert("The username doesn't seem to be valid.");
fldname.focus();
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
fldname.focus();
return false;
   }
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
return true;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
fldname.focus();
return false;
}
if (len<2) {
alert("This address is missing a hostname!");
fldname.focus();
return false;
}
return true;
}
//  End of EmailCheck-->
//.........................................................................................................................
// Date and Time Functions
<!-- Copyright 2002 Bontrager Connection, LLC

function getCalendarDate()
{
   var months = new Array(13);
   months[0]  = "January";
   months[1]  = "February";
   months[2]  = "March";
   months[3]  = "April";
   months[4]  = "May";
   months[5]  = "June";
   months[6]  = "July";
   months[7]  = "August";
   months[8]  = "September";
   months[9]  = "October";
   months[10] = "November";
   months[11] = "December";
   var now         = new Date();
   var monthnumber = now.getMonth();
   var monthname   = months[monthnumber];
   var monthday    = now.getDate();
   var year        = now.getYear();
   if(year < 2000) { year = year + 1900; }
   var dateString = monthname + 
                    ' ' + 
                    monthday + 
                    ', ' + 
                    year;
   return dateString;
} // function getCalendarDate()

function getClockTime()
{
   var now    = new Date();
   var hour   = now.getHours();
   var minute = now.getMinutes();
   var second = now.getSeconds();
   var ap = "AM";
   if (hour   > 11) { ap = "PM";             }
   if (hour   > 12) { hour = hour - 12;      }
   if (hour   == 0) { hour = 12;             }
   if (hour   < 10) { hour   = "0" + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour + 
                    ':' + 
                    minute + 
                    ':' + 
                    second + 
                    " " + 
                    ap;
   return timeString;
} // function getClockTime()

//-->
//...........................................................................................

/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function BTWNewsScroller(){
//specify path to your external page:
var iframesrc="BTWNews.asp"
//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="620px" height="200px" marginwidth="1" marginheight="1" hspace="1" vspace="0" frameborder="0" scrolling="no"></iframe>')
}

function DeadlineMessage(){
//specify path to your external page:
var iframesrc="html/DeadlineMessage.html"
//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="bulletinmsg" src="'+iframesrc+'" width="622px" height="110px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>')
}

var mnAutoSaveMilliSeconds=0;
  var mnAutoSaveMilliSecondsExp=0;
  var mnAutoSaveInterval=30000;

  function AutoSaveInit(nMilliSeconds)
  {
     try
     {
       var nMinutes=0;
       AutoSaveClearTimeOuts();
       nMinutes = ((nMilliSeconds / 1000) / 60); 
       mnAutoSaveMilliSeconds = nMilliSeconds; 
       mnAutoSaveMilliSecondsExp=0;
       oTimeOut = window.setTimeout("AutoSaveSubmit()",nMilliSeconds);
       oInterval = window.setInterval("AutoSaveCountDown()",mnAutoSaveInterval);
       document.getElementById("divAutoSave").innerHTML = "<b>Auto Save In " + nMinutes + " Minutes</b>";
      }
      catch (exception) 
      { 
        if (exception.description == null) { alert("AutoSaveInit Error: " + exception.message); }  
        else {  alert("AutoSaveInit Error: " + exception.description); }
      }
  }

  function AutoSaveCountDown()
  {
    var nMinutesLeft=0;
    var nMilliSecondsLeft=0;
    mnAutoSaveMilliSecondsExp =  mnAutoSaveMilliSecondsExp + mnAutoSaveInterval;
    if ( mnAutoSaveMilliSeconds > mnAutoSaveMilliSecondsExp)
    {
      nMilliSecondsLeft = mnAutoSaveMilliSeconds - mnAutoSaveMilliSecondsExp;
      nMinutes= AutoSaveRoundNumber(((nMilliSecondsLeft / 1000) / 60),2); 
      document.getElementById("divAutoSave").innerHTML = "<b>Auto Save In " + nMinutes + " Minutes</b>";
    }
  }

  function AutoSaveBeforeSubmit()
  {
     document.getElementById("divAutoSave").innerHTML = '<b>Saving data...Please wait.</b>';
     return true;
  }

  function AutoSaveClearTimeOuts()
  {
    try
    {
      window.clearInterval(oInterval);
      window.clearTimeout(oTimeOut);
    }
    catch (exception) { }
  }

  function AutoSaveSubmit()
  {
    try
    {
      AutoSaveClearTimeOuts();
      AutoSaveBeforeSubmit();
      /*
         Call the form submittal code in your main page.
      */
      SubmitFormToBeSaved();
    
     }
    catch (exception) {}
  }

   function AutoSaveRoundNumber(number,X)
  {
    var number2;
    var TmpNum;
     X=(!X ? 1:X);
     number2 = Math.round(number*Math.pow(10,X))/Math.pow(10,X);
     TmpNum = "" + number2;
     var TmpArray = TmpNum.split(".");
     if (TmpArray.length <2) { number2 = number2 + ".0"; }
     return number2;
  }

function browserversion()
{
txt="Your Browser is unknown"
browser=navigator.appVersion
if (browser.indexOf("FireFox")>-1)
{
txt="Mozilla FireFox"
}

if (browser.indexOf("2.")>-1)
{
txt="Your Browser is from the stone-age"
}
if (navigator.appVersion.indexOf("Firefox")>-1)
{
txt="Mozilla FireFox"
}
if (browser.indexOf("3.")>-1)
{
txt=navigator.appName+" Version 3+" 
}
if (browser.indexOf("4.")>-1)
{
txt=navigator.appName+" Version 4+" 
}
if (browser.indexOf("5.")>-1)
{
txt=navigator.appName+" Version 5+" 
}
if (browser.indexOf("6.")>-1)
{
txt=navigator.appName+" Version 6+" 
}
if (browser.indexOf("7.")>-1)
{
txt=navigator.appName+" Version 7+" 
}
if (browser.indexOf("8.")>-1)
{
txt=navigator.appName+" Version 8+" 
}
if (navigator.userAgent.indexOf("Firefox")!=-1)
{
var verstr = (navigator.userAgent);
var ver = verstr.substr(verstr.length-5,5);
txt="FireFox"+" Version "+ver;
}
if (navigator.userAgent.indexOf("MSIE")!=-1)
{
var verstr = (navigator.userAgent);
var verpos = verstr.indexOf("MSIE");
var verhit = verstr.substr(verpos,8);
txt="Internet Explorer"+" Version "+verhit;
//txt=verstr;
}

//var txt=navigator.appVersion
return txt
}


//.....Begin Menu Tracking Cookie Code..................................................................................................................................................
//  Function goNext(x) is called from any page...x is the page we want to go to.  The various procs create and maintain
// a cookie array of all pages navigated to with the goNext() function. The page Return button onClick calls the prevPage
// function and passes the number of pages to move back to. The prevPage proc defaults to one page if nothing is passed.
// the prevPage function removes the specified number of entries from the array, keeping it current.
// New Cookie Array procs to handle xlevel menu system. added 04/17/05
var timeToKeep = 31536000000; // one year
var expires = new Date();
expires.setTime(expires.getTime() + timeToKeep);
var dbug = 0; function d_a(ary) {var beg = next_entry(ary) - 1; for (var i = beg ; i > -1; i--) {ary[i] = null;}} function init_array() {if (dbug) alert('init_cookie');  var ary = new Array(null); return ary;} function set_cookie(name,value,expires) {if (dbug) alert('set_cookie'); if (!expires) expires = new Date();
document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString() + '; path=/';} function get_cookie(name) {if (dbug) alert('get_cookie'); var dcookie = document.cookie; var cname = name + "="; var clen = dcookie.length; var cbegin = 0; while (cbegin < clen) {var vbegin = cbegin + cname.length;
if (dcookie.substring(cbegin, vbegin) == cname) {var vend = dcookie.indexOf (";", vbegin); if (vend == -1) vend = clen; return unescape(dcookie.substring(vbegin, vend));} cbegin = dcookie.indexOf(" ", cbegin) + 1; if (cbegin == 0) break;} return null;} function del_cookie(name) {if (dbug) alert('del_cookie');
document.cookie = name + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';} function get_array(name, ary) {if (dbug) alert('get_array'); d_a(ary); var ent = get_cookie(name); if (ent) {i = 1; while (ent.indexOf('^') != '-1') {ary[i] = ent.substring(0,ent.indexOf('^')); i++;
ent = ent.substring(ent.indexOf('^')+1, ent.length);}}} function set_array(name, ary, expires) {if (dbug) alert('set_array'); var value = ''; for (var i = 1; ary[i]; i++) {value += ary[i] + '^';} set_cookie(name, value, expires);} function del_entry(name, ary, pos, expires) {if (dbug) alert('del_entry');
var value = ''; get_array(name, ary); for (var i = 1; i < pos; i++) {value += ary[i] + '^';} for (var j = pos + 1; ary[j]; j++) {value += ary[j] + '^';} set_cookie(name, value, expires);} function next_entry(ary) {if (dbug) alert('next_entry'); var j = 0; for (var i = 1; ary[i]; i++) {j = i} return j + 1;}
function debug_on() {dbug = 1;} function debug_off() {dbug = 0;} function dump_cookies() {if (document.cookie == '') document.write('No Cookies Found'); else {thisCookie = document.cookie.split('; '); for (i=0; i<thisCookie.length; i++) {document.write(thisCookie[i] + '<br \/>');}}}


function goNext(newPage) {
//alert("Hit the goNext Function....OK");
var cookieName = 'myMenu'; // if it isn't already defined
var myarray = init_array(); // if it isn't already defined
get_array(cookieName, myarray);
var num_num = next_entry(myarray);  // get the next available, blank array slot.
myarray[num_num] = location.pathname; // add the current page to the end of the cookie array.
//myarray[num_num] = window.location; // add the current page to the end of the cookie array.
set_array(cookieName, myarray, expires); // write the array to the cookie, replacing previous version.
var cookieName = 'myMenu'; // if it isn't already defined
var myarray = init_array(); // if it isn't already defined
get_array(cookieName, myarray);
//alert(location.pathname);
window.location = newPage; // go to the requested next page.
//document.write(myarray[1],myarray[2]);
}

function prevPage(xBackTrack) 
{
//var zBackTrack = xBackTrack
if (typeof xBackTrack == "undefined")
//if (!xBackTrack > 0 || xBackTrack == null || xBackTrack == "" || xBackTrack == "undefined") 
//alert("xBackTrack = "+xBackTrack);
   {xBackTrack = 1;}
var cookieName = 'myMenu'; // if it isn't already defined
var myarray = init_array(); // if it isn't already defined
get_array(cookieName, myarray);
var size = next_entry(myarray)-1; // -1 because the function returns the next AVAILABLE array slot...not the current last array slot.
if (xBackTrack == 1)
   {del_entry(cookieName, myarray, size, expires);} // trim off the last array entry (the last stored page)
else   
   {
      for (var i = 1; i <= xBackTrack; i++) // trim off the last 'x' number of array entries, as specified in the xBackTrack variable.
         {del_entry(cookieName, myarray, size, expires);
    		 size = size-1;}
             size = size + 1; // make up for the overshoot.
   }
var hitPage = myarray[size];  // capture the last page listed in the array...that's our new 'go to' page.
//alert("hitPage = "+hitPage);
if (hitPage == null)
   {window.location = "../index.asp";}
   else
    {window.location = hitPage;}
}

/*function to adjust the size of the menu to accomodate out-of-sequence page navigation.
   Usually called from within another function*/
function menuAdjust(xCullQty){
if (!xCullQty > 0)
   {xCullQty = 1;}
var cookieName = 'myMenu'; // if it isn't already defined
var myarray = init_array(); // if it isn't already defined
get_array(cookieName, myarray);
var size = next_entry(myarray)-1; // -1 because the function returns the next AVAILABLE array slot...not the current last array slot.
if (xCullQty == 1)
   {del_entry(cookieName, myarray, size, expires);} // trim off the last array entry (the last stored page)
else   
   {
      for (var i = 1; i <= xCullQty; i++) // trim off the last 'x' number of array entries, as specified in the xBackTrack variable.
         {del_entry(cookieName, myarray, size, expires);
    		 size = size-1;}
             size = size + 1; // make up for the overshoot.
   }
var hitPage = myarray[size];  // capture the last page listed in the array...that's our new 'go to' page.
//alert(hitPage);
}

function clearMenu(){
var cookieName = 'myMenu'; // if it isn't already defined
var myarray = init_array(); // if it isn't already defined
var xCullQty=myarray.length;
if (!xCullQty > 0)
   {xCullQty = 1;}
get_array(cookieName, myarray);
var size = next_entry(myarray)-1; // -1 because the function returns the next AVAILABLE array slot...not the current last array slot.
//      for (var i = 1; i <= xCullQty; i++) // trim off the last 'x' number of array entries, as specified in the xBackTrack variable.
      for (var i = 0; i <= size; i++) // trim off the last 'x' number of array entries, as specified in the xBackTrack variable.
         {del_entry(cookieName, myarray, size, expires);
    		 size = size-1;}
//             size = size + 1; // make up for the overshoot.
}

function BTWSetup(){
clearMenu();
//DeleteCookie("myname");
DeleteCookie("btw");
SetDCookie("btw;UserName","Customer");
}

//}
//....End of Menu Tracking Cookie Code...................................
//------------------------------------------------------------------
//.....Begin Credit Card Validation Code...................................
<!--
/*
There are three functions in this set for credit card validation.
The main function is:
validateCard(cardNumber,cardType,cardMonth,cardYear)
	parameters:
		all paramaters are string values.
		Month & Year come from the select input fields in the form, so they are defined.
		cardType can be:
			'a' for American Express
			'd' for Discover
			'm' for MasterCard
			'v' for Visa
	description:
		this function will check string length, valid characters, specific credit card prefixes and test
		the Mod 10 (LUHN Formula) for validating possible credit card numbers. this function can only
		authorize that the given card data is potentially valid. You would still need to run actual
		card validation routines to verify the actual account.
	returns:
		this function returns true if the card number could be valid for the card type and expiration date.
		false otherwise.	
supporting functions:
mod10( cardNumber )
	parameters:
		this function takes the text string card number and runs the Mod 10 formula on its respective digits.
	description:
		Mod 10 is the check digit formula for the supported cards these functions attempt to validate.
	returns:
		this function returns true if the number passes the check digit test.
		false otherwise.
expired( cardMonth, cardYear )
	parameters:
		this function takes the text string values given by the html form.
	description:
		this function basically will check to make sure todays date is less than the expiration date the user inputs.
		this function is not locked into using 2 digit dates.
	returns:
		this fucntion returns true if the card is expired.
		false otherwise.
*/
function mod10( cardNumber ) { // LUHN Formula for validation of credit card numbers.
	var ar = new Array( cardNumber.length );
	var i = 0,sum = 0;
    	for( i = 0; i < cardNumber.length; ++i ) {
    		ar[i] = parseInt(cardNumber.charAt(i));
    	}
    	for( i = ar.length -2; i >= 0; i-=2 ) { // you have to start from the right, and work back.
    		ar[i] *= 2;							 // every second digit starting with the right most (check digit)
    		if( ar[i] > 9 ) ar[i]-=9;			 // will be doubled, and summed with the skipped digits.
    	}										 // if the double digit is > 9, ADD those individual digits together 
        	for( i = 0; i < ar.length; ++i ) {
        		sum += ar[i];						 // if the sum is divisible by 10 mod10 succeeds
        	}
        	return (((sum%10)==0)?true:false);	 	
    }

        function expired( month, year ) {
        	var now = new Date();							// this function is designed to be Y2K compliant.
        	var expiresIn = new Date(year,month,0,0,0);		// create an expired on date object with valid thru expiration date
        	expiresIn.setMonth(expiresIn.getMonth()+1);		// adjust the month, to first day, hour, minute & second of expired month
        	if( now.getTime() < expiresIn.getTime() ) return false;
        	return true;									// then we get the miliseconds, and do a long integer comparison
    }

        function validateCard(cardNumber,cardType,cardMonth,cardYear) {
        	if( cardNumber.length == 0 ) {						//most of these checks are self explanitory
        		alert("Please enter a valid card number.");
        		return false;				
        	}
        	for( var i = 0; i < cardNumber.length; ++i ) {		// make sure the number is all digits.. (by design)
        		var c = cardNumber.charAt(i);


            		if( c < '0' || c > '9' ) {
            			alert("Please enter a valid card number. Use only digits. do not use spaces or hyphens.");
            			return false;
            		}
            	}
            	var length = cardNumber.length;			//perform card specific length and prefix tests
                	switch( cardType ) {
                		case 'a':
                    			if( length != 15 ) {
                    				alert("Please enter a valid American Express Card number.");
                    				return;
                    			}
                    			var prefix = parseInt( cardNumber.substring(0,2));
                        			if( prefix != 34 && prefix != 37 ) {
                        				alert("Please enter a valid American Express Card number.");
                        				return;
                        			}
                        			break;

                        		case 'd':
                            			if( length != 16 ) {
                            				alert("Please enter a valid Discover Card number.");
                            				return;
                            			}
                            			var prefix = parseInt( cardNumber.substring(0,4));
                                			if( prefix != 6011 ) {
                                				alert("Please enter a valid Discover Card number.");
                                				return;
                                			}
                                			break;

                                		case 'm':
                                    			if( length != 16 ) {
                                    				alert("Please enter a valid MasterCard number.");
                                    				return;
                                    			}
                                    			var prefix = parseInt( cardNumber.substring(0,2));
                                        			if( prefix < 51 || prefix > 55) {
                                        				alert("Please enter a valid MasterCard Card number.");
                                        				return;
                                        			}
                                        			break;

                                        		case 'v':
                                            			if( length != 16 && length != 13 ) {
                                            				alert("Please enter a valid Visa Card number.");
                                            				return;
                                            			}
                                            			var prefix = parseInt( cardNumber.substring(0,1));
                                                			if( prefix != 4 ) {
                                                				alert("Please enter a valid Visa Card number.");
                                                				return;
                                                			}
                                                			break;
                                                	}
                                                	if( !mod10( cardNumber ) ) { 		// run the check digit algorithm
                                                		alert("Sorry! this is not a valid credit card number.");
                                                		return false;
                                                	}
                                                	if( expired( cardMonth, cardYear ) ) {							// check if entered date is already expired.
                                                		alert("Sorry! The expiration date you have entered would make this card invalid.");
                                                		return false;
                                                	}
                                                	return true; // at this point card has not been proven to be invalid
                                            }
//....End of Credit Card Validation Code...................................................................................................................................................


function tZone(){
var cDT = new Date();
var tZDiff = cDT.getTimezoneOffset()/60;
var tZSay = "";

var Month = cDT.getMonth();
var Day = cDT.getDay();
var Year = cDT.getYear();

	if (Month>=3 && Month<=10){
		if (tZDiff==4)
			{tZSay="Eastern Daylight Time";}
		if (tZDiff==5)
			{tZSay="Central Daylight Time";}
		if (tZDiff==6)
			{tZSay="Mountain Daylight Time";}
		if (tZDiff==7)
			{tZSay="Pacific Daylight Time";}}
	if (Month<=2 || Month>=11){
		if (tZDiff==4)
			{tZSay="Eastern Standard Time";}
		if (tZDiff==5)
			{tZSay="Central Standard Time";}
		if (tZDiff==6)
			{tZSay="Mountain Standard Time";}
		if (tZDiff==7)
			{tZSay="Pacific Standard Time";}}

return tZSay;
}

//  Number Formatting Section
function FmtCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function FmtNumber(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + num + '.' + cents);
}

