// JavaScript Document

<!--
//Code for displaying input errors above the form

	var W3CDOM = (document.createElement && document.getElementsByTagName && document.createTextNode);   //Check browser's DOM support 
	var isFormValid;
	var errMsg;
	var errList;
	var arrErrLabels;

	//replace email node based on country
	function eNode(form)
	{
		var country = form.country_origin.value;
		// Americas
		if ( country == "US" || country == "CA" || country == "SV" || country == "GT" || country == "HN" || country == "MX" 
		|| country == "NI" || country == "AR" || country == "BO" || country == "BR" || country == "CL" || country == "CO" 
		|| country == "EC" || country == "GY" || country == "PY" || country == "PE" || country == "UY" || country == "VE" 
		|| country == "BS" || country == "DO" || country == "HT" || country == "TT" || country == "BM" || country == "BB"
		|| country == "BZ" || country == "KY" || country == "CR" || country == "GF" || country == "GD" || country == "GU"
		|| country == "JM" || country == "MH" || country == "PA" || country == "PR" || country == "UM" || country == "VI")
 		{
 			form.send_to.value = 1099;
  		}
		
		//EMEA
		if ( country == "BI" || country == "CM" || country == "CF" || country == "TD" || country == "CG" || country == "CD" 
		|| country == "GQ" || country == "RW" || country == "ER" || country == "ET" || country == "KE" || country == "SO" 
		|| country == "TZ" || country == "UG" || country == "BF" || country == "CI" || country == "GH" || country == "GN" 
		|| country == "GW" || country == "LR" || country == "MR" || country == "NE" || country == "NG" || country == "SN" 
		|| country == "SL" || country == "TG" || country == "CZ" || country == "RO" || country == "EE" || country == "LV" 
		|| country == "LT" || country == "AT" || country == "BE" || country == "FI" || country == "FR" || country == "DE" 
		|| country == "IE" || country == "IT" || country == "PT" || country == "ES" || country == "SE" || country == "CH" 
		|| country == "GB" || country == "AM" || country == "AZ" || country == "BY" || country == "GE" || country == "KZ" 
		|| country == "KG" || country == "MD" || country == "RU" || country == "TJ" || country == "TM" || country == "UA" 
		|| country == "UZ" || country == "AL" || country == "BA" || country == "BG" || country == "HR" || country == "CY" 
		|| country == "GR" || country == "MK" || country == "MT" || country == "SI" || country == "TR" || country == "BH" 
		|| country == "IL" || country == "JO" || country == "KW" || country == "LB" || country == "SA" || country == "AE" 
		|| country == "YE" || country == "DZ" || country == "AN" || country == "EG" || country == "MA" || country == "TN"
		|| country == "NL" || country == "NO" || country == "AS" || country == "BJ" || country == "AW" || country == "DK"
		|| country == "PF" || country == "TF" || country == "GA" || country == "GM" || country == "GI" || country == "VA"
		|| country == "IS" || country == "LS" || country == "LI" || country == "LU" || country == "MQ" || country == "MC"
		|| country == "QA" || country == "RE" || country == "VG" || country == "YU")
 		{
 			form.send_to.value = 1097;
  		}
		// South Africa
		if ( country == "AO" || country == "MW" || country == "MZ" || country == "NA" || country == "ZA" || country == "SZ"
		|| country == "ZM" || country == "ZW" || country == "AD" || country == "BW" || country == "BV" || country == "CV" 
		|| country == "KM" || country == "DJ" || country == "MG" || country == "ML" || country == "YT")
 		{
 			form.send_to.value = 1101;
  		}

		//APJ-North  
		if ( country == "CN" || country == "JP" || country == "MN" || country == "KR" || country == "TW" || country == "BN" 
		|| country == "KH" || country == "AF" || country == "BD" || country == "BT" || country == "MV" || country == "NP" 
		|| country == "PK" || country == "LK" || country == "FJ" || country == "PG" || country == "SB"  )
 		{
 			form.send_to.value = 1100;

  		}
		
		//APJ-Southeast Asia  
		if ( country == "ID" || country == "MY" || country == "PH" || country == "SG" || country == "NU"
		|| country == "TH" || country == "VN" || country == "IN" || country == "AU" || country == "NZ" || country == "HK"
		|| country == "MO" || country == "NR")
 		{
 			form.send_to.value = 1098;
		}

		
		//Poland
		if ( country == "PL" )
 		{
 			form.send_to.value = 1096;
  		}
		
		//Hungary
		if ( country == "HU" )
 		{
 			form.send_to.value = 1163;
  		}
		
		//Slovakia
		if ( country == "SK" )
 		{
 			form.send_to.value = 1095;
  		}
		
	}
	
	// Jump to top of page on error
	
	// Redirect on slecting 'Yes'
	function reDir(oInput)
	{
		switch (oInput)
		{
			case 1 :
			window.location = "pe_reg_error.html";
			break;
		}
	}
	
	
	// Check whether a string is empty
	function IsEmpty(s)
	{
		return( (s == null) || (s.length == 0) )
	}

	// Check email address validity
	function IsEmailAddr(email)
	{
		var check = /^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/;

		if ( check.test(email) )
			return true;
		else
			return false;
	}

	// Check invalid characters in user input
	function IsInvalidInput(badChars, userInput)
	{
		var re = new RegExp(badChars);

		if ( re.test(userInput) )
			return true;
		else
			return false;
	}


	// Validate the form values
	function FormValidator(theForm)
	{
		isFormValid = true;
		errMsg = "";

		HidePreviousErrors();
		
		// START WHITE SPACE CHECK - Added 20060206		
		var temp_first_name = theForm.first_name.value;
		var temp_last_name = theForm.last_name.value;
		temp_first_name = temp_first_name.replace(new RegExp(/^\s+/),"");
		temp_last_name = temp_last_name.replace(new RegExp(/^\s+/),"");
		// END WHITE SPACE CHECK
		
		//check for valid date
		var right_now = new Date();
		var the_year = right_now.getFullYear();
		var the_month = right_now.getMonth()+ 1;
		var the_day = right_now.getDate();
		
		
		if ( IsEmpty(theForm.OPT_purchase_direct.value) )
		{
			AddError(theForm.OPT_purchase_direct, "Did you purchase your Software directly from HP?");
		}
		if ( IsEmpty(theForm.OPT_purchase_support.value) )
		{
			AddError(theForm.OPT_purchase_support, "Did you purchase an additional 3 year support upgrade from HP?");
		}
		//Month check
		if ( IsEmpty(theForm.OPT_month.value) )
		{
			AddError(theForm.OPT_month, "Month is required");
		}
		
		if (theForm.OPT_year.value == the_year && theForm.OPT_month.value > the_month )
		{
			AddError(theForm.OPT_month, "Purchase month is not valid.  Month must be current or previous month");
		}
		
		//Day check
		if ( IsEmpty(theForm.OPT_day.value) )
		{
			AddError(theForm.OPT_day, "Day is required");
		}
		
		if (theForm.OPT_month.value == the_month && theForm.OPT_day.value > the_day && theForm.OPT_year.value == the_year )
		{
			AddError(theForm.OPT_day, "Purchase date must be on or before today's date");
		}  
			
		
		//Year check
		if ( IsEmpty(theForm.OPT_year.value) )
		{
			AddError(theForm.OPT_year, "Year is required");
		}
		
		if (theForm.OPT_year.value > the_year )
		{
			AddError(theForm.OPT_year, "Purchase year is not valid. Year must be current");
		}  
		
		//correct date selection check 
		if ( theForm.OPT_month.value == 2 && theForm.OPT_day.value == 29 && theForm.OPT_year.value < 2009 )
		{
			AddError(theForm.OPT_year, "Purchase day is not valid for selected month in selected year");
		}  
		
		if (theForm.OPT_day.value > 29 && theForm.OPT_month.value == 2 )
		{
			AddError(theForm.OPT_year, "Purchase day is not valid for selected month");
		}  
		
		if ( theForm.OPT_day.value > 30 && theForm.OPT_month.value == 4 )
		{
			AddError(theForm.OPT_year, "Purchase day is not valid for selected month");
		}  
		
		if ( theForm.OPT_day.value > 30 && theForm.OPT_month.value == 6 )
		{
			AddError(theForm.OPT_year, "Purchase day is not valid for selected month");
		}  
		
		if ( theForm.OPT_day.value > 30 && theForm.OPT_month.value == 9 )
		{
			AddError(theForm.OPT_year, "Purchase day is not valid for selected month");
		}  
		
		if ( theForm.OPT_day.value > 30 && theForm.OPT_month.value == 11 )
		{
			AddError(theForm.OPT_year, "Purchase day is not valid for selected month");
		}  
		
		     	
		if (theForm.OPT_purchase_direct.value == "Yes" )
		{
			AddError(theForm.OPT_purchase_direct, "If you purchased directly from HP, you do not need to register for support, this will be done automatically for you.");
		}
			
	// Check for product quantity	
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_459864_B21.value) )
		{
			 AddError(theForm.OPT_459864_B21, "Product quantity can only be a number");
		}		
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_459865_B21.value) )
		{
			 AddError(theForm.OPT_459865_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_459866_B21.value) )
		{
			 AddError(theForm.OPT_459866_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_459867_B21.value) )
		{
			 AddError(theForm.OPT_459867_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_459868_B21.value) )
		{
			 AddError(theForm.OPT_459868_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_459869_B21.value) )
		{
			 AddError(theForm.OPT_459869_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452145_B21.value) )
		{
			 AddError(theForm.OPT_452145_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452146_B21.value) )
		{
			 AddError(theForm.OPT_452146_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_442936_B21.value) )
		{
			 AddError(theForm.OPT_442936_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_442937_B21.value) )
		{
			 AddError(theForm.OPT_442937_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_442947_B21.value) )
		{
			 AddError(theForm.OPT_442947_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452155_B21.value) )
		{
			 AddError(theForm.OPT_452155_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452156_B21.value) )
		{
			 AddError(theForm.OPT_452156_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452157_B21.value) )
		{
			 AddError(theForm.OPT_452157_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_441604_B21.value) )
		{
			 AddError(theForm.OPT_441604_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_441604_B22.value) )
		{
			 AddError(theForm.OPT_441604_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_441908_B21.value) )
		{
			 AddError(theForm.OPT_441908_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_441908_B22.value) )
		{
			 AddError(theForm.OPT_441908_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452148_B21.value) )
		{
			 AddError(theForm.OPT_452148_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452149_B21.value) )
		{
			 AddError(theForm.OPT_452149_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452676_B21.value) )
		{
			 AddError(theForm.OPT_452676_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_453484_B21.value) )
		{
			 AddError(theForm.OPT_453484_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_453485_B21.value) )
		{
			 AddError(theForm.OPT_453485_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_436747_B22.value) )
		{
			 AddError(theForm.OPT_436747_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_436749_B22.value) )
		{
			 AddError(theForm.OPT_436749_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_436751_B22.value) )
		{
			 AddError(theForm.OPT_436751_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_436753_B22.value) )
		{
			 AddError(theForm.OPT_436753_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_417688_B22.value) )
		{
			 AddError(theForm.OPT_417688_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_439034_B22.value) )
		{
			 AddError(theForm.OPT_439034_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_403321_B22.value) )
		{
			 AddError(theForm.OPT_403321_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_412136_B22.value) )
		{
			 AddError(theForm.OPT_412136_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_403319_B22.value) )
		{
			 AddError(theForm.OPT_403319_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452677_B21.value) )
		{
			 AddError(theForm.OPT_452677_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452678_B21.value) )
		{
			 AddError(theForm.OPT_452678_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452151_B21.value) )
		{
			 AddError(theForm.OPT_452151_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452152_B21.value) )
		{
			 AddError(theForm.OPT_452152_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452153_B21.value) )
		{
			 AddError(theForm.OPT_452153_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452154_B21.value) )
		{
			 AddError(theForm.OPT_452154_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_417688_B21.value) )
		{
			 AddError(theForm.OPT_417688_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_439034_B21.value) )
		{
			 AddError(theForm.OPT_439034_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_437504_B21.value) )
		{
			 AddError(theForm.OPT_437504_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_403321_B21.value) )
		{
			 AddError(theForm.OPT_403321_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_412136_B21.value) )
		{
			 AddError(theForm.OPT_412136_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_403319_B21.value) )
		{
			 AddError(theForm.OPT_403319_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_512487_B21.value) )
		{
			 AddError(theForm.OPT_512487_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452143_B21.value) )
		{
			 AddError(theForm.OPT_452143_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452160_B21.value) )
		{
			 AddError(theForm.OPT_452160_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_453897_B21.value) )
		{
			 AddError(theForm.OPT_453897_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452165_B21.value) )
		{
			 AddError(theForm.OPT_452165_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_442939_B21.value) )
		{
			 AddError(theForm.OPT_442939_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_437786_B22.value) )
		{
			 AddError(theForm.OPT_437786_B22, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452147_B21.value) )
		{
			 AddError(theForm.OPT_452147_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452166_B21.value) )
		{
			 AddError(theForm.OPT_452166_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_452150_B21.value) )
		{
			 AddError(theForm.OPT_452150_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_455341_B21.value) )
		{
			 AddError(theForm.OPT_455341_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_455344_B21.value) )
		{
			 AddError(theForm.OPT_455344_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_483528_B21.value) )
		{
			 AddError(theForm.OPT_483528_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_483529_B21.value) )
		{
			 AddError(theForm.OPT_483529_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_483543_B21.value) )
		{
			 AddError(theForm.OPT_483543_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_512279_B21.value) )
		{
			 AddError(theForm.OPT_512279_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_512451_B21.value) )
		{
			 AddError(theForm.OPT_512451_B21, "Product quantity can only be a number");
		}
		if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\.#!@$%&,()^-_+=?><{}\"':;]", theForm.OPT_512491_B21.value) )
		{
			 AddError(theForm.OPT_512491_B21, "Product quantity can only be a number");
		}
		
		
		
		
		if (theForm.OPT_459864_B21.value == "" && theForm.OPT_459865_B21.value == "" && theForm.OPT_459866_B21.value== "" && theForm.OPT_459867_B21.value == "" && theForm.OPT_459868_B21.value == "" && theForm.OPT_459869_B21.value == "" && theForm.OPT_452145_B21.value == "" && theForm.OPT_452146_B21.value == "" && theForm.OPT_442936_B21.value == "" && theForm.OPT_442937_B21.value == "" && theForm.OPT_442947_B21.value == "" && theForm.OPT_452155_B21.value == "" && theForm.OPT_452156_B21.value == "" && theForm.OPT_452157_B21.value == "" && theForm.OPT_441604_B21.value == "" && theForm.OPT_441604_B22.value == "" && theForm.OPT_441908_B21.value == "" && theForm.OPT_441908_B22.value == "" && theForm.OPT_452148_B21.value == "" && theForm.OPT_452149_B21.value == "" && theForm.OPT_452676_B21.value == "" && theForm.OPT_453484_B21.value == "" && theForm.OPT_453485_B21.value == "" && theForm.OPT_436747_B22.value == "" && theForm.OPT_436749_B22.value == "" && theForm.OPT_436751_B22.value == "" && theForm.OPT_436753_B22.value == "" && theForm.OPT_417688_B22.value == "" && theForm.OPT_439034_B22.value == "" && theForm.OPT_403321_B22.value == "" && theForm.OPT_412136_B22.value == "" && theForm.OPT_403319_B22.value == "" && theForm.OPT_452677_B21.value == "" && theForm.OPT_452678_B21.value == "" && theForm.OPT_452151_B21.value == "" && theForm.OPT_452152_B21.value == "" && theForm.OPT_452153_B21.value == "" && theForm.OPT_452154_B21.value == "" && theForm.OPT_417688_B21.value == "" && theForm.OPT_439034_B21.value == "" && theForm.OPT_437504_B21.value == "" && theForm.OPT_403321_B21.value == "" && theForm.OPT_412136_B21.value == "" && theForm.OPT_403319_B21.value == "" && theForm.OPT_512487_B21.value == "" && theForm.OPT_452143_B21.value == "" && theForm.OPT_452160_B21.value == "" && theForm.OPT_453897_B21.value == "" && theForm.OPT_452165_B21.value == "" && theForm.OPT_442939_B21.value == "" && theForm.OPT_437786_B22.value == "" && theForm.OPT_452147_B21.value == "" && theForm.OPT_452166_B21.value == "" && theForm.OPT_452150_B21.value == "" && theForm.OPT_455341_B21.value == "" && theForm.OPT_455344_B21.value == "" && theForm.OPT_483528_B21.value == "" && theForm.OPT_483529_B21.value == "" && theForm.OPT_483543_B21.value == "" && theForm.OPT_512279_B21.value == "" && theForm.OPT_512451_B21.value == "" && theForm.OPT_512491_B21.value == "" )
	   	{
			AddError(theForm.OPT_459864_B21, "Please complete the quantity field for at least one product");
		}
		
		
		if ( IsEmpty(temp_first_name) )
		{
			AddError(theForm.first_name, "First name is required");
		}
		else if ( IsInvalidInput("[~!#`@\"&\r\n\^\|<>%&\\\\]", temp_first_name) )
		{
			AddError(theForm.first_name, "First name is not valid");
		}

		if ( IsEmpty(temp_last_name) )
		{
			AddError(theForm.last_name, "Last name is required");
		}
		else if ( IsInvalidInput("[~!#`@\"&\r\n\^\|<>%&\\\\]", temp_last_name) )
		{
			AddError(theForm.last_name, "Last name is not valid");
		}

		// if phone exist check if is valid
		if ( IsEmpty(theForm.OPT_phone_number.value) )
		{
			AddError(theForm.OPT_phone_number, "Phone number is required");
		}
		else if ( IsInvalidInput("[abcdefghijklmnopqrstuvwxyz~`*|\]", theForm.OPT_phone_number.value) )
		{
			AddError(theForm.OPT_phone_number, "Phone number contains invalid characters");
		}
		
		if ( IsEmpty(theForm.email_address.value) )
		{
			AddError(theForm.email_address, "Email address is required");
		}
		else if ( !IsEmailAddr(theForm.email_address.value) )
		{
			AddError(theForm.email_address, "Email address is not valid");
		}
		
		if ( IsEmpty(theForm.OPT_email_address_confirm.value) )
		{
			AddError(theForm.OPT_email_address_confirm, "Confirming the Email address is required");
		}
		else if ( !IsEmailAddr(theForm.OPT_email_address_confirm.value) )
		{
			AddError(theForm.OPT_email_address_confirm, "Confirmed Email address is not valid");
		}
		
		// Check for confirmed email address
		if (theForm.email_address.value != theForm.OPT_email_address_confirm.value)
		{
			AddError(theForm.OPT_email_address_confirm, "Email address entered does not match");
		}
				
		if ( IsEmpty(theForm.OPT_company.value) )
		{
			AddError(theForm.OPT_company, "Company Name is required");
		}
		
		if ( IsEmpty(theForm.OPT_address.value) )
		{
			AddError(theForm.OPT_address, "Equipment Location Street Address is required");
		}
		
		if ( IsEmpty(theForm.OPT_city.value) )
		{
			AddError(theForm.OPT_city, "Equipment Location City is required");
		}
		
		if ( IsEmpty(theForm.OPT_zip_code.value) )
		{
			AddError(theForm.OPT_zip_code, "Zip/Postal Code is required");
		}
		
		if ( IsEmpty(theForm.country_origin.value) )
		{
			AddError(theForm.country_origin, "Country or Region is required");
		}
		
		if (isFormValid)
		{
			return true;
		}
		else window.location = String(window.location).replace(/\#.*$/, "") + "#top";
		{
		    if (!W3CDOM)
		    {
			    errMsg = "Please correct the following error(s): \n" + errMsg;
			    alert( errMsg );   // Display javascript popup only if the browser does not support W3C DOM
		    }
		    else
			{
				var errDiv = document.getElementById('err_display');
				var errSpan = document.getElementById('err_fields');

				if ( errSpan.hasChildNodes() )
				{
					errSpan.replaceChild( errList, errSpan.firstChild );   // We have already displayed some errors so replace the old ones
				}
				else
				{
					errSpan.appendChild( errList);   // This is the first time form was submitted
					errSpan.appendChild( document.createElement("br") );   // Add some extra spacing
				}

				errDiv.style.visibility = 'visible';
			}
			return false;
		}
	}

	// DHTML code to add bulleted list of errors
	function AddError(theObj, message)
	{
		if (!W3CDOM)
		{
			errMsg += " - " + message + "\n";   // For non-supporting browsers
		}
		else
		{
			if (isFormValid)
			{
				errList = document.createElement("ul");   // Create a UL tag only once per form submit
				errList.className = 'bulletlist';
			}
			
			var item = document.createElement("li");
			item.appendChild( document.createTextNode(message) );
			errList.appendChild( item );

			var nodeTR = theObj.parentNode.parentNode;
			var nodeTD = nodeTR.getElementsByTagName("td")[1];   // Get the TD node that contains field label
			nodeTD.className = "error";

			arrErrLabels[arrErrLabels.length] = nodeTD;   // Store TD node in global array so that error class can be removed before the next pass. push() method of array object does not work in IE 5.
		}

		isFormValid = false;
	}

	// DHTML code to remove error class from field labels
	function HidePreviousErrors()
	{
		if (arrErrLabels)
		{
			var arrLen = arrErrLabels.length;
			for (var i=0; i<arrLen; i++)
			{
				arrErrLabels[i].className = "";
			}

			var errDiv = document.getElementById('err_display');
			errDiv.style.visibility = 'hidden';
		}

		arrErrLabels = null;
		arrErrLabels = new Array();
	}


//-->