//June 25, 2007 
//String Trim
function trim(strVar) 
{ 
     if(strVar.length >0)
	 {
	        while(strVar.charAt(0)==" ") 
			strVar=strVar.substring(1,strVar.length); 
			while(strVar.charAt(strVar.length-1)==" ") 
			strVar=strVar.substring(0,strVar.length-1); 			
	 }
	 return strVar; 
}
//Check empty field
function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (trim(formField.value) == "")
	{
		alert(fieldLabel);
		formField.value="";
		formField.focus();
		result = false;
	}
	
	return result;
}
// Email Validation
function checkEmail(myForm,mess)
{
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.value))
 {
	return (true)
 }
	alert(mess);
	myForm.focus();
	return (false)
}

//For phone field
function isNotNumeric(str)
{
		for (var i = 0; i < str.length; i++)
		{
				var ch = str.substring(i, i + 1);
				if((ch < '0' || '9' < ch)) 
				{
					if(ch == "+" || ch == "-" || ch == "." || ch == ")" || ch == "("  || ch == " ") continue;
					return true;
				}
		}
		return false;
}

//For first name / last name
function isNotAlphabets(str){
		for (var i = 0; i < str.length; i++)
		{
				re = / /gi				//Replace the space between words with no space
				str = str.replace(re,"");
			
				var ch = str.substring(i, i + 1);
				if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
				{
					return true;
				}
		}
		return false;
}
		
function checkForm(nForm) 
{
	if (!validRequired(nForm.txtFirstName,"Please enter First Name."))
		return false;
		
		if (trim(nForm.txtFirstName.value) != "")
		{
			if(isNotAlphabets(trim(nForm.txtFirstName.value)))
			{
				alert("Invalid characters in first name.");
				nForm.txtFirstName.focus();	
				return false;
			}
		}
		
	if (!validRequired(nForm.txtLastName,"Please enter Last Name."))
		return false;

		if (trim(nForm.txtLastName.value) != "")
		{
			if(isNotAlphabets(trim(nForm.txtLastName.value)))
			{
				alert("Invalid characters in last name.");
				nForm.txtLastName.focus();	
				return false;
			}
		}
				
		
	if (!validRequired(nForm.txtTitle,"Please enter Title."))
		return false;
	if (!validRequired(nForm.txtCompany,"Please enter Company."))
		return false;
	
	if (!validRequired(nForm.txtBusinessAdd1,"Please enter Business Address 1"))
		return false;
	if (!validRequired(nForm.txtBusinessAdd2,"Please enter Business Address 2"))
		return false;
	if (!validRequired(nForm.txtCity,"Please enter City."))
		return false;
	if (!validRequired(nForm.txtState,"Please enter State/Province."))
		return false;
	if (!validRequired(nForm.txtPostalCode,"Please enter Postal Code."))
		return false;
	if (!validRequired(nForm.cboCountry,"Please enter Country."))
		return false;
		
	//Phone	
	if (!validRequired(nForm.txtBusinessPhone,"Please enter Business Phone."))
		return false;
		
		if (trim(nForm.txtBusinessPhone.value) != "")
		{
			if(isNotNumeric(trim(nForm.txtBusinessPhone.value)))
			{
				alert("Invalid characters in phone number.");
				nForm.txtBusinessPhone.focus();	
				return false;
			}
		}
				
	//Fax	
	if (!validRequired(nForm.txtBusinessFax,"Please enter Business Fax."))
		return false;
		
		if (trim(nForm.txtBusinessFax.value) != "")
		{
			if(isNotNumeric(trim(nForm.txtBusinessFax.value)))
			{
				alert("Invalid characters in fax number.");
				nForm.txtBusinessFax.focus();	
				return false;
			}
		}		
		
		
	if (!checkEmail(nForm.txtEmail,"Please enter valid Email Address."))
		return false;
		
		emailid = nForm.txtEmail.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.') & emailid.indexOf('mail.');	
		
		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.txtEmail.focus();
			return false;
		}
		
		
	if (!validRequired(nForm.txtCompanyURL,"Please enter Company URL."))
		return false;


	flag_tech = 0;
	flag_service = 0;
	
	for(i=0;i<7;i++)
	{
		if(nForm.chkServicesOffered[i].checked==true)
		{
			flag_service = 1;
		}
	}	
	 
	for(j=0;j<7;j++)
	{
		if(nForm.chkTechnologyAvailable[j].checked==true)
		{
			flag_tech = 1;
		}
	}
	
	
	if((flag_service==1) && (flag_tech==1))
	{
			alert("You can only select options under Software Services OR Technology Available.");
			return false;
	}	
	
	return true;
}


