function validation(){
	var pattern = /^[a-z0-9\-\.]+@[a-z0-9\-]+\.[a-z\.]{2,6}$/i;
	var state = /^[A-Za-z]+$/;
	if($F('fname').search(/\S/) == -1){
		alert("Please enter first name");
		return false;
	}else if($F('lname').search(/\S/) == -1){
		alert("Please enter last name");
		return false;
	}else if($F('title').search(/\S/) == -1){
		alert("Please enter title");
		return false;
	}else if($F('Address').search(/\S/) == -1){
		alert("Please enter address");
		return false;
	}else if($F('email').search(/\S/) == -1){
		alert("Please enter email id");
		return false;
	}else if(!pattern.test($F('email'))){
		alert("Please enter valid email id");
		return false;
	}else if($F('Phone1').search(/\S/) == -1){
		alert("Please enter primary contact number");
		return false;
	}else if($F('Phone2').search(/\S/) == -1){
		alert("Please enter secondary contact number");
		return false;
	}else if($F('training') == "-1"){
		alert("Please choose training option");
		return false;
	}else if($F('location').search(/\S/) == -1){
		alert("Please enter location");
		return false;
	}else{
		return true;		
	}	
}
function validation1(){
	var pattern = /^[a-z0-9\-\.]+@[a-z0-9\-]+\.[a-z\.]{2,6}$/i;
	var state = /^[A-Za-z]+$/;
	if($F('fname').search(/\S/) == -1){
		alert("Please enter first name");
		return false;
	}else if($F('lname').search(/\S/) == -1){
		alert("Please enter last name");
		return false;
	}else if($F('title').search(/\S/) == -1){
		alert("Please enter title");
		return false;
	}else if($F('Address').search(/\S/) == -1){
		alert("Please enter address");
		return false;
	}else if($F('email').search(/\S/) == -1){
		alert("Please enter email id");
		return false;
	}else if(!pattern.test($F('email'))){
		alert("Please enter valid email id");
		return false;
	}else if($F('Phone1').search(/\S/) == -1){
		alert("Please enter primary contact number");
		return false;
	}else if($F('Phone2').search(/\S/) == -1){
		alert("Please enter secondary contact number");
		return false;
	}else{
		return true;		
	}	
}
function newuser(){
	var pattern = /^[a-z0-9\-\.]+@[a-z0-9\-]+\.[a-z\.]{2,6}$/i;

	if($F('fname').search(/\S/) == -1){
		alert("Please enter first name");
		return false;
	}else if($F('lname').search(/\S/) == -1){
		alert("Please enter last name");
		return false;
	}else if($F('email').search(/\S/) == -1){
		alert("Please enter email id");
		return false;
	}else if(!pattern.test($F('email'))){
		alert("Please enter valid email id");
		return false;
	}else if($F('cemail').search(/\S/) == -1){
		alert("Please enter confirm email id");
		return false;
	}else if(!pattern.test($F('cemail'))){
		alert("Please enter valid confirm email id");
		return false;
	}else if($F('email')!=$F('cemail')){
		alert("Email and confirm email id not same");
		return false;
	}else if($F('user').search(/\S/) == -1){
		alert("Please enter user id");
		return false;
	}else if($F('password').search(/\S/) == -1){
		alert("Please enter password");
		return false;
	}else{
		return true;		
	}	
}

function contact(){

	if($F('Name').search(/\S/) == -1){
		alert("Please enter name");
		return false;
	}else if($F('Address').search(/\S/) == -1){
		alert("Please enter address");
		return false;
	}else if($F('Address2').search(/\S/) == -1){
		alert("Please enter notes");
		return false;
	}else{
		return true;		
	}	
}

function numbersonly(e){
  var unicode=e.charCode? e.charCode : e.keyCode
  if (unicode==46)
    return true;
  if (unicode!=8)
  {
    if (unicode<48||unicode>57)
      return false;
    }
  
}

function loginDiv(){
	
	var div=document.getElementById("login");
	if(div.style.display=='none'){
		div.style.display='block'
	}else{
		div.style.display='none'	
	}
	
}

function login(){


	if($F('fname').search(/\S/) == -1){
		alert("Please enter user");
		return false;
	}else if($F('lname').search(/\S/) == -1){
		alert("Please enter password");
		return false;
	}else{
		
		return true	
	}
}

function login2()
{
		if($F('training') == -1){
			alert("Please choose training option");
			return false;
		}else if($F('location') == -1){
			alert("Please select location");
			return false;
	}else{
		
		return true	
	}
	
}

