function page_startup() {
	for (var iCnt = 0; iCnt < document.forms[0].elements.length; iCnt++ ) {
		if (document.forms[0].elements[iCnt].type != "hidden") {
			document.forms[0].elements[iCnt].focus();
			break;
		}
	}
}

function clearCCinfo() {
	with (document.form1) {
		name_on_card.value="";
		card_type.selectedIndex=0;
		cc_number.value="";
		exp_month.selectedIndex=0;
		exp_year.selectedIndex=0;
	}
}

function openWindow(loc) {
    msgWindow = window.open('','miniWin','width=600,height=600,screenX=100,screenY=100,top=100,left=100');
    msgWindow.location.href = loc;
}

function open500Window(loc) {
    msgWindow = window.open(loc,'helpWin','width=500,height=400,screenX=50,screenY=50,top=50,left=50');
}

function open800Window(loc) {
    newWin = window.open('','newWin','width=800,height=700,screenX=50,screenY=50,top=50,left=50',scrollbars='yes');
    newWin.location.href = loc;
}

function openVarWindow(loc,wide,high,posx,posy) {
    msgWindow = window.open(loc,'helpWin','width=' + wide + ',height=' + high + ',screenX=50,screenY=50,top=' + posx + ',left=' + posy + ',resizable=yes');
}

function openVarWindowScroll(loc,wide,high,posx,posy) {
    msgWindow = window.open(loc,'helpWin','width=' + wide + ',height=' + high + ',screenX=50,screenY=50,top=' + posx + ',left=' + posy + ',scrollbars=yes,resizable=yes');
}

function fmtPhoneNum() {
	var phone=""  ;
	var snum=document.forms[0].elements["MAIN_PHONE_NBR"].value
	var len = snum.length
	for ( i=0;i<len;i++)
	 {
	 	if (!isNaN(snum.charAt(i))) { phone = phone + snum.charAt(i) }
	 }
	  
	//var num =document.forms[0].elements["MAIN_PHONE_NBR"].value.length
	
	if (phone.length < 10)
		{alert('You must enter a 10 digit phone Number with Area Code');
		document.forms[0].elements["MAIN_PHONE_NBR"].focus();	
		return false;
		}
	else
		{
		phone= "(" +  phone.substr(0,3) + ")" + phone.substr(3,3) + "-" + phone.substr(6,4)
		document.forms[0].elements["MAIN_PHONE_NBR"].value = phone		
		}		
}

function formatCurrency(num) {
<!-- Function courtesy of:  Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site:  http://www7.ewebcity.com/cyanide7 -->
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%100);
num = Math.floor((num*100+0.5)/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 ("$" + num + "." + cents);
}

function fmtNum(formField) {
	var aNum=""  ;
	var snum=document.forms[0].elements[formField].value
	var len = snum.length
	for ( i=0;i<len;i++)
	 {
	 	if (!isNaN(snum.charAt(i))) { aNum = aNum + snum.charAt(i) }
	 }
	 aNum="$" + aNum
	 document.forms[0].elements[formField].value = aNum
}

function fmtNumCurrency(formField) {
	var aNum=""  ;
	var aNumVal=0;
	var snum=document.forms[0].elements[formField].value
	var len = snum.length
	for ( i=0;i<len;i++)
	 {
	 	if (!isNaN(snum.charAt(i))) { aNum = aNum + snum.charAt(i) }
	 }
	 aNumVal = eval(aNum);
	 aNum="$" + aNum;
	 document.forms[0].elements[formField].value = aNum
	 return aNumVal;
}

function fmtDate(formField) {
	var aDate=""  ;
	var snum=document.forms[0].elements[formField].value
	var len = snum.length
	for ( i=0;i<len;i++) {
	 	if (!isNaN(snum.charAt(i))) { aDate = aDate + snum.charAt(i) }
	}
	
	if (aDate.length <8)
		{alert('You must enter an  8 digit date  for example 05152001');
		document.forms[0].elements[formField].focus();	
		return false;
		}
	if (aDate.substr(0,2) < 1 || aDate.substr(0,2) >12) 
		{alert('Incorrect Month, must be between 01 and 12');
			document.forms[0].elements[formField].focus();
			 return false;}
			
	if (aDate.substr(2,4) < 1 || aDate.substr(2,2) >31) 
			{alert('Incorrect Day, must be between 01 and 31');
			  document.forms[0].elements[formField].focus();
			  return false;}
	if (aDate.substr(4,4) < 1950 || aDate.substr(4,4) >2050) 
			{alert('Incorrect Year, must be between 1950 and 2050');
			  document.forms[0].elements[formField].focus();
			  return false;}

		
	aDate=   aDate.substr(0,2) + "/" + aDate.substr(2,2) + "/" + aDate.substr(4,4);
	document.forms[0].elements[formField].value = aDate;		
}