function check_request_frm(nForm) 
{
		if (!validRequired(nForm.first_name,"Please enter your First Name."))
			return false;
			
		if (trim(nForm.first_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.first_name.value)))
			{
				alert("Invalid characters in first name.");
				nForm.first_name.focus();	
				return false;
			}
		}
			
			
		if (!validRequired(nForm.last_name,"Please enter your Last Name."))
			return false;
			
		if (trim(nForm.last_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.last_name.value)))
			{
				alert("Invalid characters in last name.");
				nForm.last_name.focus();	
				return false;
			}
		}			
			
		if (!validRequired(nForm.company,"Please enter your Company name."))
			return false;
		
 		if(document.getElementById("00N50000001NBRS").value ==	"")
 		{
 			alert("Please select your Region.");
 			document.getElementById("00N50000001NBRS").focus();
 			return false;
		}	
 	

		if (!checkEmail(nForm.email,"Please enter valid Email address."))
			return false;

		emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.') & emailid.indexOf('mail.');	
		
		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}
		
			
		if (trim(nForm.phone.value)!="")
		{
			if (isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in phone.");
				nForm.phone.focus();	
				return false;
			}
		}	 	
				 		
 		if(document.getElementById("00N50000001NBPY").value ==	"")
 		{
 			alert("Please select your Business.");
 			document.getElementById("00N50000001NBPY").focus();
 			return false;
		}	
	
		return true;
}

function check_openhouse_frm(nForm) 
{
		if (!validRequired(nForm.first_name,"Please enter your First Name."))
			return false;
			
		if (trim(nForm.first_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.first_name.value)))
			{
				alert("Invalid characters in first name.");
				nForm.first_name.focus();	
				return false;
			}
		}
			
			
		if (!validRequired(nForm.last_name,"Please enter your Last Name."))
			return false;
			
		if (trim(nForm.last_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.last_name.value)))
			{
				alert("Invalid characters in last name.");
				nForm.last_name.focus();	
				return false;
			}
		}			
			
		if (!checkEmail(nForm.email,"Please enter valid Email address."))
			return false;

		emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.');	
		
		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}
		
		r = 0;
		
		for(i=0;i<5;i++)
		{
			if(nForm.rate_service_experience[i].checked==false)
			{
				r += 1;
			}
				
			if(r == 5)
			{
				alert("Please select overall experience of the service.");
				nForm.rate_service_experience[0].focus();
				return false;
			}
		}
		
		
		
		return true;
}


