
function OnButton1()
{

	if (!pooch_checker1())
	{
		return (false);		}

	else
	{
    document.Form1.action = "cart.asp?id=1"
    //document.Form1.target = "_blank";    // Open in a new window
    document.Form1.submit();             // Submit the page
    return true;
	}


}


function OnButton3()
{
	
	if (!pooch_checker3())
	{
		return (false);		}

	else
	{
    document.Form1.action = "cart.asp?id=3"
    document.Form1.submit();             // Submit the page
    return true;
	}


}


function OnButtonHome()
{
    document.Form1.action = "product.asp?cart=1"
    //document.Form1.target = "_blank";    // Open in a new window
    document.Form1.submit();             // Submit the page
    return true;
}


function OnButtonUpdateQty()
{
    document.Form1.action = "cart.asp?u=3"
    //document.Form1.target = "_blank";    // Open in a new window
    document.Form1.submit();             // Submit the page
    return true;
}


function OnButtonUpdateItem(id)
{
	document.Form1.action = "cart.asp?u=98&i=" + id
    //document.Form1.target = "_blank";    // Open in a new window
    document.Form1.submit();             // Submit the page
    return true;
}


function OnButtonDeleteItem(id)
{
    document.Form1.action = "cart.asp?u=99&i=" + id
    //document.Form1.target = "_blank";    // Open in a new window
    document.Form1.submit();             // Submit the page
    return true;
}





function OnButtonCheckout()
{	
    document.Form1.action = "cart2.asp?id=3"
    document.Form1.submit();             // Submit the page
    return true;
}


function OnButtonBilling()
{
	if (!pooch_Billing())
	{
		return (false);		}

	else
	{
    document.Form1.action = "cart3.asp"
    document.Form1.submit();             // Submit the page
    return true;
	}
}



function OnButtonValidatePatches()
{
	if (!validate_patches())
	{
		return (false);		}

	else
	{
    document.patch.action = "page.asp?pg=thanks"
    document.patch.submit();             // Submit the page
    return true;
	}
}


function OnButtonValidateBadges()
{
	if (!validate_badges())
	{
		return (false);		}

	else
	{
    document.patch.action = "page.asp?pg=thanks"
    document.patch.submit();             // Submit the page
    return true;
	}
}


function OnButtonValidateCatalogDownload()
{
	if (!validate_catalogdownload())
	{
		return (false);		}

	else
	{
    document.patch.action = "page.asp?pg=thanksdownload"
    document.patch.submit();             // Submit the page
    return true;
	}
}



function OnButtonValidateCatalogRequest()
{
	if (!validate_catalogdownload())
	{
		return (false);		}

	else
	{
    document.patch.action = "page.asp?pg=thanks"
    document.patch.submit();             // Submit the page
    return true;
	}
}


function OnButtonReviewOrder()
{
	if (!pooch_Payment())
	{
		return (false);		}

	else
	{
    document.form1.action = "cart4.asp"
    document.form1.submit();             // Submit the page
    return true;
	}
}


function OnButtonProcessOrder()
{
	
    document.form1.action = "cart5.asp"
    document.form1.submit();             // Submit the page
    return true;
	
}






	// -- For Ques 1 & 2
	function radio_button_checker()
	{		
		// set var radio_choice to false				
		var radio_choice1 = false;
		var radio_choice2 = false;
		
		
				
		var MESSAGE = "";
		var ERROR = false;		

					
		
		// -- Ques 1
		for (counter = 0; counter < form1.radiobutton1_a.length; counter++)
		{	if (form1.radiobutton1_a[counter].checked)			
				radio_choice1 = true; 	}		

		if (!radio_choice1)
		{	MESSAGE = "Please answer question 1a";		
			ERROR = true;	}
			
		
		
		// -- Ques 1b
		for (counter = 0; counter < form1.radiobutton1_b.length; counter++)
		{	if (form1.radiobutton1_b[counter].checked)			
				radio_choice2 = true; 	}		

		if (!radio_choice2)
		{	MESSAGE += "\nPlease answer question 1b";		
			ERROR = true;	}
			
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);			
	}

	
	function setOptionText(the_select, the_array, array_length)
	{
		for (loop=0; loop < array_length; loop++)
  		{	the_select.options[loop].text = the_array[loop];  		}
		
	}
	
	
	
	// -- For Fresh 2A
	function radio_button_checker2A()
	{					
		// set var radio_choice to false
		var radio_choice2 = false;
		var radio_choice3 = false;
		var radio_choice4 = false;
		//var radio_choice5 = false;
		
		
		var MESSAGE = "";
		var ERROR = false;	
		
		
		// -- Ques 2
		for (counter = 0; counter < form1.radiobutton2.length; counter++)
		{	if (form1.radiobutton2[counter].checked)			
				radio_choice2 = true; 	}		

		if (!radio_choice2)
		{	MESSAGE = "Please answer question 2";		
			ERROR = true;	}
			
			
		// -- Ques 3
		for (counter = 0; counter < form1.radiobutton3.length; counter++)
		{	if (form1.radiobutton3[counter].checked)			
				radio_choice3 = true; 	}		

		if (!radio_choice3)
		{	MESSAGE += "\nPlease answer question 3";		
			ERROR = true;	}
			
			
		// -- Ques 4
		for (counter = 0; counter < form1.radiobutton4.length; counter++)
		{	if (form1.radiobutton4[counter].checked)			
				radio_choice4 = true; 	}		

		if (!radio_choice4)
		{	MESSAGE += "\nPlease answer question 4";		
			ERROR = true;	}
			
		
		/*
		// -- Ques 5
		for (counter = 0; counter < form1.radiobutton5.length; counter++)
		{	if (form1.radiobutton5[counter].checked)			
				radio_choice5 = true; 	}		

		if (!radio_choice5)
		{	MESSAGE += "\nPlease answer question 5";		
			ERROR = true;	}
		*/						
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);			
	}
	
	
	function radio_button_checker3A()
		{
		// set var radio_choice to false
		//var radio_choice = false;
		var radio_choice4B = false;
		var radio_choice4C = false;
		var radio_choice4D = false;
		//radiobutton4B
				
		var MESSAGE = "";
		var ERROR = false;		

		for (counter = 0; counter < form1.radiobutton4B.length; counter++)
		{	if (form1.radiobutton4B[counter].checked)
			radio_choice4B = true; 	}		

		if (!radio_choice4B)
		{	MESSAGE = "Please answer question 4B.";		
			ERROR = true;	}
			
		
		for (counter = 0; counter < form1.radiobutton4C.length; counter++)
		{	if (form1.radiobutton4C[counter].checked)
			radio_choice4C = true; 	}		

		if (!radio_choice4C)
		{	MESSAGE += "\nPlease answer question 4C.";		
			ERROR = true;	}
			
			
		for (counter = 0; counter < form1.radiobutton4D.length; counter++)
		{	if (form1.radiobutton4D[counter].checked)
			radio_choice4D = true; 	}		

		if (!radio_choice4D)
		{	MESSAGE += "\nPlease answer question 4D.";		
			ERROR = true;	}
				
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);
	}
	
	
	
	// -- For Fresh A com1
	function radio_button_checker_com1()
	{					
		// set var radio_choice to false				
		var radio_choice8 = false;
		var radio_choice9 = false;
		var radio_choice10 = false;
				
				
		var MESSAGE = "";
		var ERROR = false;		

					
		
		// -- Ques 8
		for (counter = 0; counter < form1.radiobutton8.length; counter++)
		{	if (form1.radiobutton8[counter].checked)			
				radio_choice8 = true; 	}		

		if (!radio_choice8)
		{	MESSAGE += "Please answer question 5";		
			ERROR = true;	}
			
			
		// -- Ques 9
		for (counter = 0; counter < form1.radiobutton9.length; counter++)
		{	if (form1.radiobutton9[counter].checked)			
				radio_choice9 = true; 	}		

		if (!radio_choice9)
		{	MESSAGE += "\nPlease answer question 6";		
			ERROR = true;	}
			
			
		// -- Ques 10
		for (counter = 0; counter < form1.radiobutton10.length; counter++)
		{	if (form1.radiobutton10[counter].checked)			
				radio_choice10 = true; 	}		

		if (!radio_choice10)
		{	MESSAGE += "\nPlease answer question 7";		
			ERROR = true;	}
			
			
									
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);			
	}
	
	
	
	
