// JavaScript Document

function switchpayment(identifier)
	{
		//ensures that the fee is correct at all times
		amount = document.getElementById('field18').value;
		//get rid of the slashes
		var splitter = amount.split(".");
		//var newstr = amount.replace(/\./g, "");
		var newstr = amount.replace(/\,/g, "");
		var newstrtotal = newstr;
		var creditchargepercentage = .0275;
		var checkchargepercentage = .015;
		
		if (identifier == 'check')
			{
				document.getElementById('checkpayment').style.display = "block";
				document.getElementById('creditpayment').style.display = "none";
				
				document.getElementById('check_fee').style.display = "inline";
				document.getElementById('credit_fee').style.display = "none";
				
				if (document.getElementById('field19').value != '')
				{
					if (document.getElementById('field22').value != '')
					{
						var penaltyamount = document.getElementById('field22').value;
						newstrtotal = parseFloat(penaltyamount) + parseFloat(newstrtotal);
					}
					var newstr = newstrtotal * checkchargepercentage;
					document.getElementById('field19').value = newstr.toFixed(2);
					var finaltotal = parseFloat(newstr.toFixed(2)) + parseFloat(newstrtotal);
					document.getElementById('field20').value = finaltotal.toFixed(2);	
				}
			}
		else
			{
				document.getElementById('creditpayment').style.display = "block";
				document.getElementById('checkpayment').style.display = "none";
				
				document.getElementById('credit_fee').style.display = "inline";
				document.getElementById('check_fee').style.display = "none";
				
				if (document.getElementById('field19').value != '')
				{
					if (document.getElementById('field22').value != '')
					{
						var penaltyamount = document.getElementById('field22').value;
						newstrtotal = parseFloat(penaltyamount) + parseFloat(newstrtotal);
					}
					var newstr = newstrtotal * creditchargepercentage;
					document.getElementById('field19').value = newstr.toFixed(2);
					var finaltotal = parseFloat(newstr.toFixed(2)) + parseFloat(newstrtotal);
					document.getElementById('field20').value = finaltotal.toFixed(2);	
				}
			}
		
	}



function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=225,height=300,screenX=150,screenY=150,top=150,left=150')
}