function check_training_request_frm(nForm) 
{
		if (!validRequired(nForm.company,"Please enter your company name."))
			return false;

		if (!validRequired(nForm.contact_name,"Please enter contact name."))
			return false;
						
		if (trim(nForm.contact_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.contact_name.value)))
			{
				alert("Invalid characters in contact name.");
				nForm.contact_name.focus();	
				return false;
			}
		}
			
	//Phone	
	if (!validRequired(nForm.phone,"Please enter phone number."))
		return false;
		
		if (trim(nForm.phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in phone number.");
				nForm.phone.focus();	
				return false;
			}
		}

		
		if (!checkEmail(nForm.email,"Please enter valid Email address."))
			return false;

		emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.');	
		
		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}
		
	flag_relation = 0;
	flag_classes = 0;
	flag_class_location = 0;
	
	for(i=0;i<4;i++)
	{
		if(nForm.relationship[i].checked==true)
		{
			flag_relation = 1;
		}
	}	
		
	if(flag_relation == 0)
	{
		alert("Please select your relationship with us.");
		nForm.relationship[0].focus();	
		return false;
	}
	var len = nForm.classes.length;
	
	for(i=0;i<len;i++)
	{
		if(nForm.classes[i].checked==true)
		{
			flag_classes = 1;
		}
	}	
		
	if(flag_classes == 0)
	{
		alert("Please select Class(es) you would like to request.");
		nForm.classes[0].focus();	
		return false;
	}
	
	for(i=0;i<3;i++)
	{
		if(nForm.class_location[i].checked==true)
		{
			flag_class_location = 1;
		}
	}	
		
	if(flag_class_location == 0)
	{
		alert("Please select Class location.");
		nForm.class_location[0].focus();	
		return false;
	}
			

		if(nForm.class_location[0].checked == true)
		{
				//If my facility is checked
				if (!validRequired(nForm.myfacility_address,"Please enter address of your class location facility."))
					return false;
					
				if (!validRequired(nForm.myfacility_city,"Please enter city of your class location facility."))
					return false;
					
				if (!validRequired(nForm.myfacility_state,"Please enter state/province of your class location facility."))
					return false;
					
				if (!validRequired(nForm.myfacility_country,"Please enter country of your class location facility."))
					return false;
		}	
	
		if (!validRequired(nForm.class_start_date,"Please enter class start date."))
			return false;					
	
		if (!validRequired(nForm.alternative_class_start_date,"Please enter alternative class start date."))
			return false;					

		if (!validRequired(nForm.number_of_students,"Please enter number of students expected."))
			return false;					
		
		user_notes = nForm.user_notes.value;	
		
		if(user_notes.length>500)
		{
			alert("Can not input more than 500 characters.");
			nForm.user_notes.focus();	
			return false;
		}			
			
		flag_class_location = 0;
		
		if(nForm.class_location[0].checked == true)
		{
			
			for(i=0;i<2;i++)
			{
				if(nForm.my_facility[i].checked==true)
				{
					flag_class_location++;
				}
			}	
				
			if(flag_class_location < 2)
			{
				alert("Please confirm that the required items for classroom set-up will be made available.");
				nForm.my_facility[0].focus();	
				return false;
			}
			
		
			
		if (!validRequired(nForm.shipping_name,"Please enter name for shipping address."))
			return false;
						
		if (trim(nForm.shipping_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.shipping_name.value)))
			{
				alert("Invalid characters in shipping name.");
				nForm.shipping_name.focus();	
				return false;
			}
		}

			//If same as above then do not validate
		if(nForm.address_same_as_myfacility.checked==false)
		{
			if (!validRequired(nForm.shipping_address,"Please enter shipping address."))
				return false;
		}
						
	//Phone	
	if (!validRequired(nForm.shipping_phone,"Please enter shipping phone number."))
		return false;
		
		if (trim(nForm.shipping_phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.shipping_phone.value)))
			{
				alert("Invalid characters in shipping phone number.");
				nForm.shipping_phone.focus();	
				return false;
			}
		}
		
				
			
		}	
			
				
		return true;
}


// CTIA09_2.html Form validation

