function empcheck()
{

 if(document.profile.company_name.value=="")
 {
 alert("\nPlease enter the company name.");    
  document.profile.company_name.focus();      
  document.profile.company_name.select();      
  return false;      
 }
 
 if(document.profile.address1.value=="")
 {
 alert("\nPlease enter the address.");    
  document.profile.address1.focus();      
  document.profile.address1.select();      
  return false;      
 }
 
 var st = document.profile.state.selectedIndex;
 var state = document.profile.state.options[st].value;
 if(state=="")
 {
 alert("Please select a state.");
 document.profile.state.focus();
 return false;
 }
 if(document.profile.city.value=="")
 {
 alert("Please enter a city.");
 document.profile.city.focus();
 return false;
 }

 var ind = document.profile.industry.selectedIndex;
 var industry = document.profile.industry.options[ind].value;
 if(industry=="")
 {
 alert("\nPlease select Industry");    
 document.profile.industry.focus();      
 return false;
 }

var a = document.profile.employer_other.selectedIndex;
var b = document.profile.employer_other.options[a].value;
if(document.profile.employer_type[0].checked)
 var rad="yes";
else
 rad="no";
 
 if(document.profile.employer_type[1].checked) 
   var rad1="yes";
  else
   rad1 = "no";
   
   if((rad1=="no") && (rad=="no"))
   {
    alert("Please select whether Direct Employer or not");
	document.profile.employer_type[1].focus();
	return false;
   }
   
if(rad1=="yes")
  {
   if(b=="")
   {
     alert("Please select the Employer Type");
	 document.profile.employer_other.focus();
	 return false;
   }
  } 

  if(document.profile.financial_name.value=="")
 {
 alert("\nPlease enter the Chief Financial\n Officer name.");    
  document.profile.financial_name.focus();      
  document.profile.financial_name.select();      
  return false;      
 }
 
  if(document.profile.financial_phone.value=="")
 {
 alert("\nPlease enter the Chief Financial\n Officer Phone.");    
  document.profile.financial_phone.focus();      
  document.profile.financial_phone.select();      
  return false;      
 }
 if(document.profile.contact_name.value=="")
 {
 alert("\nPlease enter the Contact Officer's name.");    
  document.profile.contact_name.focus();      
  document.profile.contact_name.select();      
  return false;      
 }
 if(document.profile.contact_dept.value=="")
 {
 alert("\nPlease enter the Contact Officer's Department.");    
  document.profile.contact_dept.focus();      
  document.profile.contact_dept.select();      
  return false;      
 }
 if(document.profile.contact_phone.value=="")
 {
 alert("\nPlease enter the Contact Phone.");    
  document.profile.contact_phone.focus();      
  document.profile.contact_phone.select();      
  return false;      
 }
  if (document.profile.email.value.indexOf ('@',0) == -1 || document.profile.email.value.indexOf ('.',0) == -1 || document.profile.email.value.length < 6)
 {      
  alert("\nThe email address you have entered is invalid.\n\nPlease re-enter a valid email address.");      		
  document.profile.email.focus();      
  document.profile.email.select();      
  return false;      
 }  	
  if (document.profile.email2.value.indexOf ('@',0) == -1 || document.profile.email2.value.indexOf ('.',0) == -1 || document.profile.email2.value.length < 6)
 {      
  alert("\nThe email address you have entered is invalid.\n\nPlease re-enter a valid email address.");      		
  document.profile.email2.focus();      
  document.profile.email2.select();      
  return false;      
 }  	

		 if (document.profile.password.value=="" || document.profile.password.value.indexOf ('@',0) != -1 || document.profile.password.value.indexOf ('.',0) != -1 || document.profile.password.value.indexOf ('!',0) != -1 || document.profile.password.value.indexOf ('%',0) != -1 || document.profile.password.value.indexOf ('#',0) != -1 || document.profile.password.value.indexOf ('*',0) != -1 || document.profile.password.value.indexOf ('/',0) != -1 )
		 {      
		  alert("\nThe password you have entered is invalid.\n\nPlease enter a password without special characters.");    
		  document.profile.password.focus();      
		  document.profile.password.select();      
		  return false;      
		 }  	

 if(document.profile.billvia[0].checked==true)
 {
 	if(document.profile.dbemail.value!="")
	{
	 if (document.profile.dbemail.value.indexOf ('@',0) == -1 || document.profile.dbemail.value.indexOf ('.',0) == -1 || document.profile.dbemail.value.length < 6)
	 {      
	  alert("\nThe email address you have entered is invalid.\n\nPlease re-enter a valid email address.");      		
	  document.profile.dbemail.focus();      
	  document.profile.dbemail.select();      
	  return false;      
	 }  		
	}
 }

 if(document.profile.billvia[1].checked==true)
 {
	 if(document.profile.bname.value=="")
	 {
	  alert("\nPlease enter the name\n required for billing.");    
	  document.profile.bname.focus();      
	  document.profile.bname.select();      
	  return false;      
	 }
	
	 if(document.profile.baddress1.value=="")
	 {
	  alert("\nPlease enter the address \n required for billing.");    
	  document.profile.baddress1.focus();      
	  document.profile.baddress1.select();      
	  return false;      
	 }
	
	 var st = document.profile.bstate.selectedIndex;
	 var state = document.profile.bstate.options[st].value;
	 if(state=="")
	 {
	 alert("Please select a state \n required for billing.");
	 document.profile.bstate.focus();
	 return false;
	 }
	
	 if(document.profile.bcity.value=="")
	 {
	 alert("Please enter a city \n required for billing.");
	 document.profile.bcity.focus();
	 return false;
	 }	 

	 if(document.profile.bzipcode.value=="")
	 {
	 alert("Please enter Zipcode\n required for billing.");
	 document.profile.bzipcode.focus();
	 return false;
	 }	 

	 if(document.profile.bcontact_phone.value=="")
	 {
	 alert("Please enter Phone no.");
	 document.profile.bcontact_phone.focus();
	 return false;
	 }	 

 	if(document.profile.bemail.value=="")
	{
	 alert("Please fill in the email address \nwhich is required for billing purpose");
	 document.profile.bemail.focus();
	 document.profile.bemail.select();       
	 return false;
	}
	
	 if (document.profile.bemail.value.indexOf ('@',0) == -1 || document.profile.email.value.indexOf ('.',0) == -1 || document.profile.bemail.value.length < 6)
	 {      
	  alert("\nThe email address you have entered is invalid.\n\nPlease re-enter a valid email address.");      		
	  document.profile.bemail.focus();      
	  document.profile.bemail.select();      
	  return false;      
	 }  	
	 
 }

 if(document.profile.serviceagreement.checked==false)
 {
  alert("Please read the service agreement");
  document.profile.serviceagreement.focus();
  return false;
 }
}//empcheck ends