//------------------------------------------
//Date Validation
function dob(dobby)
	{
		//get rid of the slashes	
		var newstr = dobby.replace(/\//g, "");
		//then make sure that the new string is numeric
		if (!IsNumeric(newstr))
			{
				return false;
			}
		//now that we know it is numeric
		//run checks against the postion of the '/"
		if (dobby.substring(3,2) != "/")
			{
				return false;
			}
		else if(dobby.substring(6,5) != "/")
			{
				return false;
			}
		else
			{
				//validated
				return true;
			}
	}
	
	
//------------------------------------------
//Citation Amount Total
//Statements included in the if else are mirrored above in switchpayment
function citationamounttotal(amount, overdue, pastdue, penaltyRate, cutoffDate, isRounded)
	{
		//get rid of the slashes
		var splitter = amount.split(".");
		//var newstr = amount.replace(/\./g, "");
		var newstr = amount.replace(/\,/g, "");
		var newstrtotal = newstr;
		var creditchargepercentage = .0275;
		var checkchargepercentage = .015;
		//alert(newstr);
		if (document.getElementById('credit').checked == true)
			{
				if(document.getElementById('PNI').style.display == "inline")
				{
					var inputYear = document.getElementById('field16').value;
					
					if(inputYear == cutoffDate)
					{
						pastdue = overdue;	
					}
					if(pastdue > 0)
					{
						var penaltyRate= penaltyRate * pastdue;
						penaltyRate = .01 * penaltyRate;
						
						var penaltyAmount = newstrtotal * penaltyRate;
						
						// BUG #2845 - Paul Cleaveland 9/8/2009
						// Added this to adjust Penalty Amount up or down depending on the decimal value
						if(isRounded == 'Y')
						{
							var wholePenaltyAmount = Math.floor(penaltyAmount);
							var decimalPenaltyAmount = penaltyAmount - wholePenaltyAmount;
							
							if(decimalPenaltyAmount < .5)
								penaltyAmount = Math.floor(penaltyAmount.toFixed(2));
							else
								penaltyAmount = Math.ceil(penaltyAmount.toFixed(2));
						}
						// End BUG #2845
						
						document.getElementById('field22').value = penaltyAmount.toFixed(2);
						
						newstrtotal = parseFloat(penaltyAmount.toFixed(2)) + parseFloat(newstrtotal);
					}
					
				}
				var newstr = newstrtotal * creditchargepercentage;
				document.getElementById('field19').value = newstr.toFixed(2);
				var finaltotal = parseFloat(newstr.toFixed(2)) + parseFloat(newstrtotal);
				document.getElementById('field20').value = finaltotal.toFixed(2);
			}
		else
			{			
				if(document.getElementById('PNI').style.display == "inline")
				{
					var inputYear = document.getElementById('field16').value;
					
					if(inputYear == cutoffDate)
					{
						pastdue = overdue;	
					}
					if(pastdue > 0)
					{
						var penaltyRate= penaltyRate * pastdue;
						penaltyRate = .01 * penaltyRate;
						
						var penaltyAmount = newstrtotal * penaltyRate;
						
						// BUG #2845 - Paul Cleaveland 9/8/2009
						// Added this to adjust Penalty Amount up or down depending on the decimal value
						if(isRounded == 'Y')
						{
							var wholePenaltyAmount = Math.floor(penaltyAmount);
							var decimalPenaltyAmount = penaltyAmount - wholePenaltyAmount;
							
							if(decimalPenaltyAmount < .5)
								penaltyAmount = Math.floor(penaltyAmount.toFixed(2));
							else
								penaltyAmount = Math.ceil(penaltyAmount.toFixed(2));
						}
						// End BUG #2845
						
						document.getElementById('field22').value = penaltyAmount.toFixed(2);
						
						newstrtotal = parseFloat(penaltyAmount.toFixed(2)) + parseFloat(newstrtotal);
					}
					
				}
				
				var newstr = newstrtotal * checkchargepercentage;
				document.getElementById('field19').value = newstr.toFixed(2);
				var finaltotal = parseFloat(newstr.toFixed(2)) + parseFloat(newstrtotal);
				document.getElementById('field20').value = finaltotal.toFixed(2);
			}
		
		
	}
//------------------------------------------	


//------------------------------------------
//Citation Amount Validation
function citationamount(amount)
	{
		
		//get rid of the slashes
		var splitter = amount.split(".");
		var newstr = amount.replace(/\./g, "");
		var newstr = newstr.replace(/\,/g, "");
		//then make sure that the new string is numeric
		if (!IsNumeric(newstr))
			{
				return false;
			}
		else if(splitter[2])
			{
				return false;
			}
		else if(!splitter[1] || splitter[1].length > 2)
			{
				return false;
			}
		else
			{
				return true;
			}
	}
//------------------------------------------


//------------------------------------------
//Numeric Validation
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;
   
    }
//-------------------------------------------



//------------------------------------------
//Email validation
function checkEmail(myForm)
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm))
			{
				return (true)
			}
		else
			{
				return (false)
			}
	}
//-------------------------------------------		


//------------------------------------------
//Phone validation
function checkPhone(phone_number)
	{
	  // Make sure there are ten digits in the phone number
		if (/(\D*\d\D*){10,}/.test(phone_number))
			{
				return (true)
			}
		else
			{
				return (false)
			}
	}
//-------------------------------------------		


//-------------------------------------------
//Credit Card Number Validation
function isCreditCard( CC )
{
if (CC.length > 19)
return (false);

sum = 0; mul = 1; l = CC.length;
for (i = 0; i < l; i++)
{
digit = CC.substring(l-i-1,l-i);
tproduct = parseInt(digit ,10)*mul;
if (tproduct >= 10)
sum += (tproduct % 10) + 1;
else
sum += tproduct;
if (mul == 1)
mul++;
else
mul--;
}
if ((sum % 10) == 0)
{
	return (true);
}
else
{
	return (false);
}
}
function isVisa( cc )
{
if( (cc.substring(0,1) == 4) && (cc.length == 16)
|| (cc.length == 13) )
{

return isCreditCard( cc );
}


return (false);
}