function check_CTIA09_2_frm(nForm) 
{

	if (!validRequired(nForm.first_name,"Please enter First Name."))
		return false;
		
		if (trim(nForm.first_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.first_name.value)))
			{
				alert("Invalid characters in first name.");
				nForm.first_name.focus();	
				return false;
			}
		}
		
	if (!validRequired(nForm.last_name,"Please enter Last Name."))
		return false;

		if (trim(nForm.last_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.last_name.value)))
			{
				alert("Invalid characters in last name.");
				nForm.last_name.focus();	
				return false;
			}
		}

	if (!validRequired(nForm.title,"Please enter Title."))
		return false;

		if (trim(nForm.title.value) != "")
		{
			if(isNotAlphabets(trim(nForm.title.value)))
			{
				alert("Invalid characters in Title.");
				nForm.title.focus();	
				return false;
			}
		}

	if (!validRequired(nForm.company,"Please enter Company."))
		return false;

	if (!validRequired(nForm.website,"Please enter Website URL."))
		return false;

	var v = new RegExp();
	
	v.compile("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
	
	if (!v.test(nForm["website"].value))
	 {
	   alert("You must supply a valid Website Url.");
	   nForm.website.focus(); 
	   return false;
	 } 
	 
	if (!checkEmail(nForm.email,"Please enter valid Email Address."))
		return false;
		
		/*emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.') & emailid.indexOf('mail.');	

		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}*/
		
		if(nForm.confirm_email.value!=nForm.email.value){
			alert("Confirmation Email do not match."); 
			nForm.confirm_email.focus(); 
			return false;
		}

	//Phone	
	if (!validRequired(nForm.phone,"Please enter Phone number."))
		return false;
		
		if (trim(nForm.phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in Phone number.");
				nForm.phone.focus();	
				return false;
			}
		}

		if (trim(nForm.city.value) != "")
		{
			if(isNotAlphabets(trim(nForm.city.value)))
			{
				alert("Invalid characters in City.");
				nForm.city.focus();	
				return false;
			}
		}

		if (trim(nForm.state.value) != "")
		{
			if(isNotAlphabets(trim(nForm.state.value)))
			{
				alert("Invalid characters in State.");
				nForm.state.focus();	
				return false;
			}
		}

		if (trim(nForm.country.value) != "")
		{
			if(isNotAlphabets(trim(nForm.country.value)))
			{
				alert("Invalid characters in Country.");
				nForm.country.focus();	
				return false;
			}
		}
		
		var checked = false; 
		  var buttons = nForm.day; 
		  for (var i=0; i<buttons.length; i++)  
		  {  
			if (buttons[i].checked) {  
			  checked = true; 
			  break;  
			}  
		   } 
		   if(!checked) {
			 alert("Please select a day to meet");  
		   	 return checked ; 		
		   }
		   
		if(nForm.sel_time.value == '0'){
			alert("Please select preferred time."); 
			nForm.sel_time.focus(); 
			return false;
		}

}

// CTIA09_3.html Form validation

function check_CTIA09_3_frm(nForm) 
{

	if (!validRequired(nForm.first_name,"Please enter First Name."))
		return false;
		
		if (trim(nForm.first_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.first_name.value)))
			{
				alert("Invalid characters in first name.");
				nForm.first_name.focus();	
				return false;
			}
		}
		
	if (!validRequired(nForm.last_name,"Please enter Last Name."))
		return false;

		if (trim(nForm.last_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.last_name.value)))
			{
				alert("Invalid characters in last name.");
				nForm.last_name.focus();	
				return false;
			}
		}

	if (!validRequired(nForm.title,"Please enter Title."))
		return false;

		if (trim(nForm.title.value) != "")
		{
			if(isNotAlphabets(trim(nForm.title.value)))
			{
				alert("Invalid characters in Title.");
				nForm.title.focus();	
				return false;
			}
		}

	if (!validRequired(nForm.company,"Please enter Company."))
		return false;

	if (!validRequired(nForm.website,"Please enter Website URL."))
		return false;

	var v = new RegExp();
	
	v.compile("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
	
	if (!v.test(nForm["website"].value))
	 {
	   alert("You must supply a valid Website Url.");
	   nForm.website.focus(); 
	   return false;
	 } 
	 
	if (!checkEmail(nForm.email,"Please enter valid Email Address."))
		return false;
		
		/*emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.') & emailid.indexOf('mail.');	

		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}*/
		
		if(nForm.confirm_email.value!=nForm.email.value){
			alert("Confirmation Email do not match."); 
			nForm.confirm_email.focus(); 
			return false;
		}

	//Phone	
	if (!validRequired(nForm.phone,"Please enter Mobile Phone number."))
		return false;
		
		if (trim(nForm.phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in Mobile Phone number.");
				nForm.phone.focus();	
				return false;
			}
		}

		if (trim(nForm.city.value) != "")
		{
			if(isNotAlphabets(trim(nForm.city.value)))
			{
				alert("Invalid characters in City.");
				nForm.city.focus();	
				return false;
			}
		}

		if (trim(nForm.state.value) != "")
		{
			if(isNotAlphabets(trim(nForm.state.value)))
			{
				alert("Invalid characters in State.");
				nForm.state.focus();	
				return false;
			}
		}

		if (trim(nForm.country.value) != "")
		{
			if(isNotAlphabets(trim(nForm.country.value)))
			{
				alert("Invalid characters in Country.");
				nForm.country.focus();	
				return false;
			}
		}
		

}