function copy_email() {
   document.profile.email2.value = document.profile.email.value;
}


function candcheck()
{
 var p = document.profile.category.selectedIndex;
 var category = document.profile.category.options[p].value;
 if(category=="")
 {
 alert("Please select a Category.");
 document.profile.category.focus();
 return false;
 }

var p = document.profile.prefix.selectedIndex;
 var prefix = document.profile.prefix.options[p].value;
 if(prefix=="")
 {
 alert("Please select a prefix.");
 document.profile.prefix.focus();
 return false;
 }
 
if(document.profile.first_name.value=="")
 {
 alert("\nPlease enter your first name.");    
  document.profile.first_name.focus();      
  document.profile.first_name.select();      
  return false;      
 }
 
 if(document.profile.last_name.value=="")
 {
 alert("\nPlease enter your last name.");    
  document.profile.last_name.focus();      
  document.profile.last_name.select();      
  return false;      
 }
 if(document.profile.address1.value=="")
 {
 alert("\nPlease enter the address.");    
  document.profile.address1.focus();      
  document.profile.address1.select();      
  return false;      
 }
 var st = document.profile.state.selectedIndex;
 var state = document.profile.state.options[st].value;
 if(state=="")
 {
 alert("Please select a state.");
 document.profile.state.focus();
 return false;
 }
 if(document.profile.city.value=="")
 {
 alert("Please enter a city.");
 document.profile.city.focus();
 return false;
 }
 if(document.profile.prof_title.value=="")
 {
 alert("Please enter the Title/Position.");
 document.profile.prof_title.focus();
 return false;
 }
 
if(document.profile.industry.value=="")
 {
 alert("Please enter the Industry.");
 document.profile.industry.focus();
 return false;
 }
 if (document.profile.email.value.indexOf ('@',0) == -1 || document.profile.email.value.indexOf ('.',0) == -1 || document.profile.email.value.length < 6)
 {      
  alert("\nThe email address you have entered is invalid.\n\nPlease re-enter a valid email address.");      		
  document.profile.email.focus();      
  document.profile.email.select();      
  return false;      
 }  	
 if(document.profile.password.value=="")
 {
 alert("Please enter a password.");
 document.profile.password.focus();
 return false;
 }
 
 if(document.profile.repassword.value=="")
 {
 alert("Please reenter the password.");
 document.profile.repassword.focus();
 return false;
 }
 if (document.profile.password.value.indexOf ('@',0) != -1 || document.profile.password.value.indexOf ('.',0) != -1 || document.profile.password.value.indexOf ('!',0) != -1 || document.profile.password.value.indexOf ('%',0) != -1 || document.profile.password.value.indexOf ('#',0) != -1 || document.profile.password.value.indexOf ('*',0) != -1 || document.profile.password.value.indexOf ('/',0) != -1 )
 {      
  alert("\nThe password you have entered is invalid.\n\nPlease enter a password without special characters.");     
  document.profile.password.focus();      
  document.profile.password.select();      
  return false;      
 }  	
 

}