//	function catalog_checker()
	function pooch_checker1()
	{
		// set var radio_choice to false					
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;
	
		var onlyDigits = /\d/;
				
		// -- Form values
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{1}/;
		
		
				
		if (Form1.qty1.value == "")
		{	MESSAGE += "\nPlease enter the number of Beagle patches you would like to add to the cart.";		
			ERROR = true;	}
			
		if  ((Form1.qty1.value != "") && (!anyLetter.test(Form1.qty1.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Beagle\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		

			if  (  (Form1.qty1.value != "") && (!re.test(Form1.qty1.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least 1 digit.";
				
								
				ERROR = true;
			}
			
						
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}		
		

		return (true);	

	}
	
	
	function pooch_checker2(qtyid)
	{
		// set var radio_choice to false					
		//alert("Hey");
			
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;
	
		var onlyDigits = /\d/;
				
		// -- Form values
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{1}/;
		
		//qtyid = "qty2";
		
		
		switch(qtyid)
		{
			case 0:
			  if (Form1.qty0.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}			  
			  break;    
			  
			case 1:
			  if (Form1.qty1.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 2:
			  if (Form1.qty2.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 3:
			  if (Form1.qty3.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 4:
			  if (Form1.qty4.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 5:
			  if (Form1.qty5.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 6:
			  if (Form1.qty6.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 7:
			  if (Form1.qty7.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 8:
			  if (Form1.qty8.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 9:
			  if (Form1.qty9.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;			  
			case 10:
			  if (Form1.qty10.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 11:
			  if (Form1.qty11.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 12:
			  if (Form1.qty12.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			
			case 13:
			  if (Form1.qty13.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 14:
			  if (Form1.qty14.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 15:
			  if (Form1.qty15.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 16:
			  if (Form1.qty16.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 17:
			  if (Form1.qty17.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 18:
			  if (Form1.qty18.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 19:
			  if (Form1.qty19.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;			  
			case 20:
			  if (Form1.qty20.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;			  
		
			case 21:
			  if (Form1.qty21.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 22:
			  if (Form1.qty22.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			
			case 23:
			  if (Form1.qty23.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 24:
			  if (Form1.qty24.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 25:
			  if (Form1.qty25.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			  
			case 26:
			  if (Form1.qty26.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 27:
			  if (Form1.qty27.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 28:
			  if (Form1.qty28.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
			case 29:
			  if (Form1.qty29.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;			  
			case 30:
			  if (Form1.qty30.value == "")
				{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
				ERROR = true;	}
			  break;
					  
			default:
			  alert("Something is wrong here.");
		}
		
		
		
		
		/*
		if (Form1.qty2.value == "")
		{	MESSAGE += "\nPlease enter the number of patches you would like to add to the cart.";		
			ERROR = true;	}
			
		if  ((Form1.qty2.value != "") && (!anyLetter.test(Form1.qty2.value)))
		{
			MESSAGE += "\nPlease enter something in the \"text\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		*/
		

		//	if  (  (Form1.qty2.value != "") && (!re.test(Form1.qty2.value))  ) 
		//	{
		//		MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least 1 digit.";
		//		
		//						
		//		ERROR = true;
		//	}
			
						
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}		
		

		return (true);	

	}
	
	
	function pooch_checker3()
	{
		// set var radio_choice to false					
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;
	
		var onlyDigits = /\d/;
				
		// -- Form values
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{1}/;
		
		
				
		if (Form1.qty3.value == "")
		{	MESSAGE += "\nPlease enter the number of Yorkshire Terrier patches you would like to add to the cart.";		
			ERROR = true;	}
			
		if  ((Form1.qty3.value != "") && (!anyLetter.test(Form1.qty3.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Yorkshire Terrier\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		

			if  (  (Form1.qty3.value != "") && (!re.test(Form1.qty3.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least 1 digit.";
				
								
				ERROR = true;
			}
			
						
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}		
		

		return (true);	

	}
	
	
	
	
	function trim(value) 
	{
   	var temp = value;
   	var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   	if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   	var obj = / +/g;
   	temp = temp.replace(obj, " ");
   	if (temp == " ") { temp = ""; }
   	return temp;
	}
	
	
	
	// -- FOR Part B
	
	// -- For Fresh 2B
	function radio_button_checker2B()
	{					
		// set var radio_choice to false				
		var radio_choice3 = false;
		var radio_choice4 = false;
		
				
		var MESSAGE = "";
		var ERROR = false;				
		
		var anyLetter = /\w/;	
		
		// -- Ques 3
		for (counter = 0; counter < form1.radiobutton3.length; counter++)
		{	if (form1.radiobutton3[counter].checked)			
				radio_choice3 = true; 	}		

		if (!radio_choice3)
		{	MESSAGE += "\nPlease answer question 3";		
			ERROR = true;	}
			
			
		// -- Ques 4
		for (counter = 0; counter < form1.radiobutton4.length; counter++)
		{	if (form1.radiobutton4[counter].checked)			
				radio_choice4 = true; 	}		

		if (!radio_choice4)
		{	MESSAGE += "\nPlease answer question 4";		
			ERROR = true;	}
			
			
		// -- Ques 5
		if ((!form1.checkbox5_a.checked) && (!form1.checkbox5_b.checked) && (!form1.checkbox5_c.checked) && (!form1.checkbox5_d.checked) && (!form1.checkbox5_e.checked) && (!form1.checkbox5_f.checked) && (!form1.checkbox5_g.checked) && (!form1.checkbox5_h.checked) && (!form1.checkbox5_i.checked) )
		{	MESSAGE += "\nPlease answer question 5.";		
			ERROR = true;	}
			
		
		if (form1.checkbox5_i.checked)
		{
				if  ( (form1.txt_Other5B.value == "")  || (!anyLetter.test(form1.txt_Other5B.value) ))
				{
					MESSAGE += "\nPlease enter your response in the text box for question 5.";
					ERROR = true;
				}
		}
				
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);			
	}
	
	
	function pooch_Billing()
	{
		// set var radio_choice to false					
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;
	
		var onlyDigits = /\d/;
				
		// -- Form values for Billing
		if (form1.Billingfirstname.value == "")
		{	MESSAGE += "\nPlease enter a Billing first name.";		
			ERROR = true;	}
			
		if  ((form1.Billingfirstname.value != "") && (!anyLetter.test(form1.Billingfirstname.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Billing first name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (form1.BillingLastname.value == "")
		{	MESSAGE += "\nPlease enter a Billing last name.";		
			ERROR = true;	}
			
		if  ((form1.BillingLastname.value != "") && (!anyLetter.test(form1.BillingLastname.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Billing last name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		
		if (form1.BillingAddress.value == "")
		{	MESSAGE += "\nPlease enter a Billing Address.";		
			ERROR = true;	}
			
		if  ((form1.BillingAddress.value != "") && (!anyLetter.test(form1.BillingAddress.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Billing Address\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		if (form1.BillingCity.value == "")
		{	MESSAGE += "\nPlease enter a Billing City.";		
			ERROR = true;	}
			
		if  ((form1.BillingCity.value != "") && (!anyLetter.test(form1.BillingCity.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Billing City\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		if (form1.BillingState.value == "")
		{	MESSAGE += "\nPlease enter a Billing State.";		
			ERROR = true;	}
			
		if  ((form1.BillingState.value != "") && (!anyLetter.test(form1.BillingState.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Billing State\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		
		
		
		
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{5}/;
		//var onlyDigits = /\d/;
		
			
		
		if (form1.BillingZip.value == "")
		{	MESSAGE += "\nPlease enter a Billing Zip.";		
			ERROR = true;	}
			
		if  ((form1.BillingZip.value != "") && (!anyLetter.test(form1.BillingZip.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Billing Zip\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		
		
		//-- make sure at least 5 digits
			//if  (     (form1.txt_Zip.value != "") && (ZipPass != true) && (!onlyDigits.test(form1.txt_Zip.value))  ) 
			//if  (     (form1.txt_Zip.value != "") && (!onlyDigits.test(form1.txt_Zip.value))  ) 
			
			if  (     (form1.BillingZip.value != "") && (!re.test(form1.BillingZip.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least five digits.";
				
								
				ERROR = true;
			}
			
			
			
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		
		if (form1.email.value == "")
		{
			MESSAGE += "\nPlease enter an email.";		
			ERROR = true;
		}
		
				
		if ((form1.email.value != "") &&(!myRegExp.test(form1.email.value)))
		{
			MESSAGE += "\nYour email address is missing an '@' symbol.";		
			ERROR = true;
		}
		
		
		if ((form1.email.value != "") && (!myRegExp2.test(form1.email.value)))
		{
			MESSAGE += "\nYour email address is missing a '.' symbol.";		
			ERROR = true;
		}	
			
		
		if (form1.phone.value == "")
		{	MESSAGE += "\nPlease enter a phone number.";		
			ERROR = true;	}
			
		if  ((form1.phone.value != "") && (!anyLetter.test(form1.phone.value)))
		{
			MESSAGE += "\nPlease enter something in the \"phone\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		
		MESSAGE += "\n";
			
		// -- Form values for Shipping
		if (form1.Shippingfirstname.value == "")
		{	MESSAGE += "\nPlease enter a Shipping first name.";		
			ERROR = true;	}
			
		if  ((form1.Shippingfirstname.value != "") && (!anyLetter.test(form1.Shippingfirstname.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping first name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (form1.ShippingLastname.value == "")
		{	MESSAGE += "\nPlease enter a Shipping last name.";		
			ERROR = true;	}
			
		if  ((form1.ShippingLastname.value != "") && (!anyLetter.test(form1.ShippingLastname.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping last name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		
		if (form1.ShippingAddress.value == "")
		{	MESSAGE += "\nPlease enter a Shipping Address.";		
			ERROR = true;	}
			
		if  ((form1.ShippingAddress.value != "") && (!anyLetter.test(form1.ShippingAddress.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping Address\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		/*
		if (form1.ShippingAddress2.value == "")
		{	MESSAGE += "\nPlease enter a Shipping Address2.";		
			ERROR = true;	}
			
		if  ((form1.ShippingAddress2.value != "") && (!anyLetter.test(form1.ShippingAddress2.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping Address2\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		*/
		
		
		if (form1.ShippingCity.value == "")
		{	MESSAGE += "\nPlease enter a Shipping City.";		
			ERROR = true;	}
			
		if  ((form1.ShippingCity.value != "") && (!anyLetter.test(form1.ShippingCity.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping City\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		if (form1.ShippingState.value == "")
		{	MESSAGE += "\nPlease enter a Shipping State.";		
			ERROR = true;	}
			
		if  ((form1.ShippingState.value != "") && (!anyLetter.test(form1.ShippingState.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping State\" field.  Using blanks are not allowed.";
			ERROR = true;
		}	
		
		
		
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{5}/;
		//var onlyDigits = /\d/;
		
			
		
		if (form1.ShippingZip.value == "")
		{	MESSAGE += "\nPlease enter a Shipping Zip.";		
			ERROR = true;	}
			
		if  ((form1.ShippingZip.value != "") && (!anyLetter.test(form1.ShippingZip.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Shipping Zip\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		
		
		//-- make sure at least 5 digits
			//if  (     (form1.txt_Zip.value != "") && (ZipPass != true) && (!onlyDigits.test(form1.txt_Zip.value))  ) 
			//if  (     (form1.txt_Zip.value != "") && (!onlyDigits.test(form1.txt_Zip.value))  ) 
			
			if  (     (form1.ShippingZip.value != "") && (!re.test(form1.ShippingZip.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least five digits.";
				
								
				ERROR = true;
			}
			
			
					
					
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);
	}
	
	
	
	function validate_badges()
	{
			
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;	
		var onlyDigits = /\d/;
		
		var MESSAGE = "";
		var ERROR = false;		
		
		
		// -- Form values for Quote
		if (patch.StyleNo.value == "")
		{	MESSAGE += "Please enter a Style Number.";		
			ERROR = true;	}
			
		if  ((patch.StyleNo.value != "") && (!anyLetter.test(patch.StyleNo.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Style Number\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		// -- Form values for Quote
		if (patch.TotalQuantity.value == "")
		{	MESSAGE += "\nPlease enter a Total Quantity.";		
			ERROR = true;	}
			
		if  ((patch.TotalQuantity.value != "") && (!anyLetter.test(patch.TotalQuantity.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Total Quantity\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		
		var Referred = false;
		//var LetteringStyle_1 = false;
		//var Color = false;
		var LetteringEnamel = false;
		//var LetteringSeparators = false;
		var BadgeFinish = false;
		var BadgeShape = false;
		var Attachments = false;
		//var radio_choice4C = false;

		
		/*
		for (counter = 0; counter < patch.LetteringStyle_1.length; counter++)
		{	if (patch.LetteringStyle_1[counter].checked)
			LetteringStyle_1 = true; 	}		

		if (!LetteringStyle_1)
		{	MESSAGE += "\nPlease select a Lettering Style.";		
			ERROR = true;	}
			
		
		for (counter = 0; counter < patch.Color.length; counter++)
		{	if (patch.Color[counter].checked)
			Color = true; 	}		

		if (!Color)
		{	MESSAGE += "\nPlease select a Color.";		
			ERROR = true;	}
		*/
		
		for (counter = 0; counter < patch.LetteringEnamel.length; counter++)
		{	if (patch.LetteringEnamel[counter].checked)
			LetteringEnamel = true; 	}		

		if (!LetteringEnamel)
		{	MESSAGE += "\nPlease select a Lettering Enamel.";		
			ERROR = true;	}
		
		/*	
		for (counter = 0; counter < patch.LetteringSeparators.length; counter++)
		{	if (patch.LetteringSeparators[counter].checked)
			LetteringSeparators = true; 	}		

		if (!LetteringSeparators)
		{	MESSAGE += "\nPlease select a Lettering Separator.";		
			ERROR = true;	}
		*/	
		
		for (counter = 0; counter < patch.BadgeFinish.length; counter++)
		{	if (patch.BadgeFinish[counter].checked)
			BadgeFinish = true; 	}		

		if (!BadgeFinish)
		{	MESSAGE += "\nPlease select a Badge Finish.";		
			ERROR = true;	}
		
		
		for (counter = 0; counter < patch.BadgeShape.length; counter++)
		{	if (patch.BadgeShape[counter].checked)
			BadgeShape = true; 	}		

		if (!BadgeShape)
		{	MESSAGE += "\nPlease select a Badge Shape.";		
			ERROR = true;	}
		
		
		for (counter = 0; counter < patch.Attachments.length; counter++)
		{	if (patch.Attachments[counter].checked)
			Attachments = true; 	}		

		if (!Attachments)
		{	MESSAGE += "\nPlease select an Attachments.";		
			ERROR = true;	}
		
			
				
		
		for (counter = 0; counter < patch.Referred.length; counter++)
		{	if (patch.Referred[counter].checked)
			Referred = true; 	}		

		if (!Referred)
		{	MESSAGE += "\nPlease tell us How You Heard About Us.";		
			ERROR = true;	}
		
		
		MESSAGE += "\n";
		
		
		// -- Form values for Contact Info
		if (patch.CompanyName.value == "")
		{	MESSAGE += "\nPlease enter a Company Name.";		
			ERROR = true;	}
			
		if  ((patch.CompanyName.value != "") && (!anyLetter.test(patch.CompanyName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Company Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		if (patch.FirstName.value == "")
		{	MESSAGE += "\nPlease enter a First Name.";		
			ERROR = true;	}
			
		if  ((patch.FirstName.value != "") && (!anyLetter.test(patch.FirstName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"First Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.LastName.value == "")
		{	MESSAGE += "\nPlease enter a Last Name.";		
			ERROR = true;	}
			
		if  ((patch.LastName.value != "") && (!anyLetter.test(patch.LastName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Last Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.Address1.value == "")
		{	MESSAGE += "\nPlease enter an Address.";		
			ERROR = true;	}
			
		if  ((patch.Address1.value != "") && (!anyLetter.test(patch.Address1.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Address\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.City.value == "")
		{	MESSAGE += "\nPlease enter a City.";		
			ERROR = true;	}
			
		if  ((patch.City.value != "") && (!anyLetter.test(patch.City.value)))
		{
			MESSAGE += "\nPlease enter something in the \"City\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
			
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{5}/;
		//var onlyDigits = /\d/;
		
			
		
		if (patch.Zip.value == "")
		{	MESSAGE += "\nPlease enter a Zip.";		
			ERROR = true;	}
			
		if  ((patch.Zip.value != "") && (!anyLetter.test(patch.Zip.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Zip\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		
		
			
			if  ( (patch.Zip.value != "") && (!re.test(patch.Zip.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least five digits.";
				
								
				ERROR = true;
			}
		
		
		if ( patch.State.selectedIndex == 0 )
    	{
			MESSAGE += "\nPlease select a State.";
        	
        	ERROR = true;
    	}
		
		
		if (patch.Phone.value == "")
		{	MESSAGE += "\nPlease enter a Phone.";		
			ERROR = true;	}
			
		if  ((patch.Phone.value != "") && (!anyLetter.test(patch.Phone.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Phone\" field.  Using blanks are not allowed.";
			ERROR = true;
		}			
		
				
		
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		
		if (patch.Email.value == "")
		{
			MESSAGE += "\nPlease enter an Email.";		
			ERROR = true;
		}
		
				
		if ((patch.Email.value != "") &&(!myRegExp.test(patch.Email.value)))
		{
			MESSAGE += "\nYour email address is missing an '@' symbol.";		
			ERROR = true;
		}
		
		
		if ((patch.Email.value != "") && (!myRegExp2.test(patch.Email.value)))
		{
			MESSAGE += "\nYour email address is missing a '.' symbol.";		
			ERROR = true;
		}	
			
						
					
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);
	}
	
	
	
	function validate_patches()
	{
			
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;	
		var onlyDigits = /\d/;
		
		var MESSAGE = "";
		var ERROR = false;		
		
		
		
		// -- Form values for Quote
		var Referred = false;
		var NumberOfPatches = false;
		var ThreadColors = false;
		var Stitches = false;
		
		
		for (counter = 0; counter < patch.NumberOfPatches.length; counter++)
		{	if (patch.NumberOfPatches[counter].checked)
			NumberOfPatches = true; 	}		

		if (!NumberOfPatches)
		{	MESSAGE += "\nPlease select Quantity desired.";		
			ERROR = true;	}
		
		
		if (patch.PatchWidth.value == "")
		{	MESSAGE += "\nPlease enter a Patch Width.";		
			ERROR = true;	}
			
		if  ((patch.PatchWidth.value != "") && (!anyLetter.test(patch.PatchWidth.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Patch Width\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.PatchHeight.value == "")
		{	MESSAGE += "\nPlease enter a Patch Height.";		
			ERROR = true;	}
			
		if  ((patch.PatchHeight.value != "") && (!anyLetter.test(patch.PatchHeight.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Patch Height\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		for (counter = 0; counter < patch.ThreadColors.length; counter++)
		{	if (patch.ThreadColors[counter].checked)
			ThreadColors = true; 	}		

		if (!ThreadColors)
		{	MESSAGE += "\nPlease select Number of Colors.";		
			ERROR = true;	}
		
		
		for (counter = 0; counter < patch.Stitches.length; counter++)
		{	if (patch.Stitches[counter].checked)
			Stitches = true; 	}		

		if (!Stitches)
		{	MESSAGE += "\nPlease select Number of Stitches.";		
			ERROR = true;	}
		
		
		
		for (counter = 0; counter < patch.Referred.length; counter++)
		{	if (patch.Referred[counter].checked)
			Referred = true; 	}		

		if (!Referred)
		{	MESSAGE += "\nPlease tell us How You Heard About Us.";		
			ERROR = true;	}
		
		
		MESSAGE += "\n";
		
		
		// -- Form values for Contact Info
		if (patch.CompanyName.value == "")
		{	MESSAGE += "\nPlease enter a Company Name.";		
			ERROR = true;	}
			
		if  ((patch.CompanyName.value != "") && (!anyLetter.test(patch.CompanyName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Company Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.FirstName.value == "")
		{	MESSAGE += "\nPlease enter a First Name.";		
			ERROR = true;	}
			
		if  ((patch.FirstName.value != "") && (!anyLetter.test(patch.FirstName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"First Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.LastName.value == "")
		{	MESSAGE += "\nPlease enter a Last Name.";		
			ERROR = true;	}
			
		if  ((patch.LastName.value != "") && (!anyLetter.test(patch.LastName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Last Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.Address1.value == "")
		{	MESSAGE += "\nPlease enter an Address.";		
			ERROR = true;	}
			
		if  ((patch.Address1.value != "") && (!anyLetter.test(patch.Address1.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Address\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.City.value == "")
		{	MESSAGE += "\nPlease enter a City.";		
			ERROR = true;	}
			
		if  ((patch.City.value != "") && (!anyLetter.test(patch.City.value)))
		{
			MESSAGE += "\nPlease enter something in the \"City\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
			
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{5}/;
		//var onlyDigits = /\d/;
		
			
		
		if (patch.Zip.value == "")
		{	MESSAGE += "\nPlease enter a Zip.";		
			ERROR = true;	}
			
		if  ((patch.Zip.value != "") && (!anyLetter.test(patch.Zip.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Zip\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		
		
			
			if  ( (patch.Zip.value != "") && (!re.test(patch.Zip.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least five digits.";
				
								
				ERROR = true;
			}
		
		
		if ( patch.State.selectedIndex == 0 )
    	{
			MESSAGE += "\nPlease select a State.";
        	
        	ERROR = true;
    	}
		
		
		if (patch.Phone.value == "")
		{	MESSAGE += "\nPlease enter a Phone.";		
			ERROR = true;	}
			
		if  ((patch.Phone.value != "") && (!anyLetter.test(patch.Phone.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Phone\" field.  Using blanks are not allowed.";
			ERROR = true;
		}			
		
				
		
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		
		if (patch.Email.value == "")
		{
			MESSAGE += "\nPlease enter an Email.";		
			ERROR = true;
		}
		
				
		if ((patch.Email.value != "") &&(!myRegExp.test(patch.Email.value)))
		{
			MESSAGE += "\nYour email address is missing an '@' symbol.";		
			ERROR = true;
		}
		
		
		if ((patch.Email.value != "") && (!myRegExp2.test(patch.Email.value)))
		{
			MESSAGE += "\nYour email address is missing a '.' symbol.";		
			ERROR = true;
		}	
			
						
					
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);
	}
	
	
	
	
	function validate_catalogdownload()
	{
			
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;	
		var onlyDigits = /\d/;
		
		var MESSAGE = "";
		var ERROR = false;		
		

// -- Form values for Contact Info
		if (patch.CompanyName.value == "")
		{	MESSAGE += "\nPlease enter a Company Name.";		
			ERROR = true;	}
			
		if  ((patch.CompanyName.value != "") && (!anyLetter.test(patch.CompanyName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Company Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		if (patch.FirstName.value == "")
		{	MESSAGE += "\nPlease enter a First Name.";		
			ERROR = true;	}
		
		if  ((patch.FirstName.value != "") && (!anyLetter.test(patch.FirstName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"First Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (patch.LastName.value == "")
		{	MESSAGE += "\nPlease enter a Last Name.";		
			ERROR = true;	}
			
		if  ((patch.LastName.value != "") && (!anyLetter.test(patch.LastName.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Last Name\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		if (patch.Address1.value == "")
		{	MESSAGE += "\nPlease enter an Address.";		
			ERROR = true;	}
			
		if  ((patch.Address1.value != "") && (!anyLetter.test(patch.Address1.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Address\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
			
		if (patch.City.value == "")
		{	MESSAGE += "\nPlease enter a City.";		
			ERROR = true;	}
			
		if  ((patch.City.value != "") && (!anyLetter.test(patch.City.value)))
		{
			MESSAGE += "\nPlease enter something in the \"City\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
			
		var ZipPass = false;
		//var re = /\d{5}([\-]\d{4})/;
		var re = /\d{5}/;
		//var onlyDigits = /\d/;
		
			
		
		if (patch.Zip.value == "")
		{	MESSAGE += "\nPlease enter a Zip.";		
			ERROR = true;	}
			
		if  ((patch.Zip.value != "") && (!anyLetter.test(patch.Zip.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Zip\" field.  Using blanks are not allowed.";
			ERROR = true;	
			
			ZipPass = true;
		}
		
		
			
			if  ( (patch.Zip.value != "") && (!re.test(patch.Zip.value))  ) 
			{
				MESSAGE += "\nPlease only enter numeric digits from 0 - 9 for the zip code and at least five digits.";
				
								
				ERROR = true;
			}
			
			
		
		
		if ( patch.State.selectedIndex == 0 )
    	{
			MESSAGE += "\nPlease select a State.";
        	
        	ERROR = true;
    	}
		
		
		if (patch.Phone.value == "")
		{	MESSAGE += "\nPlease enter a Phone.";		
			ERROR = true;	}
			
		if  ((patch.Phone.value != "") && (!anyLetter.test(patch.Phone.value)))
		{
			MESSAGE += "\nPlease enter something in the \"Phone\" field.  Using blanks are not allowed.";
			ERROR = true;
		}			
		
				
		
		// -- Validate email
		var myRegExp = /@/;
		var myRegExp2 = /[.]/;
		
		
		if (patch.Email.value == "")
		{
			MESSAGE += "\nPlease enter an Email.";		
			ERROR = true;
		}
		
				
		if ((patch.Email.value != "") &&(!myRegExp.test(patch.Email.value)))
		{
			MESSAGE += "\nYour email address is missing an '@' symbol.";		
			ERROR = true;
		}
		
		
		if ((patch.Email.value != "") && (!myRegExp2.test(patch.Email.value)))
		{
			MESSAGE += "\nYour email address is missing a '.' symbol.";		
			ERROR = true;
		}	
						
		
		var Referred = false;

	for (counter = 0; counter < patch.Referred.length; counter++)
		{	if (patch.Referred[counter].checked)
			Referred = true; 	}		

		if (!Referred)
		{	MESSAGE += "\nPlease tell us How You Heard About Us.";		
			ERROR = true;	}
		
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);
	}
	
	
		
	
	function CheckShippingSameAsBilling()
	{
		if (form1.ShippingSame.checked)
		{
			//alert("Shipping and Billing is same.");
			
			form1.Shippingfirstname.value = form1.Billingfirstname.value;			
			form1.ShippingLastname.value = form1.BillingLastname.value;
			form1.ShippingAddress.value = form1.BillingAddress.value;
			form1.ShippingAddress2.value = form1.BillingAddress2.value;
			form1.ShippingCity.value = form1.BillingCity.value;
			form1.ShippingState.value = form1.BillingState.value;
			form1.ShippingZip.value = form1.BillingZip.value;
		}
		
		else
		{
			//alert("Not same.");
			
			form1.Shippingfirstname.value = "";			
			form1.ShippingLastname.value = "";
			form1.ShippingAddress.value = "";
			form1.ShippingAddress2.value = "";
			form1.ShippingCity.value = "";
			form1.ShippingState.value = "";
			form1.ShippingZip.value = "";
		}
	}
	
	
	
	function  pooch_Payment()
	{
		// set var radio_choice to false					
		var MESSAGE = "";
		var ERROR = false;
		
		var anyLetter = /\w/;
	
		var onlyDigits = /\d/;
		
		
		// -- Form values for Billing
		if (form1.nameoncard.value == "")
		{	MESSAGE += "\nPlease enter a name on the card.";		
			ERROR = true;	}
		
		
		if  ((form1.nameoncard.value != "") && (!anyLetter.test(form1.nameoncard.value)))
		{
			MESSAGE += "\nPlease enter something in the \"name on the card\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		if (form1.creditcardnumber.value == "")
		{	MESSAGE += "\nPlease enter a credit card number.";		
			ERROR = true;	}
			
		if  ((form1.creditcardnumber.value != "") && (!anyLetter.test(form1.creditcardnumber.value)))
		{
			MESSAGE += "\nPlease enter something in the \"credit card number\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
				
		if ( form1.cardtype.selectedIndex == 0 )
    	{
			MESSAGE += "\nPlease select a card type.";
        	
        	ERROR = true;
    	}
		
		
		if ( form1.selectexpmonth.selectedIndex == 0 )
    	{
			MESSAGE += "\nPlease select a month.";
        	
        	ERROR = true;
    	}
		
		
		if ( form1.selectexpyear.selectedIndex == 0 )
    	{
			MESSAGE += "\nPlease select a year.";
        	
        	ERROR = true;
    	}
		
		

		var cctype = form1.cardtype.value;
		var ccnum = form1.creditcardnumber.value;
		
		if ( cctype != "" && ccnum != "" )
		{
			if (checkCreditCard(ccnum, cctype))
			{
				//MESSAGE += "\nCredit card is good";
				
			}
			
			else
			{
				//MESSAGE += "\n" + ccnum + " does not appear to be a valid number for " + cctype;
				MESSAGE += "\n" + "Credit card does not appear to be a valid.";
				ERROR = true;
			}
		
		}
		
		
		if (form1.ccsecurity.value == "")
		{	MESSAGE += "\nPlease enter the credit card security code.";		
			ERROR = true;	}
			
		if  ((form1.ccsecurity.value != "") && (!anyLetter.test(form1.ccsecurity.value)))
		{
			MESSAGE += "\nPlease enter something in the \"credit card number\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		
		
		/*
		if (form1.expirationdate.value == "")
		{	MESSAGE += "\nPlease enter an expiration date.";		
			ERROR = true;	}
			
		if  ((form1.expirationdate.value != "") && (!anyLetter.test(form1.expirationdate.value)))
		{
			MESSAGE += "\nPlease enter something in the \"expiration date\" field.  Using blanks are not allowed.";
			ERROR = true;
		}
		*/
		
		
		
		if (ERROR)
		{
			alert(MESSAGE);
			return (false);		}			

		return (true);
	
	}
	
	
	
	function CHECK_IT23()
	{
		if (form1.checkbox23_a.checked)
		{
			
			document.form1.checkbox23_b.disabled = true;
			document.form1.checkbox23_c.disabled = true;
			document.form1.checkbox23_d.disabled = true;
			document.form1.checkbox23_e.disabled = true;
			document.form1.checkbox23_f.disabled = true;
			document.form1.checkbox23_g.disabled = true;
		}
		
		else if (!form1.checkbox23_a.checked)
		{

			document.form1.checkbox23_b.disabled = false;
			document.form1.checkbox23_c.disabled = false;
			document.form1.checkbox23_d.disabled = false;
			document.form1.checkbox23_e.disabled = false;			
			document.form1.checkbox23_f.disabled = false;			
			document.form1.checkbox23_g.disabled = false;			
		}
		
		
	}	
	
	
	// -- For Credit Card Validation
	/*************************************************************************\
	boolean isExpiryDate([int year, int month])
	return true if the date is a valid expiry date,
	else return false.
	\*************************************************************************/
	function isExpiryDate() {
	var argv = isExpiryDate.arguments;
	var argc = isExpiryDate.arguments.length;
	
	year = argc > 0 ? argv[0] : this.year;
	month = argc > 1 ? argv[1] : this.month;
	
	if (!isNum(year+""))
	return false;
	if (!isNum(month+""))
	return false;
	today = new Date();
	expiry = new Date(year, month);
	if (today.getTime() > expiry.getTime())
	return false;
	else
	return true;
	}
	
	
	
	function checkCreditCard (cardnumber, cardname) {
     
  // Array to hold the permitted card characteristics
  var cards = new Array();

  // Define the cards we support. You may add addtional card types.
  
  //  Name:      As in the selection box of the form - must be same as user's
  //  Length:    List of possible valid lengths of the card number for the card
  //  prefixes:  List of possible prefixes for the card
  //  checkdigit Boolean to say whether there is a check digit
  
  cards [0] = {name: "Visa", 
               length: "13,16", 
               prefixes: "4",
               checkdigit: true};
  cards [1] = {name: "MasterCard", 
               length: "16", 
               prefixes: "51,52,53,54,55",
               checkdigit: true};
  cards [2] = {name: "DinersClub", 
               length: "14,16", 
               prefixes: "300,301,302,303,304,305,36,38,55",
               checkdigit: true};
  cards [3] = {name: "CarteBlanche", 
               length: "14", 
               prefixes: "300,301,302,303,304,305,36,38",
               checkdigit: true};
  cards [4] = {name: "AmEx", 
               length: "15", 
               prefixes: "34,37",
               checkdigit: true};
  cards [5] = {name: "Discover", 
               length: "16", 
               prefixes: "6011,650",
               checkdigit: true};
  cards [6] = {name: "JCB", 
               length: "15,16", 
               prefixes: "3,1800,2131",
               checkdigit: true};
  cards [7] = {name: "enRoute", 
               length: "15", 
               prefixes: "2014,2149",
               checkdigit: true};
  cards [8] = {name: "Solo", 
               length: "16,18,19", 
               prefixes: "6334, 6767",
               checkdigit: true};
  cards [9] = {name: "Switch", 
               length: "16,18,19", 
               prefixes: "4903,4905,4911,4936,564182,633110,6333,6759",
               checkdigit: true};
  cards [10] = {name: "Maestro", 
               length: "12,13,14,15,16,18", 
               prefixes: "5018,5020,5038,6304,6759,6761",
               checkdigit: true};
  cards [11] = {name: "VisaElectron", 
               length: "16", 
               prefixes: "417500,4917,4913",
               checkdigit: true};
               
  // Establish card type
  var cardType = -1;
  for (var i=0; i<cards.length; i++) {

    // See if it is this card (ignoring the case of the string)
    if (cardname.toLowerCase () == cards[i].name.toLowerCase()) {
      cardType = i;
      break;
    }
  }
  
  // If card type not found, report an error
  if (cardType == -1) {
     ccErrorNo = 0;
     return false; 
  }
   
  // Ensure that the user has provided a credit card number
  if (cardnumber.length == 0)  {
     ccErrorNo = 1;
     return false; 
  }
    
  // Now remove any spaces from the credit card number
  cardnumber = cardnumber.replace (/\s/g, "");
  
  // Check that the number is numeric
  var cardNo = cardnumber
  var cardexp = /^[0-9]{13,19}$/;
  if (!cardexp.exec(cardNo))  {
     ccErrorNo = 2;
     return false; 
  }
       
  // Now check the modulus 10 check digit - if required
  if (cards[cardType].checkdigit) {
    var checksum = 0;                                  // running checksum total
    var mychar = "";                                   // next char to process
    var j = 1;                                         // takes value of 1 or 2
  
    // Process each digit one by one starting at the right
    var calc;
    for (i = cardNo.length - 1; i >= 0; i--) {
    
      // Extract the next digit and multiply by 1 or 2 on alternative digits.
      calc = Number(cardNo.charAt(i)) * j;
    
      // If the result is in two digits add 1 to the checksum total
      if (calc > 9) {
        checksum = checksum + 1;
        calc = calc - 10;
      }
    
      // Add the units element to the checksum total
      checksum = checksum + calc;
    
      // Switch the value of j
      if (j ==1) {j = 2} else {j = 1};
    } 
  
    // All done - if checksum is divisible by 10, it is a valid modulus 10.
    // If not, report an error.
    if (checksum % 10 != 0)  {
     ccErrorNo = 3;
     return false; 
    }
  }  

  // The following are the card-specific checks we undertake.
  var LengthValid = false;
  var PrefixValid = false; 
  var undefined; 

  // We use these for holding the valid lengths and prefixes of a card type
  var prefix = new Array ();
  var lengths = new Array ();
    
  // Load an array with the valid prefixes for this card
  prefix = cards[cardType].prefixes.split(",");
      
  // Now see if any of them match what we have in the card number
  for (i=0; i<prefix.length; i++) {
    var exp = new RegExp ("^" + prefix[i]);
    if (exp.test (cardNo)) PrefixValid = true;
  }
      
  // If it isn't a valid prefix there's no point at looking at the length
  if (!PrefixValid) {
     ccErrorNo = 3;
     return false; 
  }
    
  // See if the length is valid for this card
  lengths = cards[cardType].length.split(",");
  for (j=0; j<lengths.length; j++) {
    if (cardNo.length == lengths[j]) LengthValid = true;
  }
  
  // See if all is OK by seeing if the length was valid. We only check the 
  // length if all else was hunky dory.
  if (!LengthValid) {
     ccErrorNo = 4;
     return false; 
  };   
  
  // The credit card is in the required format.
  return true;
}
