// JavaScript Document
function enableOthers(){
	if(document.captchaForm.relationship.value == "Others"){
		document.captchaForm.relationshipOther.disabled = false;
		document.captchaForm.relationshipOther.focus();
		document.captchaForm.relationshipOther.select();
	}
	else{
		document.captchaForm.relationshipOther.disabled = true;
		document.captchaForm.relationshipOther.value = "";
		document.captchaForm.relationship.focus();
	}
}

function rossValidation(){
	
	var userID,customer,rossPass,secuCode;
	userID=document.getElementById("userID").value;
	customer=document.getElementById("customer").value;
	rossPass=document.getElementById("rossPass").value;
	secuCode=document.getElementById("secuCode").value;
		
	
	if(userID=="")
	{
		alert("User ID field is blank.");
		document.getElementById("userID").focus();
	}
	else if(customer=="")
	{
		alert("Customer field is blank.");
		document.getElementById("customer").focus();
	}
	else if(rossPass=="")
	{
		alert("Password field is blank.");
		document.getElementById("rossPass").focus();
	}
	else if(secuCode==""){
		alert("Security Code field is blank");
		document.getElementById("secuCode").focus();
	}
	else
	{
		document.forms[''].submit();
		//alert("Thank You! Your email has been sent.");
	}
}


function resumeValidation(){
	
	var logIn,password;
	logIn=document.getElementById("logIn").value;
	password=document.getElementById("password").value;
	
	if(logIn=="")
	{
		alert("Log-in field is blank.");
		document.getElementById("logIn").focus();
	}
	else if(password=="")
	{
		alert("Password field is blank.");
		document.getElementById("password").focus();
	}

	else
	{
		document.forms[''].submit();
		//alert("Thank You! Your email has been sent.");
	}
}

function forgotValidation(){
	
	var email;
	email=document.getElementById("email").value;
	
	if(email=="")
	{
		alert("Email field is blank.");
		document.getElementById("email").focus();
	}
	else
	{
		document.forms[''].submit();
		//alert("Thank You! Your email has been sent.");
	}
}


function doValidation()
{	 

	var lastName,firstName,email,subject,comments;
	firstName=document.getElementById("firstName").value;
	lastName=document.getElementById("lastName").value;
	email=document.getElementById("email").value;
	phone=document.getElementById("phone").value;
	country=document.getElementById("country").value;
	company=document.getElementById("company").value;
	industry=document.getElementById("industry").value;
	subject=document.getElementById("subject").value;	
	relationship=document.getElementById("relationship").value;
	comments=document.getElementById("comments").value;
	relationshipOther=document.getElementById("relationshipOther").value;
	captcha = document.getElementById("6_letters_code").value;

	emailVal = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;

	if(firstName=="")
	{
		alert("First Name field is blank.");
		document.getElementById("firstName").focus();
	}
	else if(lastName=="")
	{
		alert("Last Name field is blank.");
		document.getElementById("lastName").focus();
	}
	else if(email=="")
	{
		alert("Email Address field is blank.");
		document.getElementById("email").focus();
	}
	else if(!emailVal.test(email))
	{
		alert("Email Address is not a valid format.");
		document.getElementById("email").focus();
	}
	else if(phone==""){
		alert("Phone Number field is blank");
		document.getElementById("phone").focus();
	}
	else if(country=="NONE"){
		alert("Please select a country");
	}
	else if(industry=="NONE"){
		alert("Please select an Industry/Field");
	}
	else if(company==""){
		alert("Company Name field is blank");
		document.getElementById("company").focus();
	}
	else if(relationship.toLowerCase()=="others" && relationshipOther==""){
			alert("Please select relationship in ADEC Solutions");
	}
	else if(subject=="")
	{
		alert("Subject field is blank.");
		document.getElementById("subject").focus();
	}
	else if(comments=="")
	{
		alert("Comments field is blank.");
		document.getElementById("comments").focus();
	}
	else if (captcha == "")
	{
		
		alert("Code field is blank");	
		document.getElementById("6_letters_code").focus();
	}
	else
	{
		document.forms['captchaForm'].submit();
		//alert("Thank You! Your email has been sent.");
	}

}         

function doValidationForRequest()
{	

	var lastName,firstName,email,subject,comments;
	firstName=document.getElementById("firstName").value;
	lastName=document.getElementById("lastName").value;
	email=document.getElementById("email").value;
	phone=document.getElementById("phone").value;
	country=document.getElementById("country").value;
	company=document.getElementById("company").value;
	jobtitle=document.getElementById("jobtitle").value;	
	relationship=document.getElementById("relationship").value;
	comments=document.getElementById("comments").value;
	relationshipOther=document.getElementById("relationshipOther").value;

	emailVal = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	
	if(firstName=="")
	{
		alert("First Name field is blank.");
		document.getElementById("firstName").focus();
	}
	else if(lastName=="")
	{
		alert("Last Name field is blank.");
		document.getElementById("lastName").focus();	
	}
	else if(email=="")
	{
		alert("Email Address field is blank.");
		document.getElementById("email").focus();
	}
	else if(!emailVal.test(email))
	{
		alert("Email Address is not a valid format.");
		document.getElementById("email").focus();
	}
	else if(phone==""){
		alert("Phone Number field is blank");
		document.getElementById("phone").focus();
	}
	else if(country=="NONE"){
		alert("Please select a country");
	}
	else if(industry=="NONE"){
		alert("Please select an Industry/Field");
	}
	else if(company==""){
		alert("Company Name field is blank");
		document.getElementById("company").focus();
	}
	else if(relationship=="Others"){
		if(relationshipOther==""){
			alert("Please select relationship in ADEC Solutions");
		}
	}
	else if(subject=="")
	{
		alert("Subject field is blank.");
		document.getElementById("subject").focus();
	}
	else if(comments=="")
	{
		alert("Comments field is blank.");
		document.getElementById("comments").focus();
	}
	else
	{
		document.forms['contact'].action = "thankyou.php";
		document.forms['contact'].enctype = "multipart/form-data";
		document.forms['contact'].method = "POST";
		document.forms['contact'].target = "_self";
		document.forms['contact'].submit();
//		alert("Thank You! Your email has been sent.");
	}

}


  