function check_request_class_onsite_frm(nForm) 
{
		if (!validRequired(nForm.company,"Please enter your company name."))
			return false;

		if (!validRequired(nForm.contact_name,"Please enter contact name."))
			return false;
						
		if (trim(nForm.contact_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.contact_name.value)))
			{
				alert("Invalid characters in contact name.");
				nForm.contact_name.focus();	
				return false;
			}
		}
			
	//Phone	
	if (!validRequired(nForm.phone,"Please enter phone number."))
		return false;
		
		if (trim(nForm.phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in phone number.");
				nForm.phone.focus();	
				return false;
			}
		}

		
		if (!checkEmail(nForm.email,"Please enter valid Email address."))
			return false;

		emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.');	
		
		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}
		
	flag_relation = 0;
	flag_classes = 0;
	flag_class_location = 0;
	
	for(i=0;i<4;i++)
	{
		if(nForm.relationship[i].checked==true)
		{
			flag_relation = 1;
		}
	}	
		
	if(flag_relation == 0)
	{
		alert("Please select your relationship with us.");
		nForm.relationship[0].focus();	
		return false;
	}
	var len = nForm.classes.length;
	
	for(i=0;i<len;i++)
	{
		if(nForm.classes[i].checked==true)
		{
			flag_classes = 1;
		}
	}	
		
	if(flag_classes == 0)
	{
		alert("Please select Class(es) you would like to request.");
		nForm.classes[0].focus();	
		return false;
	}
	
	/*for(i=0;i<2;i++)
	{
		if(nForm.class_location[i].checked==true)
		{
			flag_class_location = 1;
		}
	}*/
		
	if(nForm.myfacility_venue.value != "")
	{
		flag_class_location = 1;
	}	
	if(flag_class_location == 0)
	{
		alert("Please enter name of venue.");
		nForm.myfacility_venue.focus();	
		return false;
	}
			

		if(nForm.myfacility_venue.value != "")
		{
				//If my facility is checked
				if (!validRequired(nForm.myfacility_address,"Please enter address of your class location facility."))
					return false;
					
				if (!validRequired(nForm.myfacility_city,"Please enter city of your class location facility."))
					return false;
					
				if (!validRequired(nForm.myfacility_state,"Please enter state/province of your class location facility."))
					return false;
					
				if (!validRequired(nForm.myfacility_country,"Please enter country of your class location facility."))
					return false;
		}	
	
		if (!validRequired(nForm.class_start_date,"Please enter class start date."))
			return false;					
	
		if (!validRequired(nForm.alternative_class_start_date,"Please enter alternative class start date."))
			return false;					

		if (!validRequired(nForm.number_of_students,"Please enter number of students expected."))
			return false;					
		
		user_notes = nForm.user_notes.value;	
		
		if(user_notes.length>500)
		{
			alert("Can not input more than 500 characters.");
			nForm.user_notes.focus();	
			return false;
		}			
			
		flag_class_location = 0;
		
		
			
			for(i=0;i<2;i++)
			{
				if(nForm.my_facility[i].checked==true)
				{
					flag_class_location++;
				}
			}	
				
			if(flag_class_location < 2)
			{
				alert("Please confirm that the required items for classroom set-up will be made available.");
				nForm.my_facility[0].focus();	
				return false;
			}
			
		
			
		if (!validRequired(nForm.shipping_name,"Please enter name for shipping address."))
			return false;
						
		if (trim(nForm.shipping_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.shipping_name.value)))
			{
				alert("Invalid characters in shipping name.");
				nForm.shipping_name.focus();	
				return false;
			}
		}

			//If same as above then do not validate
		if(nForm.address_same_as_myfacility.checked==false)
		{
			if (!validRequired(nForm.shipping_address,"Please enter shipping address."))
				return false;
		}
						
	//Phone	
	if (!validRequired(nForm.shipping_phone,"Please enter shipping phone number."))
		return false;
		
		if (trim(nForm.shipping_phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.shipping_phone.value)))
			{
				alert("Invalid characters in shipping phone number.");
				nForm.shipping_phone.focus();	
				return false;
			}
		}
		
				
			
			
			
				
		return true;
}


