// JavaScript Document


function validation()
{
	//var expTelephone = /[^+\d|\s]+/;
	//var expTelephone = /^[+]{0,1}\d+([-\s]{0,1}\d+)*$/;
	var expTelephone = /^[+]{0,1}\d+([-\s]{0,5}\d+)+([\s]+)*$/;
	var expname=/[^A-Za-z\s\.\'-]+/;
	var expreq=/[^A-za-z0-9\s\.\'-]+/;
	/*if(document.frmQuotation.requirements.value.replace(/\s/g,'')=="")
	{
		alert("Please enter your requirements."); 
		document.frmQuotation.requirements.value="";
		document.frmQuotation.requirements.focus();
		return false;
	}*/
	if(expreq.test(document.frmQuotation.requirements.value)==true)
	{
		alert("Please enter your requirements.");
		document.frmQuotation.requirements.value="";
		document.frmQuotation.requirements.focus();
		return false;
	}
	if(document.frmQuotation.name.value.replace(/\s/g,'')=="")
	{
		alert("Please enter your name. \nFor example: Rahul Saxena"); 
		document.frmQuotation.name.value="";
		document.frmQuotation.name.focus();
		return false;
	}
	if(expname.test(document.frmQuotation.name.value)==true)
	{
		alert("Please enter your name.");
		document.frmQuotation.name.value="";
		document.frmQuotation.name.focus();
		return false;
	}
	if(document.frmQuotation.email.value.replace(/\s/g,'')=="")
	{
		alert("Please enter your email address.\nFor example, rahul@gmail.com");
		document.frmQuotation.email.value="";
		document.frmQuotation.email.focus();
		return false;
	}
	
   else if(!/^\w+([\.\']?-*\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.frmQuotation.email.value))
	{
		alert("Please enter a valid email address.\nFor example, rahul@gmail.com");
		document.frmQuotation.email.focus();
		return false;
	}	
	if (document.frmQuotation.contact.value=='') {
		alert("Please enter your contact number");
		document.frmQuotation.contact.focus();
		return false;
	}
	if (expTelephone.test(document.frmQuotation.contact.value)==false)
	{
		alert("Please enter valid contact number");
	    document.frmQuotation.contact.focus();
		return false;		
	}
	var num=document.frmQuotation.contact.value;
	//alert(num.length);
	if(num.length<10)
	{
		alert("Please enter valid contact number inculding area code");
	    document.frmQuotation.contact.focus();
		return false;
	}
	if (document.frmQuotation.list.value=='' || document.frmQuotation.list.value=='--- Select One ---') {
		alert("Please select any nature of business");
		document.frmQuotation.list.focus();
		return false;
	}
	
	
return true;
}
	
function changeBorder(n){
	switch(n){
		case 1:
			document.getElementById("requirements").style.borderColor="#5F6061";
			document.getElementById("requirements").style.backgroundColor="#F5F7F8";
		break;
		
		case 2:
			document.getElementById("name").style.borderColor="#5F6061";
			document.getElementById("name").style.backgroundColor="#F5F7F8";
		break;
		
		case 3:
			document.getElementById("email").style.borderColor="#5F6061";
			document.getElementById("email").style.backgroundColor="#F5F7F8";
		break;	
		
		case 4:
			document.getElementById("contact").style.borderColor="#5F6061";
			document.getElementById("contact").style.backgroundColor="#F5F7F8";
		break;
				
	}
}

function changeBorderBack(n){
	switch(n){
		case 1:
			document.getElementById("requirements").style.borderColor="#747e83";
			document.getElementById("requirements").style.backgroundColor="#E9F0F3";
		break;
		case 2:
			document.getElementById("name").style.borderColor="#747e83";
			document.getElementById("name").style.backgroundColor="#E9F0F3";
		break;
		
		case 3:
			document.getElementById("email").style.borderColor="#747e83";
			document.getElementById("email").style.backgroundColor="#E9F0F3";
		break;
		
		case 4:
			document.getElementById("contact").style.borderColor="#747e83";
			document.getElementById("contact").style.backgroundColor="#E9F0F3";
		break;
		
	}
}