function fmtTime(formField) 
{
	var aTime=""  ;
	var snum=document.forms[0].elements[formField].value
	var len = snum.length
	for ( i=0;i<len;i++)
	 {
	 	if (!isNaN(snum.charAt(i))) { aTime = aTime + snum.charAt(i) }
	 }  
		
	if (aTime.length < 4)
		{alert('You must enter a 4 digit military time  for example 14:30');
		document.forms[0].elements[formField].focus();	
		return false;		}	
	//if (snum.charAt(1) =":" || snum.charAt(3) =":") 
			//{alert('You must enter a 4 digit military time  for example 14:30');
			//  document.forms[0].elements[formField].focus();
			//  return false;}	
		
	if (aTime.substr(0,2) < 0 || aTime.substr(0,2) >23) 
			{alert('Incorrect Hour, must be between 00 and 24');
			  document.forms[0].elements[formField].focus();
			  return false;}
			
	if (aTime.substr(2,4) < 0 || aTime.substr(2,2) >59) 
			{alert('Incorrect Minutes, must be between 00 and 59');
			  document.forms[0].elements[formField].focus();
			  return false;}
		
	aTime= aTime.substr(0,2) + ":" + aTime.substr(2,2) 
	document.forms[0].elements[formField].value = aTime				
}

function fmtNonReqPhoneNum(fieldname) {
	var phone=""  ;
	var snum=document.forms[0].elements[fieldname].value
	var len = snum.length
	for ( i=0;i<len;i++) {
	 	if (!isNaN(snum.charAt(i))) { phone = phone + snum.charAt(i) }
	} 
	if (phone.length < 10 && phone.length != 0 )	{
		alert('You must enter a 10 digit phone Number with Area Code');
		document.forms[0].elements[fieldname].focus();	
		return false;
	}	else {
		if(phone.length!=0)	{
			phone= "(" +  phone.substr(0,3) + ")" + phone.substr(3,3) + "-" + phone.substr(6,4)
			document.forms[0].elements[fieldname].value = phone
		}		
	}
}

function getDate(fieldName) {
	var now = new Date()
	if ((now.getMonth()+1)<10 && now.getDate()>9 )
		{now = "0" + (now.getMonth()+1)  + "/" + now.getDate() +"/"+now.getYear()
		document.forms[0].elements[fieldName].value = now
		return true		}
	if ((now.getMonth())>9 &&now.getDate()<10)
		{now = (now.getMonth()+1)  + "/" +  "0" + now.getDate() +"/"+now.getYear()
		document.forms[0].elements[fieldName].value = now
		return true}
	if ((now.getDate())<10 && (now.getMonth()+1)<10)  	
		{now = "0" + (now.getMonth()+1)  + "/" +  "0" + now.getDate() +"/"+now.getYear()
		document.forms[0].elements[fieldName].value = now
		return true}
	if ((now.getDate())>9 && (now.getMonth()+1)>9)  
		{now =  (now.getMonth()+1)  + "/" +   now.getDate() +"/"+now.getYear()
		document.forms[0].elements[fieldName].value = now
		return true}
	
}

function 	recallPage() {     
   location.href = 'default.asp';
}

function highlight(which,color){
	if (document.all||document.getElementById)
	which.style.backgroundColor=color
}

function 	closeNewWin() {     
	//if window.name!="msgWindow"
	//msgWindow = window.open('','miniWin','width=400,height=300,screenX=400,screenY=400,top=400,left=400');
 	//msgWindow.close();	
}

function alert_msg(titletext,bodytext) {
	info.style.top = event.clientY + 10;
	info.style.left = event.clientX + 10;
	imagebody.innerText = bodytext;
}

function away() {
	info.style.top = -500;
}

// CREDITS:
// Print This Page
// Copyright (c) 2000 ZDnet. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.zdnet.com/developer
// devhead@zdnet.com
// 12/07/2000

/*
This script is written by Eric (Webcrawl@usa.net)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function printit(){  
    if (window.print) {
	window.print() ;  
    } else {
	var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
	WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
    }
}
