function validate()
	{
		if((document.form1.last_name.value=="") || (document.form1.last_name.value=="*Name"))
		{
			alert("Please Enter Value for Name Field");
			document.form1.last_name.focus();
			return false;
		}
		
		if((document.form1.email.value=="") || (document.form1.email.value=="*E-Mail"))
		{
			alert("Please Enter Value for E-Mail Field");
			document.form1.email.focus();
			return false;
		}
		if(!isEmail(document.form1.email.value))
  			{	 alert("Please enter the valid email address.");
	 			document.form1.email.select();
	 			document.form1.email.focus();
	 			return false; 
	 		}
		
		if((document.form1.mobile.value == "") || (document.form1.mobile.value == "*Mobile"))
		{
			alert("Please Enter Your Mobile Number");
			document.form1.mobile.focus();
			return false;
		}
		else if(!ValidateNo(document.form1.mobile.value," 1234567890,-/+"))
		{
			alert("Invalid Number!");
			document.form1.mobile.focus();
			return false;
		}
	
		else if(document.form1.mobile.value.length < 10)
		{
			alert("Invalid Number!");
			document.form1.mobile.focus();
			return false;
		}
		
		if(document.form1.country.value=="#")
		{
			alert("Please Select a Value for Country Field");
			document.form1.country.focus();
			return false;
		}
		if (document.form1.country.value=="India")
		{
			if(document.form1.state.value=="")
			{
				alert("Please Enter Value for State Field");
				document.form1.state.focus();
				return false;
			}	
		}
		else
		{
			if((document.form1.outerstate.value=="") || (document.form1.outerstate.value=="*State"))
			{
				alert("Please Enter Value for State Field");
				document.form1.outerstate.focus();
				return false;
			}	
		}
		
		if((document.form1.city.value=="") || (document.form1.city.value=="*Current City"))
		{
			alert("Please Enter Value for City Field");
			document.form1.city.focus();
			return false;
		}	
		
		if((document.form1.qproject.value !="Construction") && (document.form1.qproject.value !="Miscellaneous (Hotels, Schools, Hospitals & Civil Construction)") && (document.form1.qproject.value !="Hospitality"))
		{

		if(document.form1.rproject.value=="")
		{
			alert("Please Select Project Name");
			document.form1.rproject.focus();
			return false;
		}
		}			
		
			if(document.form1.country.value == 'India')
			{
				document.getElementById('state').value=	document.form1.state.value;
			}
				else
			{
				document.getElementById('state').value=document.form1.outerstate.value;
			}		
		
	return true;		
	}


function isEmail (emailIn){
	var isEmailOk = false;
	var filter = /^[a-zA-Z0-9][a-zA-Z0-9._-]*\@[a-zA-Z0-9-]+(\.[a-zA-Z][a-zA-Z-]+)+$/
	 // var filter = /^(([^<>()[\]\\.,;:\s@\”]+(\.[^<>()[\]\\.,;:\s@\”]+)*)|(\”.+\”))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/

	if(emailIn.search(filter) != -1)
		isEmailOk = true;
	if(emailIn.indexOf("..") != -1)
		isEmailOk = false;
	if(emailIn.indexOf(".@") != -1)
		isEmailOk = false;

	return isEmailOk;
}

function ValidateNo( NumStr, String )
{
	for( var Idx = 0; Idx < NumStr.length; Idx ++ )
	{
		var Char = NumStr.charAt( Idx );
		var Match = false;
		for( var Idx1 = 0; Idx1 < String.length; Idx1 ++)
		{
			if( Char == String.charAt( Idx1 ) )
			Match = true;
		}
		if ( !Match )
		return false;
	}
	return true;
}

function IntCheck()
	{
		if ((event.keyCode>=48 && event.keyCode<=57) || event.keyCode==44 )
			{
			}
		else
				{
					alert("Please Enter in Digit Only.")
					event.keyCode=0
				}
	}


function checkIt(el) {
if ((el.value != "Construction") && (el.value != "Miscellaneous (Hotels, Schools, Hospitals & Civil Construction)") ){
document.getElementById('proname').style.display = "block";
document.getElementById('probudget').style.display = "block";
} else {
 document.getElementById('proname').style.display = "none";
 document.getElementById('probudget').style.display = "none";
}
}

function checkIt1(el1) {
if ((el1.value != "Residential")) {
document.getElementById('probudget').style.display = "none";
}
else {
 document.getElementById('probudget').style.display = "block";
}
}

function checkIt1_bud() {
if ((document.getElementById('qproject').value != "Residential")) {
document.getElementById('probudget').style.display = "none";

}
else {
 document.getElementById('probudget').style.display = "block";
}
}

function toggleState(chosen) {
if(document.form1.country.value == 'India') {
	document.form1.outerstate.style.display = 'none';
	document.form1.state.style.display = '';

}else {

	document.form1.outerstate.style.display = '';
	document.form1.state.style.display = 'none';
	document.form1.state.value = 'Andhra Pradesh';
}
}

function fillvalue()
{		
if(document.form1.country.value == 'India')
	{
		document.getElementById('state').value=	document.form1.state.value;
	}
		else
	{
		document.getElementById('state').value=document.form1.outerstate.value;
	}
		
		var currDate = new Date();
		var currmonth
		var currhour
		var val ="AM";
		if(currDate.getHours() > 11)
			{
				val = "PM";
			}
			currmonth=currDate.getMonth()+1
				if (currDate.getHours()>12 )
				{
					currhour=currDate.getHours()-12
				}
			document.getElementById("00N900000014hgN").value = currDate.getDate() + "/" + currmonth + "/" + currDate.getFullYear() + " " + currhour + ":" + currDate.getMinutes() + " " + val;
		}

function checkword(p1)
{
	if (p1.value.split(' ').length==31)
	{
		return false;
	}
}

function checkalpha(e) {
var allow='1234567890'
     var k;
     k=document.all?parseInt(e.keyCode): parseInt(e.which);
     return (allow.indexOf(String.fromCharCode(k))==-1);
}