function check_training_public_frm(nForm) 
{
		if (!validRequired(nForm.company,"Please enter your company name."))
			return false;

		if (!validRequired(nForm.contact_name,"Please enter contact name."))
			return false;
						
		if (trim(nForm.contact_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.contact_name.value)))
			{
				alert("Invalid characters in contact name.");
				nForm.contact_name.focus();	
				return false;
			}
		}
			
	//Phone	
	if (!validRequired(nForm.phone,"Please enter phone number."))
		return false;
		
		if (trim(nForm.phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in phone number.");
				nForm.phone.focus();	
				return false;
			}
		}

		
		if (!checkEmail(nForm.email,"Please enter valid Email address."))
			return false;

		emailid = nForm.email.value;
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.');	
		
		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}
		
	flag_relation = 0;
	flag_classes = 0;
	flag_classes_opt = 0;
	flag_classes_osn = 0;
	flag_class_location = 0;
	
	for(i=0;i<5;i++)
	{
		if(nForm.relationship[i].checked==true)
		{
			flag_relation = 1;
		}
	}	
		
	if(flag_relation == 0)
	{
		alert("Please select your relationship with us.");
		nForm.relationship[0].focus();	
		return false;
	}
	var len = nForm.classes.length;
	
	for(i=0;i<len;i++)
	{
		if(nForm.classes[i].checked==true)
		{
			flag_classes = 1;
		}
	}	
		
	if(flag_classes == 0)
	{
		alert("Please select Class(es) you would like to request!\n\n1. Optimization Fundamentals (OSN) 5.x (3 Days)\n\n2. Unison Optimization Essentials (3 Days)");
		nForm.classes[0].focus();
		return false;
	}

	if(nForm.classes[0].checked==true)	
	{
		var len1 = nForm.classes_opt.length;
		
		for(i=0;i<len1;i++)
		{
			if(nForm.classes_opt[i].checked==true)
			{
				flag_classes_opt = 1;
			}
		}
			
		if(flag_classes_opt == 0)
		{
			alert("You have selected Optimization Fundamentals (OSN) 5.x (3 Days)\n\nPlease select Class location.");
			nForm.classes_opt[0].focus();	
			return false;
		}
	}		

	if(nForm.classes[1].checked==true)	
	{
		for(i=0;i<11;i++)
		{
			if(nForm.classes_uof[i].checked==true)
			{
				flag_classes_osn = 1;
			}
		}
			
		if(flag_classes_osn == 0)
		{
			alert("You have selected Unison Optimization Essentials (3 Days)\n\nPlease select Class location.");
			nForm.classes_uof[0].focus();	
			return false;
		}
	}		
		
	
						
		
		user_notes = nForm.user_notes.value;	
		
		if(user_notes.length>500)
		{
			alert("Can not input more than 500 characters.");
			nForm.user_notes.focus();	
			return false;
		}			
			
			
			
				
		return true;
}