function selectedPrefix(m)
{
var t = m;
var n = document.profile.prefix.length;
for(var i=0;i<n;i++){
if (document.profile.prefix.options[i].value==t)
 document.profile.prefix.options.selectedIndex = i;
  }
}

function selectedState(m)
{
	var t = m;
	var n = document.profile.state.length;
	for(var i=0;i<n;i++){
		if (document.profile.state.options[i].value==t)
			document.profile.state.options.selectedIndex = i;
	}
}
function selectedCountry(m)
{
	var t = m;
	var n = document.profile.country.length;
	for(var i=0;i<n;i++){
		if (document.profile.country.options[i].value==t)
			document.profile.country.options.selectedIndex = i;
	}
}

function selectedbState(m)
{
	var t = m;
	var n = document.profile.bstate.length;
	for(var i=0;i<n;i++){
		if (document.profile.bstate.options[i].value==t)
			document.profile.bstate.options.selectedIndex = i;
	}
}
function selectedbCountry(m)
{
	var t = m;
	var n = document.profile.bcountry.length;
	for(var i=0;i<n;i++){
		if (document.profile.bcountry.options[i].value==t)
			document.profile.bcountry.options.selectedIndex = i;
	}
}

function selectedindustry(m)
{
	var t = m;
	var n = document.profile.industry.length;
	for(var i=0;i<n;i++){
		if (document.profile.industry.options[i].value==t)
			document.profile.industry.options.selectedIndex = i;
	}	
}
function selectedcompany_type(m)
{
	var t = m;
	var n = document.profile.company_type.length;
	for(var i=0;i<n;i++){
		if (document.profile.company_type.options[i].value==t)
			document.profile.company_type.options.selectedIndex = i;
	}	
}

function selectedbillvia(m)
{
	var t = m;
	if (t=="")
		document.profile.billvia[0].checked=true;
	else
		document.profile.billvia[1].checked=true;
}

function selectedBTime(m)
{
var t = m;
var n = document.profile.best_time.length;
for(var i=0;i<n;i++){
if (document.profile.best_time.options[i].value==t)
 document.profile.best_time.options.selectedIndex = i;
  }
}

function selectedHear(m)
{
var t = m;
var n = document.profile.hear.length;
for(var i=0;i<n;i++){
if (document.profile.hear.options[i].value==t)
 document.profile.hear.options.selectedIndex = i;
  }
}

function selectedEmployer(m)
{
 var t= m;
 if (t=="Direct Employer")
  document.profile.employer_type[0].checked=true;
 else
 {
  document.profile.employer_type[1].checked=true;
  
	  var n = document.profile.employer_other.length;
	  for(var i=0;i<n;i++)
	  {
	  if (document.profile.employer_other.options[i].value==t)
	  document.profile.employer_other.options.selectedIndex = i;
      }
 }
}

function emptydetails(){
	document.profile.dbemail.value='';
	document.profile.dbname.value='';
	document.profile.billvia[1].checked=true;
}

function emptyall(){
	document.profile.billvia[0].checked=true;
	document.profile.bname.value = '';
	document.profile.baddress1.value = '';
	document.profile.bcountry.options.selectedIndex = 0;
	document.profile.bstate.options.selectedIndex = 0;
	document.profile.bcity.value = '';
	document.profile.bcontact_phone.value = '';
	document.profile.bfax.value = '';
	document.profile.bzipcode.value = '';
	document.profile.bemail.value='';
}


