	
	var start=new Date();
	start=Date.parse(start)/1000;
	var counts=10;
	function CountDown(){
		var now=new Date();
		now=Date.parse(now)/1000;
		var x=parseInt(counts-(now-start),10);
		//if(document.form1){document.form1.clock.value = x;}
		if(x>0){
			timerID=setTimeout("CountDown()", 100)
		}else{
			location.href="http://www.pikepass.com"
		}
	}

	function CountDown2(){
		var now=new Date();
		now=Date.parse(now)/1000;
		var x=parseInt(counts-(now-start),10);
		//if(document.form1){document.form1.clock.value = x;}
		if(x>0){
			timerID=setTimeout("CountDown2()", 100)
		}else{
			parent.location.href="http://apps08:88/TRIP2/"
		}
	}
	
	function ValidateFields(textObj, lsTitle, lsDefaultValue)
		{		
			if (textObj.value == "" || textObj.value == lsDefaultValue)
			{
			  alert("Please enter a valid value for the \"" + lsTitle + "\" field.");
			  textObj.focus();
			  return (false);
			}

			if (textObj.value.length > textObj.maxLength)
			{
			  alert("Value to long for the \"" + lsTitle + "\" field.");
			  textObj.focus();
			  return (false);
			}
			
			return (true);
		}


function validateSubmit(theForm)
		{
			if (!ValidateFields(theForm.txtAcctNo, "Account Number", ""))
				return (false);
			if (!ValidateFields(theForm.txtZipCode, "Zip Code", ""))
				return (false);
			return (true);
		}
		
var submitcount=0;

function checkrequired(which) {
	var pass=true;
	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required") {
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&
					tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
					tempobj.selectedIndex==0)) {
					pass=false;
			break;
         }
      }
   }
}
if (!pass) {
	shortFieldName=tempobj.name.substring(8,30).toUpperCase();
	alert("Please make sure the "+shortFieldName+" field was properly completed.");
	placeFocus();
	return false;
}
else
	return true;
}

function placeFocus() {
	if (document.forms.length > 0) {
		var field = document.forms[0];
		for (i = 0; i < field.length; i++) {
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
				document.forms[0].elements[i].focus();
			break;
         }
      }
   }
}



function ignoreSpaces(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
		temp += splitstring[i];
	return temp;
}


function confirmMethod(verbiage) {
		check = window.confirm(verbiage + "?");
		if (check) {
			return true;
			}
		else
			{
			return false;
			}
		}
		
function confirmInPerson(method,url,theForm) {
		check = window.confirm("Would you like to print out a list of the PikePass Tags due for recycling?");
		if (check) {
			return true;
			}
		else
			{
			return false;
			}
		}
		
		
	function confirmCancel() {
			check = window.confirm("You have not completed the recycling process.  No information will be saved.  You will be taken back to the Pikepass Home page.");
			if (check)
				//location.href="http://www.pikepass.com";
				window.location="http://www.pikepass.com";
				
			}	
	
	function cancelRecycle()
	{
		check = window.confirm("No information has been saved.  Are you sure you want to quit without completing the Tag Recycle Process?");
		if (check)
			window.location="http://www.pikepass.com";
	}
	
	function EmailFormCheck(textObj, ckObj)
		{
			if (!IsValidEmail(ignoreSpaces(textObj.value)))
			{
				alert("Please enter your email address in the form name@domain.");
			  textObj.focus();
				return false;
			}
			return true;
		}
	
	function IsValidEmail(email)
		{
			var fEmailOK = true;

			if (email.length < 4)
				return false;
			else if (email.lastIndexOf(' ') != -1)
				return false;
			else if ((i = email.lastIndexOf('@')) == -1)
				return false;
			else
			{
				// Get substring
				var tail = email.substring(i+1, email.length);
				if (tail.length < 3)
					return false;
				else if ((i = tail.lastIndexOf('.')) == -1)
					return false;
				else
				{
					var tailend = tail.substring(i+1, tail.length);
					if (tailend.length == 0)
						return false;
				}
			}
			return true;
		}
	
	function ChkLen(textObj,lsTitle,len)
		{
			if (textObj.value != "" && textObj.value.length < len)
			{
			  alert(lsTitle + " must be " + len + " digits!");
			  textObj.focus();
			  return (false);
			}
			
			return (true);
		}	  
			
			
	
	function validateSubmitCustInfo(theForm)
		{
			if (!ValidateFields(theForm.txtAccountNumber, "PikePass Account Number", ""))
				return (false);

			if (!ValidateFields(theForm.txtLastName, "Full Name on Account or Company Name", ""))
				return (false);
			
			if (!ValidateFields(theForm.txtMailAddr1, "Mailing Address", ""))
				return (false);

			if (!ValidateFields(theForm.txtCity, "City", ""))
				return (false);
			
			if (theForm.drpCountry.value == "United States")
			{
				if (!ValidateFields(theForm.drpState, "State", ""))
					return (false);
				if (!ValidateFields(theForm.txtZip, "Zip Code", ""))
					return (false);
				if (!ChkLen(theForm.txtZip, "Zip Code", 5))
					return (false);
				if (!ChkLen(theForm.txtZipExt, "Zip Code Ext", 4))
					return (false);
			}
			
			
			if (!ValidateFields(theForm.txtAreaCode, "Daytime Phone", ""))
				return (false);
			if (!ChkLen(theForm.txtAreaCode, "Daytime Phone", 3))
				return (false);
					
			if (!ValidateFields(theForm.txtPhonePrefix, "Daytime Phone", ""))
				return (false);
			if (!ChkLen(theForm.txtPhonePrefix, "Daytime Phone", 3))
				return (false);
				
			if (!ValidateFields(theForm.txtPhoneSuffix, "Daytime Phone", ""))
				return (false);
			if (!ChkLen(theForm.txtPhoneSuffix, "Daytime Phone", 4))
				return (false);
					
			if (!EmailFormCheck(theForm.txtEmailAddress,theForm.ckEmailStmt))
				return (false);
				
			return (true);
		}

	
	
	

	function ChkNum(obj,inputValue) {
	  if (isNaN(inputValue)){
		  inputValue.value == "";
		  alert('Please enter numeric data only.');
		  obj.value = '';
		  return false;
		}
	  else {
		  return true;
		}
	}


	//auto tab routines
	var isNN = (navigator.appName.indexOf("Netscape")!=-1);
	
	function autoTab(obj,input,len, e) {
	  if (ChkNum(obj,input.value)) {
		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();
		}
	  }
	}
	

	function containsElement(arr, ele) {
	  var found = false, index = 0;
	  while(!found && index < arr.length)
		if(arr[index] == ele)
		  found = true;
		else
		  index++;
		  return found;
	}

	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;
	}
	
	function DisplayLabel()  
			{ 
     			if(document.getElementById("ckEmailStmt").checked==false) 
     			{
					document.getElementById("lblAsterisk").style.visibility="hidden";
     			}
     			else
     			{
     				document.getElementById("lblAsterisk").style.visibility="visible";
     			}
			} 