// JavaScript Document

function checkMail()
{
	var x = document.forms[0].email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x))
	{
		return true;
	}
	else {
		return false;
	}
}

//---------------------------------

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = " 0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
//---------------------------------

function checkname()
{
	if(document.form1.name.value=='')
	{
		document.getElementById('divname').style.display = 'block';
		return false;
	} else 
	{
		document.getElementById('divname').style.display = '';
		return true;
	}
	
}

function check_email()
{
  if(document.form1.email.value == '')
   {

	document.getElementById("divemail").style.display='block';
	document.getElementById("divemail1").style.display='none';	
      return false;
 } else if(checkMail(document.form1.email.value)){
	document.getElementById("divemail1").style.display='none';
	document.getElementById("divemail").style.display='none';
	return true;  
   } else 
   {
	document.getElementById("divemail").style.display='none';
   	document.getElementById("divemail1").style.display='block';	  
	return false;
   
   }
}


function check_address()
{
  if(document.form1.address.value == '')
   {
	document.getElementById("divaddress").style.display='block';
      return false;
   } else 
   {
	document.getElementById("divaddress").style.display='none';
      return true;
 
   }
}

function check_city()
{
  if(document.form1.city.value == '')
   {
	document.getElementById("divcity").style.display='block';
      return false;
   } else 
   {
	document.getElementById("divcity").style.display='none';
      return true;
 
   }
}

function check_country()
{
  if(document.form1.country.value == '')
   {
	document.getElementById("divcountry").style.display='block';
      return false;
   } else 
   {
	document.getElementById("divcountry").style.display='none';
      return true;
 
   }
}

function check_phone()
{
  if(document.form1.contactno.value == '')
   {
	document.getElementById("divcontactno1").style.display='';	  
	document.getElementById("divcontactno").style.display='block';
      return false;
 } else if(!IsNumeric(document.form1.contactno.value))
 {
	document.getElementById("divcontactno1").style.display='block';	  
	document.getElementById("divcontactno").style.display='none';

		return false;  
   } else 
   {
   	  document.getElementById("divcontactno1").style.display='none';	  
	  document.getElementById("divcontactno").style.display='none';	  
      return true;
   
   }
}

function check_message()
{
  if(document.form1.message.value == '')
   {
	document.getElementById("divmessage").style.display='block';
      return false;
   } else 
   {
	document.getElementById("divmessage").style.display='none';
      return true;
 
   }
}



//----------------------------------
/*function check_title()
{
  if(document.form1.title_id.value == '')
   {
	document.getElementById("title").style.display='block';
      return false;
   } else 
   {
	document.getElementById("title").style.display='none';
      return true;
 
   }
}



function check_phone()
{
  if(document.form1.phone.value == '')
   {
   //	  document.getElementById("phone_chk").style.display='block';
	  document.getElementById("phone_chk1").style.display='none';	  
     // phone.focus();
      return false;
 } else if(IsNumeric(document.form1.phone.value))
 {
		document.getElementById("phone_chk1").style.display='none';
		document.getElementById("phone_chk").style.display='none';
		 return true;  
   } else 
   {
   	  document.getElementById("phone_chk1").style.display='block';	  
	  document.getElementById("phone_chk").style.display='none';	  
      return false;
   
   }
}


function check_mobile()
{
  if(document.form1.mobile.value == '')
   {
	document.getElementById("mobile_chk1").style.display='';	  
	document.getElementById("mobile_chk").style.display='block';
      return false;
 } else if(!IsNumeric(document.form1.mobile.value))
 {
	document.getElementById("mobile_chk1").style.display='block';	  
	document.getElementById("mobile_chk").style.display='none';

		return false;  
   } else 
   {
   	  document.getElementById("mobile_chk1").style.display='none';	  
	  document.getElementById("mobile_chk").style.display='none';	  
      return true;
   
   }
}

function check_add1()
{
  if(document.form1.add1.value == '')
   {
   	  document.getElementById("add1_chk").style.display='block';
      return false;
   } else 
   {
   	  document.getElementById("add1_chk").style.display='none';
      return true;
   
   }
}

function check_postcode()
{
  if(document.form1.postcode.value == '')
   {
   	  document.getElementById("post_chk").style.display='block';
      return false;
   } else 
   {
   	  document.getElementById("post_chk").style.display='none';
      return true;
   
   }
}


function check_country()
{
  if(document.form1.CountryID.value == '')
   {
   	  document.getElementById("country_chk").style.display='block';
      return false;
   } else 
   {
   	  document.getElementById("country_chk").style.display='none';
      return true;
   
   }
}

function check_jobtitle()
{
  if(document.form1.jobtitle.value == '')
   {
   	  document.getElementById("jobtitle_chk").style.display='block';
      return false;
   } else 
   {
   	  document.getElementById("jobtitle_chk").style.display='none';
      return true;
   
   }
}

function check_company()
{
  if(document.form1.company.value == '')
   {
   	  document.getElementById("company_chk").style.display='block';
      return false;
   } else 
   {
   	  document.getElementById("company_chk").style.display='none';
      return true;
   
   }
}

function check_jobpostcode()
{
  if(document.form1.jobpostcode.value == '')
   {
   	  document.getElementById("jobpostcode_chk").style.display='block';
      return false;
   } else 
   {
   	  document.getElementById("jobpostcode_chk").style.display='none';
      return true;
   
   }
}*/