function display_other(){
	
	var div=document.getElementById("other1");	
	if(document.form_contact.other.checked==true){
		div.style.display='block';
	}else{
		div.style.display='none';		
	}
	
}function location_check(){



	var divId=document.form1.training.value;


	xmlHttp=GetXmlHttpObject();

		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 
		var url="location.php";
		url=url+"?n="+divId;
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		}

		function GetXmlHttpObject()
		{
		var xmlHttp=null;
		try
		  {
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		  }
		catch (e)
		  {
		  // Internet Explorer
		  try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		  }
		return xmlHttp;
		}


function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("location1").innerHTML=xmlHttp.responseText;
	}

}
function contact_form(){
	var state = /^[A-Za-z]+$/;	
	var pattern = /^[a-z0-9\-\.]+@[a-z0-9\-]+\.[a-z\.]+$/i;
	if($F('name').search(/\S/) == -1){
		alert("Please enter name");
		return false;
	}else if($F('email').search(/\S/) == -1){
		alert("Please enter email id");
		return false;
	}else if(!pattern.test($F('email'))){
		alert("Please enter valid email id");
		return false;
	}else if($F('phone').search(/\S/) == -1){
		alert("Please enter phone number");
		return false;
	}else if($F('security_code').search(/\S/) == -1){
		alert("Please enter security code");
		
		return false;
	}else{
		return true;		
	}	
}

function validate_email() {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var $inputEmailElement = document.getElementById("subscribe_email");
	var $inputSecurityElement = document.getElementById("securityCode");
	if($inputEmailElement.value.search(/\S/) == -1){
		alert("Please enter email id");
		return false;
	}else if(!reg.test($inputEmailElement.value)) {
		alert('Invalid Email Address');
	    return false;
	}else if($inputSecurityElement.value.search(/\S/) == -1){
		alert("Please enter security code");
		return false;
	}
	else {
		return true;
	}
}

function show_state_field(val) {
	var select_element = document.getElementById('select_state');
	if(val === "United States") {
		select_element.innerHTML = '<select name="state" id="state" style="font-size:14px; width:148px;">'			   
		    + '<option value="-1">Select</option>'
		   	+ '<option value="Alaska">Alaska</option>'
			+ '<option value="Arizona">Arizona</option>'	
			+ '<option value="Arkansas">Arkansas</option>'
			+ '<option value="California">California</option>'
			+ '<option value="Colorado">Colorado</option>'
			+ '<option value="Connecticut">Connecticut</option>'
			+ '<option value="Delaware">Delaware</option>'
			+ '<option value="Florida">Florida</option>'
			+ '<option value="Georgia">Georgia</option>'
			+ '<option value="Hawaii">Hawaii</option>'
			+ '<option value="Idaho">Idaho</option>'
			+ '<option value="Illinois">Illinois</option>'
			+ '<option value="Indiana">Indiana</option>'
			+ '<option value="Iowa">Iowa</option>'
			+ '<option value="Kansas">Kansas</option>'
			+ '<option value="Kentucky">Kentucky</option>'
			+ '<option value="Louisiana">Louisiana</option>'
			+ '<option value="Maine">Maine</option>'
			+ '<option value="Maryland">Maryland</option>'
			+ '<option value="Massachusetts">Massachusetts</option>'
			+ '<option value="Michigan">Michigan</option>'
			+ '<option value="Minnesota">Minnesota</option>'
			+ '<option value="Mississippi">Mississippi</option>'
			+ '<option value="Missouri">Missouri</option>'
			+ '<option value="Montana">Montana</option>'
			+ '<option value="Nebraska">Nebraska</option>'
			+ '<option value="Nevada">Nevada</option>'
			+ '<option value="New Hampshire">New Hampshire</option>'
			+ '<option value="New Jersey">New Jersey</option>'
			+ '<option value="New Mexico">New Mexico</option>'
			+ '<option value="New York">New York</option>'
			+ '<option value="North Carolina">North Carolina</option>'
			+ '<option value="North Dakota">North Dakota</option>'
			+ '<option value="Ohio">Ohio</option>'
			+ '<option value="Oklahoma">Oklahoma</option>'
			+ '<option value="Oregon">Oregon</option>'
			+ '<option value="Pennsylvania">Pennsylvania</option>'
			+ '<option value="Rhode Island">Rhode Island</option>'
			+ '<option value="South Carolina">South Carolina</option>'
			+ '<option value="South Dakota">South Dakota</option>'
			+ '<option value="Tennessee">Tennessee</option>'
			+ '<option value="Texas">Texas</option>'
			+ '<option value="Utah">Utah</option>'
			+ '<option value="Vermont">Vermont</option>'
			+ '<option value="Virginia">Virginia</option>'
			+ '<option value="Washington">Washington</option>'
			+ '<option value="West Virginia">West Virginia</option>'
			+ '<option value="Wisconsin">Wisconsin</option>'
			+ '<option value="Wyoming">Wyoming</option>'
			+ '</select>';
	} else {
		select_element.innerHTML = '<input style="width:148px;" type="text" name="state" id="state" />';
	}
}