function isMC( cc )
{
if( (cc.length == 16) && (cc.substring(0,2) == 51)
|| (cc.substring(0,2) == 52) || (cc.substring(0,2) == 53)
|| (cc.substring(0,2) == 54) || (cc.substring(0,2) == 55) )
{
return isCreditCard( cc );
}


return (false);
}
//-------------------------------------------

//check to see if this year is deliquent and if the box needs to be displayed or not
//overdue is for 2 years ago
//pastdue is for previous year
function delinquent(overdue, cutoff, cutoffDate, input, pastdue, penaltyRate, isRounded)
{
	var d = new Date();
	var currentYear = d.getYear();
	
	//ie displays the year as 2009 but firefox displays it as 109
	if(currentYear < 1900)
	{
		currentYear = currentYear + 1900;	
	}
	
	if(input == '' || input >= currentYear )
	{
		return false;
	}
	else if((input == cutoffDate && cutoff == 'Y') || input < cutoffDate)
	{
		var alertString = "This county does not allow taxes for " + input + " to be paid online.";
		alert(alertString);
		
		//this clears out the year field that way the screen can't progress
		document.getElementById('field16').value = "";
		
		document.getElementById('PNI').style.display = "none";
		
	}
	else if (pastdue > 0 || input == cutoffDate)
	{
		document.getElementById('PNI').style.display = "inline";
		
		if(input == cutoffDate)
		{
			pastdue = overdue;	
		}

		if(document.getElementById('field18').value != "")
		{
			var amount = document.getElementById('field18').value;
			var newstr = amount.replace(/\,/g, "");
			var newstrtotal = newstr;
			var creditchargepercentage = .0275;
			var checkchargepercentage = .015;
			
			if (document.getElementById('credit').checked == true)
			{
				if(pastdue > 0)
				{
					var penaltyRate= penaltyRate * pastdue;
					penaltyRate = .01 * penaltyRate;
					
					var penaltyAmount = newstrtotal * penaltyRate;
					
					
					// BUG #2845 - Paul Cleaveland 9/8/2009
					// Added this to adjust Penalty Amount up or down depending on the decimal value
					if(isRounded == 'Y')
					{
						var wholePenaltyAmount = Math.floor(penaltyAmount);
						var decimalPenaltyAmount = penaltyAmount - wholePenaltyAmount;
						
						if(decimalPenaltyAmount < .5)
							penaltyAmount = Math.floor(penaltyAmount.toFixed(2));
						else
							penaltyAmount = Math.ceil(penaltyAmount.toFixed(2));
					}
					// End BUG #2845
					
					document.getElementById('field22').value = penaltyAmount.toFixed(2);
					
					newstrtotal = parseFloat(penaltyAmount.toFixed(2)) + parseFloat(newstrtotal);
				}
					
				var newstr = newstrtotal * creditchargepercentage;
				document.getElementById('field19').value = newstr.toFixed(2);
				var finaltotal = parseFloat(newstr.toFixed(2)) + parseFloat(newstrtotal);
				document.getElementById('field20').value = finaltotal.toFixed(2);
			}
			else
			{			
				if(pastdue > 0)
				{
					var penaltyRate= penaltyRate * pastdue;
					penaltyRate = .01 * penaltyRate;
					
					var penaltyAmount = newstrtotal * penaltyRate;
					
					// BUG #2845 - Paul Cleaveland 9/8/2009
					// Added this to adjust Penalty Amount up or down depending on the decimal value
					if(isRounded == 'Y')
					{
						var wholePenaltyAmount = Math.floor(penaltyAmount);
						var decimalPenaltyAmount = penaltyAmount - wholePenaltyAmount;
						
						if(decimalPenaltyAmount < .5)
							penaltyAmount = Math.floor(penaltyAmount.toFixed(2));
						else
							penaltyAmount = Math.ceil(penaltyAmount.toFixed(2));
					}
					// End BUG #2845
					
					document.getElementById('field22').value = penaltyAmount.toFixed(2);
					
					newstrtotal = parseFloat(penaltyAmount.toFixed(2)) + parseFloat(newstrtotal);
				}
				
				var newstr = newstrtotal * checkchargepercentage;
				document.getElementById('field19').value = newstr.toFixed(2);
				var finaltotal = parseFloat(newstr.toFixed(2)) + parseFloat(newstrtotal);
				document.getElementById('field20').value = finaltotal.toFixed(2);
			}
		}
		
	}
	else
	{
		document.getElementById('PNI').style.display = "none";
	}
	
}

