function checkvalid()
{ 
	//document.Inquiry.submit();
	//return true;
	
	if(document.Inquiry.name.value.length < 1)
	{
		alert("Please Enter Name");
		document.Inquiry.name.focus();
		return false;
	}
	if(document.Inquiry.company.value.length < 1)
	{
		alert("Please Enter Company Name");
		document.Inquiry.company.focus();
		return false;
	}
	
	var i;
	var input = document.Inquiry.email.value ;
	var lenth = input.length ;
	var ctr=0 ;
	if ( ( document.Inquiry.email.value.charAt(i) == '!' ) || ( document.Inquiry.email.value.charAt(i) == '#' ) )
    {
	  alert("Please enter a proper email address") ;
	  document.Inquiry.email.focus();
      return false;
    }
	if (input =="")
	{
		alert("Please enter email address") ;
	    document.Inquiry.email.focus();
		return false ;
	}
	if(input.length == 40)
	{
		alert("Please enter a proper email address") ;
	    document.Inquiry.email.focus();
		return false ;
	}

	for ( i=0; i < lenth; i++ )
	{
		var oneChar = input.charAt(i) ;
		if(oneChar == "@")
		{
			ctr = ctr+1 ;
		}
		if ( (i == 0 && oneChar == "@") || (i == 0 && oneChar == ".") || 
			( oneChar == " " ) )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.Inquiry.email.focus();
			return false ;
		}
		if ( (oneChar == "@" && input.charAt(i+1) == ".") || 
			(oneChar == "." && input.charAt(i+1) == "@") ||
			(oneChar == "." && input.charAt(i+1) == ".") )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.Inquiry.email.focus();
			return false ;
		}
		if( input.indexOf("@") < 2 )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.Inquiry.email.focus();
			return false ;
		}
	}
	
	if(document.Inquiry.country.selectedIndex ==0)
	{
		alert("Please Select Country Name From List");
		document.Inquiry.country.focus();
		return false;
	}
	if(document.Inquiry.requirement.value.length <1)
	{
		alert("Please enter your requirements...");
		document.Inquiry.requirement.focus();
		return false;
	}	
	CheckValidationText();
}	


function CheckValidationText()
{ 
	var vText;
	if(document.getElementById('VI'))
		vText = document.getElementById('VI').value;
	else
		vText = "";
	var url = "validate.php?vText="+vText;
	
	if (window.XMLHttpRequest)
  	{
  		http=new XMLHttpRequest()
  		http.open("GET",url,true)
	  	http.onreadystatechange=function (){
			if (http.readyState == 4) 
			{	
    	  		isWorking = false;
    			if (http.responseText.indexOf('invalid') == -1) 
				{
					var xmlDocument = http.responseXML;
					var existId = xmlDocument.getElementsByTagName('msg').item(0).firstChild.data;
					if(existId == "0"){
						alert("Validation string not valid! Please try again");
						return false;
					}
					else
					{
						document.Inquiry.submit();
					}	
						
				}
			}
		}
	  	http.send(null)
  	}
	// code for IE
	else if (window.ActiveXObject)
  	{
  		http=new ActiveXObject("Microsoft.XMLHTTP")
    	if (http)
    	{
    		http.open("GET",url,true)
    		http.onreadystatechange=function (){
				if (http.readyState == 4) 
				{	
    		  		isWorking = false;
    				if (http.responseText.indexOf('invalid') == -1) 
					{
						var xmlDocument = http.responseXML; 
						var existId  = xmlDocument.getElementsByTagName('msg').item(0).firstChild.data;
						if(existId == "0")
						{
							alert("Validation string not valid! Please try again");
							return false;
						}
						else
						{
							document.Inquiry.submit();
						}	
						
					}
					
				}
			}	
    		http.send()
    	}
  	}
}
// Cross Browser FIX AS - for HTML validation
function cssmaker(){
	var browserName=navigator.appName;
	if (browserName!="Microsoft Internet Explorer"){
		document.write('<style>.tabblock .heading{margin-top:12px;}</style>')
	}
}

//window.onload=cssmaker();