// JavaScript Document
function submitContactForm() 
{
	if (document.getElementById('fn').value == ""){ 
	 	alert ("Please Enter Your First Name." )
        document.getElementById('fn').focus()        
		 return;}
	else if (document.getElementById('ln').value == ""){ 
	 	alert ("Please Enter Your Last Name." )
        document.getElementById('ln').focus()        
		 return;}
	else if (document.getElementById('email').value == ""){ 
	 	alert ("Please Enter Your Email." )
        document.getElementById('email').focus()        
		 return;}
	else if(!((document.getElementById('email').value.indexOf(".") > 2) && (document.getElementById('email').value.indexOf("@") > 0))){
	 	alert ("Invalid Email" )
       document.getElementById('email').focus()        
		 return;}
	else if (document.getElementById('phone').value == ""){ 
	 	alert ("Please Enter Your Phone Number." )
        document.getElementById('phone').focus()        
		 return;}
	else if (document.getElementById('age').value == ""){ 
	 	alert ("Please Enter Your Age." )
        document.getElementById('age').focus()        
		 return;}
	else if (document.getElementById('sa').value == ""){ 
	 	alert ("Please Enter Your Street Address." )
        document.getElementById('sa').focus()        
		 return;}
	else if (document.getElementById('zip').value == ""){ 
	 	alert ("Please Enter a Zip Code." )
        document.getElementById('zip').focus()        
		 return;}
	else if (document.getElementById('city').value == ""){ 
	 	alert ("Please Specify Your City." )
        document.getElementById('city').focus()        
		 return;}
	else if (document.getElementById('country').value == ""){ 
	 	alert ("Please Specify Your Country." )
        document.getElementById('country').focus()        
		 return;}
	else if (document.getElementById('comment').value == ""){ 
	 	alert ("Please type your Comments or Suggestions." )
        document.getElementById('comment').focus()        
		 return;}
	else{
        document.getElementById('contactform').submit();}
}

sendPage = function()
{
	  var parameters = "email=" + escape( encodeURI( document.getElementById("email").value ) );
	  parameters += "&url=" + escape( encodeURI( document.getElementById("url").value ) );
	  
	  if(true)
	  {
		 document.getElementById('waitBox').style.display = '';
		 document.getElementById('sendform').style.display = 'none'; // hide the object so it's not clickable anymore to avoid double requests
		 
		  var xmlHttp;
		  try { xmlHttp=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
		  catch (e) // Internet Explorer
			{
			try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e)
			  {
			  try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
			  catch (e)
				{
				alert("Your request could not be accomplished.")
				return false;
				}
			  }
			}
			xmlHttp.onreadystatechange=function()
			  {
			  if(xmlHttp.readyState==4)
				{
					//alert(xmlHttp.responseText);
					if(xmlHttp.responseText.indexOf("undone") == -1)
					{
						alert("The request has been sent.")
						document.getElementById('sendform').style.display = '';
						document.getElementById('waitBox').style.display = 'none';
					}
					else
					{
						alert("Your request could not be accomplished.")
						document.getElementById('sendform').style.display = '';
						document.getElementById('waitBox').style.display = 'none';
					}
				}
			  }
			xmlHttp.open('POST', "sendpage.php", true);
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", parameters.length);
			xmlHttp.setRequestHeader("Connection", "close");
			xmlHttp.send(parameters);
	  }
}