//-------------------------------------------
//Routing Number Validation
function checkRouting(s)
	{
		var i, n, t;

  		// First, remove any non-numeric characters.

		  t = "";
		  for (i = 0; i < s.length; i++) {
			c = parseInt(s.charAt(i), 10);
			if (c >= 0 && c <= 9)
			  t = t + c;
		  }
		
		  // Check the length, it should be nine digits.
		
		  if (t.length != 9)
			return false;

		 // Run through each digit and calculate the total.
		  n = 0;
		  for (i = 0; i < t.length; i += 3) 
		  	{
				n += parseInt(t.charAt(i),     10) * 3
				  +  parseInt(t.charAt(i + 1), 10) * 7
				  +  parseInt(t.charAt(i + 2), 10);
		  	}
		
		  // If the resulting sum is an even multiple of ten (but not zero),
		  // the aba routing number is good.
	
		  if (n != 0 && n % 10 == 0)
		  	{
				return true;
			}
		  else
		  	{
				return false;
			}
	}
//-------------------------------------------

//-------------------------------------------
//Main Form Validation
function validateform()
	{
		
		
				
		//grab the date for the cc exp validation
		var now = new Date();
		var year = now.getFullYear();
		var year = year.toString();
		var month = now.getMonth()+1;
		var month = month.toString();
	
		if (month.length == 1)
			{
				var month = "0" + month;
			}
		
		//---------------------------------------------------------------
		//Validate Information 
		//Make an array to know where to set the focus
			var inputfields = new Array();
			//initiate focus counter
			var x = 0;
			//alert error message
			//intialize error message
			var errorstring = "" 
			//begin for loop for inpute fields
			//validate zip
			var checkzip = IsNumeric(document.getElementById('field5').value);
			//check email validation
			if (document.getElementById('field6').value != "")
				{
					var emailer = checkEmail(document.getElementById('field6').value);
				}
			//check phone validation
			if (document.getElementById('field21').value != "")
				{
					var checkphone = checkPhone(document.getElementById('field21').value);
				}
			
			//validate routing number (numeric)
			var checkroutingnumeric = IsNumeric(document.getElementById('field8').value);
			//validate routing number
			var checkroutenum = checkRouting(document.getElementById('field8').value);
			//validate account number (numeric)
			var checkaccountnumeric = IsNumeric(document.getElementById('field10').value);
			//validate check number (numeric)
			var checknumnumeric = IsNumeric(document.getElementById('field12').value);
			 //validate cc number between Visa and MC - VISA
			if (document.getElementById('cardtype').value == "Visa")
				{
					//validate cc number between Visa and MC - VISA
					var isvisa = isVisa(document.getElementById('field13').value);
				}
			else
				{
					//validate cc number between Visa and MC - MC
					var ismc = isMC(document.getElementById('field13').value);			 
				}
			
			var checkcvvnumber =  IsNumeric(document.getElementById('field14').value);	
			var checkcitation = citationamount(document.getElementById('field18').value);
			
			//alert(checkzip);
			for(i=1; i <=21; i++)
				{
				  // if the current field cannot be found, skip it
				  if( !document.getElementById('field'+i) )
						{
							continue;
						}
				
					//field 3 is not required
					if (i == 3)
						{
							continue;
						}
						
						
					if (document.getElementById('check').checked)
		 				{
							//if we are on check, skip credit card validation
							if (i == 13 || i==14){
								continue;
							}
						}
					else
						{
							//if we are on credit, skip check validation
							if (i == 8 || i==9 || i==10 || i==11 || i==12 ){
								continue;
							}
							
						}
					
						
					//check for blank
					if (document.getElementById('field'+i).value == "")
						{
							//set first instance to the focus array
							inputfields[x]= i;
							//default color if not complete
							document.getElementById('field'+i).style.backgroundColor = '#fef1d6'; 
							//increment focus array
							x++;
						}
					else
						{
							//set color back to white if corrected
							document.getElementById('field'+i).style.backgroundColor = '#FFF'; 
						}
						
					//check zip validation 
				 	if (i == 5){
					if (!checkzip)
						{
							//alert('test');
							//if a return is not made from IsNumeric
							//alert("Zip Code must be Numeric. Please Re-Enter.");
							errorstring += "--Zip Code must be Numeric. Please Re-Enter.--"+ "\r\n";
							document.getElementById('field'+i).value = "";
							document.getElementById('field5').focus();
							document.getElementById('field'+i).style.backgroundColor = '#fef1d6'; 
							//return false;
						}
					}//end if i == 5
					
					//---------------------------------------------------------------
					//Check Emails
					if (i == 6){
					if(document.getElementById('field6').value != "" && !emailer)
						{
							//alert("Invalid E-mail Address! Please re-enter.");
							errorstring += "--Invalid E-mail Address! Please re-enter.--" + "\r\n";
							document.getElementById('field6').focus();
							document.getElementById('field6').style.backgroundColor = '#fef1d6'; 
							//return false;
						}
					}//end if i == 6
					
					if (i == 7){
					if (document.getElementById('field6').value != document.getElementById('field7').value)
						{
							 errorstring += '--Email Addresses must match.--' + "\r\n";
							 //alert('Email Addresses must match');
							 document.getElementById('field6').focus();
							 document.getElementById('field6').style.backgroundColor = '#fef1d6'; 
							 document.getElementById('field7').style.backgroundColor = '#fef1d6'; 
							 //return false
						}
					}//end if i == 7
					//---------------------------------------------------------------
						
					//check phone validation 
				 	if (i == 21){
					if (!checkphone)
						{
							errorstring += "--Complete ten-digit Phone Number must be entered.--"+ "\r\n";
							document.getElementById('field'+i).value = "";
							document.getElementById('field'+i).focus();
							document.getElementById('field'+i).style.backgroundColor = '#fef1d6'; 
							//return false;
						}
					}//end if i == 21
					
					//---------------------------------------------------------------
					//Validate Payment Options
					if (document.getElementById('check').checked)
		 				{

							if (i == 8){
							if (!checkroutingnumeric)
								{
									//if a return is not made from IsNumeric
									errorstring += '--Rouing Number must be Numeric. Please Re-Enter.--' + "\r\n";
									//alert("Rouing Number must be Numeric. Please Re-Enter.");
									document.getElementById('field8').value ="";
									document.getElementById('field8').focus();
									document.getElementById('field8').style.backgroundColor = '#fef1d6'; 
									//return false;
								}
							}//end if == 8
							
							//validate routing number
							if (i == 8){
							if (!checkroutenum)
								{
									//if a return is not made from checkRouting
									errorstring += '--Invalid Routing Number. Please Re-Enter.--' + "\r\n";
									//alert("Invalid Routing Number. Please Re-Enter.");
									document.getElementById('field8').focus();
									document.getElementById('field8').style.backgroundColor = '#fef1d6'; 
									//return false;
								}
							}//end if == 8
							
							
							//check routing confirm 
							if (i == 9){
							if (document.getElementById('field8').value != document.getElementById('field9').value)
								{
									//if the routing numbers do not match 
									errorstring += '--Routing Numbers must match. Please Re-Enter.--' + "\r\n";
									//alert("Routing Numbers must match. Please Re-Enter.");
									document.getElementById('field8').focus();
									document.getElementById('field8').style.backgroundColor = '#fef1d6'; 
									document.getElementById('field9').style.backgroundColor = '#fef1d6'; 
									//return false;
								}
							}//end if == 9
							
							//validate account number (numeric)
							if (i == 10){
							if (!checkaccountnumeric)
								{
									//if a return is not made from IsNumeric
									errorstring += '--Account Number must be Numeric. Please Re-Enter.--' + "\r\n";
									document.getElementById('field10').value ="";
									document.getElementById('field10').focus();
									document.getElementById('field10').style.backgroundColor = '#fef1d6'; 
								}
							}//end if == 10
							
							
							//check account confirm 
							if (i == 11){
							if (document.getElementById('field10').value != document.getElementById('field11').value)
								{
									//if the account numbers do not match 
									errorstring += '--Account Numbers must match. Please Re-Enter.--' + "\r\n";
									//alert("Account Numbers must match. Please Re-Enter.");
									document.getElementById('field10').focus();
									document.getElementById('field10').style.backgroundColor = '#fef1d6'; 
									document.getElementById('field11').style.backgroundColor = '#fef1d6'; 
									//return false;
								}
							}//end if == 11
							
							//validate check number (numeric)
							if (i == 12){
							if (!checknumnumeric)
								{
									//if a return is not made from IsNumeric
									errorstring += '--Check Number must be Numeric. Please Re-Enter.--' + "\r\n";
									document.getElementById('field12').value ="";
									document.getElementById('field12').focus();
									document.getElementById('field12').style.backgroundColor = '#fef1d6'; 
									//return false;
								}
							}//end if == 12
						}//end if check
					else
						{
							//credit
							//validate cc number between Visa and MC - VISA
							if (i == 13){
							if (document.getElementById('cardtype').value == "Visa")
								{
									if (!isvisa)
										{
											//if a return is not made from checkRouting
											errorstring += '--Invalid Credit Card Number. Please Re-Enter.--' + "\r\n";
											document.getElementById('field13').focus();
											document.getElementById('field13').style.backgroundColor = '#fef1d6'; 
										}
								}
							else
								{
									//validate cc number between Visa and MC - MC
									if (!ismc)
										{
											//if a return is not made from checkRouting
											errorstring += '--Invalid Credit Card Number. Please Re-Enter.--' + "\r\n";
											document.getElementById('field13').focus();
											document.getElementById('field13').style.backgroundColor = '#fef1d6'; 
										}
								}
							}//end if == 13
							
							//check CVV length
							if (i == 14){
								
							if (!checkcvvnumber)
								{
									//if a return is not made from IsNumeric
									errorstring += '--CVV must be Numeric. Please Re-Enter.--' + "\r\n";
									document.getElementById('field14').value ="";
									document.getElementById('field14').focus();
									document.getElementById('field14').style.backgroundColor = '#fef1d6'; 
								}
								
							if (document.getElementById('field14').value.length != 3)
								{
									errorstring += '--Invalid CVV number must be 3 digits.--' + "\r\n";
									document.getElementById('field14').focus();
									document.getElementById('field14').style.backgroundColor = '#fef1d6'; 
								}

							//check exp date on cc - YEAR
							if (document.getElementById('selectyear').value < year.substring(2))
								{
									errorstring += '--Credit Card Expiration is Invalid.--' + "\r\n";
								}
							//check exp date on cc - MONTH	
							if (document.getElementById('selectmonth').value < month && 
													document.getElementById('selectyear').value == year.substring(2))
								{
									//alert(document.getElementById('selectmonth').value);
									errorstring += '--Credit Card Expiration is Invalid.--' + "\r\n";
								}	
						
							}//end if == 14
							
						}//end credit
					//---------------------------------------------------------------
					
					
					//---------------------------------------------------------------
					//Validate Citation 
						
						if (i == 15){
						if (document.getElementById('field15').value.length == 0)
							{
								errorstring += '--Please Input RCT Number--' + "\r\n";
								document.getElementById('field15').focus();
								document.getElementById('field15').style.backgroundColor = '#fef1d6'; 
							}
						}//end if i == 15
						//check to see if CRT Year is correct
						if (i == 16){
						if (document.getElementById('field16').value.length != 4)
							{
								errorstring += '--Please Input Valid Year--' + "\r\n";
								document.getElementById('field16').focus();
								document.getElementById('field16').style.backgroundColor = '#fef1d6'; 
							}
						}//end if i == 16
						if (i == 18){
						if(!checkcitation)
							{
								errorstring += '--Amount is not valid.--' + "\r\n";
								document.getElementById('field18').focus();
								document.getElementById('field18').style.backgroundColor = '#fef1d6'; 
							}
						}//end if i == 18
					//---------------------------------------------------------------
					
					
				}
			if (inputfields[0])
				{
					
					//alert('Required User Information was not entered');
					errorstring += '--Required User Information was not entered.--' + "\r\n";
					//set our focus to first instance 
					document.getElementById('field'+inputfields[0]).focus();
					//return false
					//return false;
				}
			if (errorstring != "")
				{
					alert(errorstring);
					return false;
				}
			else
				{
					document.payment.submit();
				}
			
		//---------------------------------------------------------------
		
	
		
		
		
		
	}