// products-applications/request_more_info.html

function check_request_frm(nForm) 
{

	if (!validRequired(nForm.first_name,"Please enter First Name."))
		return false;
		
		if (trim(nForm.first_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.first_name.value)))
			{
				alert("Invalid characters in first name.");
				nForm.first_name.focus();	
				return false;
			}
		}
		
	if (!validRequired(nForm.last_name,"Please enter Last Name."))
		return false;

		if (trim(nForm.last_name.value) != "")
		{
			if(isNotAlphabets(trim(nForm.last_name.value)))
			{
				alert("Invalid characters in last name.");
				nForm.last_name.focus();	
				return false;
			}
		}

	if (!validRequired(nForm.title,"Please enter Title."))
		return false;

		if (trim(nForm.title.value) != "")
		{
			if(isNotAlphabets(trim(nForm.title.value)))
			{
				alert("Invalid characters in Title.");
				nForm.title.focus();	
				return false;
			}
		}

	if (!validRequired(nForm.company,"Please enter Company."))
		return false;

	if (!validRequired(nForm.website,"Please enter Website URL."))
		return false;

	var v = new RegExp();
	
	v.compile("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
	
	if (!v.test(nForm["website"].value))
	 {
	   alert("You must supply a valid Website Url.");
	   nForm.website.focus(); 
	   return false;
	 } 
	 
	if (!checkEmail(nForm.email,"Please enter valid Email Address."))
		return false;
		
		emailid = nForm.email.value.toLowerCase();
			
		var checkDomain = emailid.indexOf('yahoo.') & emailid.indexOf('gmail.') & emailid.indexOf('aol.') & emailid.indexOf('msn.') & emailid.indexOf('hotmail.') & emailid.indexOf('earthlink.') & emailid.indexOf('rediffmail.') & emailid.indexOf('kotov.') & emailid.indexOf('mail.');	

		if(checkDomain>0)
		{
			alert("You have entered an email account from a free email service or one of the high-volume consumer service providers (i.e. AOL, Gmail, Yahoo, MSN, Hotmail, Earthlink, Rediffmail, etc).\nIn an effort to provide you with the best possible access to our services, we require that you enter your corporate email address.");
			nForm.email.focus();
			return false;
		}
		
		if(nForm.confirm_email.value!=nForm.email.value){
			alert("Confirmation Email do not match."); 
			nForm.confirm_email.focus(); 
			return false;
		}

	//Phone	
	if (!validRequired(nForm.phone,"Please enter Phone number."))
		return false;
		
		if (trim(nForm.phone.value) != "")
		{
			if(isNotNumeric(trim(nForm.phone.value)))
			{
				alert("Invalid characters in Phone number.");
				nForm.phone.focus();	
				return false;
			}
		}

		if (trim(nForm.city.value) != "")
		{
			if(isNotAlphabets(trim(nForm.city.value)))
			{
				alert("Invalid characters in City.");
				nForm.city.focus();	
				return false;
			}
		}

		if (trim(nForm.state.value) != "")
		{
			if(isNotAlphabets(trim(nForm.state.value)))
			{
				alert("Invalid characters in State.");
				nForm.state.focus();	
				return false;
			}
		}
		
		if (trim(nForm.country.value) == "")
		{
				alert("Please enter Country.");
				nForm.country.focus();	
				return false;
		}
		
		if (trim(nForm.country.value) != "")
		{
			if(isNotAlphabets(trim(nForm.country.value)))
			{
				alert("Invalid characters in Country.");
				nForm.country.focus();	
				return false;
			}
		}
		if (trim(nForm.hear_about.value) == "")
		{
				alert("Please select \"How did you hear about Bytemobile?\"");
				nForm.country.focus();	
				return false;
		}

}