nlSubscribe = function()
{
	if(document.getElementById("email_nl").value=="" || document.getElementById("name_nl").value=="")
	{
		alert("Please fill in the fields correctly.")
		return;
	}
	  var parameters = "email=" + escape( encodeURI( document.getElementById("email_nl").value ) );
	  parameters += "&name=" + escape( encodeURI( document.getElementById("name_nl").value ) );
	  parameters += "&action=" + escape( encodeURI( "1" ) );
	  
	  if(true)
	  {
		 document.getElementById('nl_form_wait').style.display = '';
		 document.getElementById('nl_form').style.display = 'none'; // hide the object so it's not clickable anymore to avoid double requests
		 
		  var xmlHttp;
		  try { xmlHttp=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
		  catch (e) // Internet Explorer
			{
			try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e)
			  {
			  try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
			  catch (e)
				{
				alert("Your request could not be accomplished.")
				return false;
				}
			  }
			}
			xmlHttp.onreadystatechange=function()
			  {
			  if(xmlHttp.readyState==4)
				{
					alert(xmlHttp.responseText);
					document.getElementById('nl_form').style.display = '';
					document.getElementById('nl_form_wait').style.display = 'none';
				}
			  }
			xmlHttp.open('POST', "newsletter/ajax_nl_subscribe.php", true);
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", parameters.length);
			xmlHttp.setRequestHeader("Connection", "close");
			xmlHttp.send(parameters);
	  }
}

function validate()
{
	
	if (document.fcareersapply.firstname.value=="" || document.fcareersapply.firstname.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.firstname.focus();
		return; }
	else if (document.fcareersapply.lastname.value=="" || document.fcareersapply.lastname.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastname.focus();
		return; }
	else if (document.fcareersapply.age.value=="" || document.fcareersapply.age.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.age.focus();
		return; }
	else if (document.fcareersapply.nationality.value=="" || document.fcareersapply.nationality.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.nationality.focus();
		return; }
	else if (document.fcareersapply.maritalstatus.value=="" || document.fcareersapply.maritalstatus.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.maritalstatus.focus();
		return; }
	else if (document.fcareersapply.presentaddress.value=="" || document.fcareersapply.presentaddress.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.presentaddress.focus();
		return; }
	else if (document.fcareersapply.telephone.value=="" || document.fcareersapply.telephone.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.telephone.focus();
		return; }
	else if (document.fcareersapply.email.value=="" || document.fcareersapply.email.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.email.focus();
		return; }
	else if (document.fcareersapply.lastemployer.value=="" || document.fcareersapply.lastemployer.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastemployer.focus();
		return; }
	else if (document.fcareersapply.lastemployeraddress.value=="" || document.fcareersapply.lastemployeraddress.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastemployeraddress.focus();
		return; }
	else if (document.fcareersapply.lastposition.value=="" || document.fcareersapply.lastposition.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastposition.focus();
		return; }
	else if (document.fcareersapply.lastfrom.value=="" || document.fcareersapply.lastfrom.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastfrom.focus();
		return; }
	else if (document.fcareersapply.lastto.value=="" || document.fcareersapply.lastto.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastto.focus();
		return; }
	else if (document.fcareersapply.lastto.value < document.fcareersapply.lastfrom.value)
	{
		alert("Please make sure the dates entered are correct");
		document.fcareersapply.lastto.focus();
		return; }
	else if (document.fcareersapply.responsibilities.value=="" || document.fcareersapply.responsibilities.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.responsibilities.focus();
		return; }
	else if (document.fcareersapply.lastsalary.value=="" || document.fcareersapply.lastsalary.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.lastsalary.focus();
		return; }
	else if (document.fcareersapply.reasonleaving.value=="" || document.fcareersapply.reasonleaving.value==null)
	{
		alert("Please complete all compulsory fields");
		document.fcareersapply.reasonleaving.focus();
		return; }
	else {
	document.fcareersapply.submit();
	}
}

function validate_comment()
{
	if (document.getElementById('email').value == ""){ 
	 	alert ("Please Enter Your Email." )
        document.getElementById('email').focus()        
		 return;}
	else if(!((document.getElementById('email').value.indexOf(".") > 2) && (document.getElementById('email').value.indexOf("@") > 0))){
	 	alert ("Invalid Email" )
       document.getElementById('email').focus()        
		 return;}
	else if (document.getElementById('comment').value == ""){ 
	 	alert ("Please Enter Your Comments." )
        document.getElementById('comment').focus()        
		 return;}
	document.fcomment.submit();
}