var xmlHttp

function showHint(str)
{
	if (str.length==0)
	{ 
		document.getElementById("txtHint").innerHTML="";
		return;
	}

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	var url="get.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ajax() {
	// Make a new XMLHttp object
	
	if (typeof window.ActiveXObject != 'undefined' )
	{ 
		doc =GetXmlHttpObject();
	}
	else
		doc = new XMLHttpRequest();
		

/*		
alert(typeof XMLHttpRequest === "function");
alert(Object.prototype.toString.call(XMLHttpRequest));
alert(typeof XMLHttpRequest.toString);*/
		
}


function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		
	   // If IE7, Firefox, Opera 8.0+, Safari, and so on: Use native object.
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			// ...otherwise, use the ActiveX control for IE5.x and IE6.
    		 xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			//xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	//alert(xmlHttp);
	return xmlHttp;
}

function Valid_Inquiry(frm)
{
 	var checkFocus=0;
	
	if(frm.name.value=='')
	{	
		document.getElementById("Infoname").innerHTML="<span class='alert'>Please Enter Name.</span>";
		if(checkFocus!=1)
		{	frm.name.focus();				checkFocus=1;			}
	}
	else
		document.getElementById("Infoname").innerHTML="";
		

	if(frm.email.value=='')
	{	
		document.getElementById("Infoemail").innerHTML="<span class='alert'>Please enter email address.</span>";
			if(checkFocus!=1)
			{
				frm.email.focus();
				var checkFocus=1;
			}
	}
	else
	{
		var frmEmail1 =frm.email.value.toLowerCase();	
		var frmEmailformat = /^[^@\s]+@([-a-z0-9]+\.)+([a-z]{2}|com|net|edu|org|gov|mil|int|biz|pro|info|arpa|aero|coop|name|museum)$/;
		if (!frmEmailformat.test(frmEmail1)) 
		{
			document.getElementById("Infoemail").innerHTML="<span class='alert'>Please enter valid email address.</span>";
			if(checkFocus!=1)
				frm.email.focus();	
			var checkFocus=1;
		}
		else
		{
		   	document.getElementById("Infoemail").innerHTML="";
		}
	
	}
	
	if(frm.mobile.value=='')
	{	
		document.getElementById("Infomobile").innerHTML="<span class='alert'>Please Enter Mobile No.</span>";
			if(checkFocus!=1)
			{	frm.mobile.focus();				var checkFocus=1;			}
  
    }
	
   else 
    if(isNaN(frm.mobile.value))
	{
	document.getElementById("Infomobile").innerHTML="<span class='alert'>Please Enter Numeric value.</span>";
			if(checkFocus!=1)
			{	frm.mobile.focus();				var checkFocus=1;			}
	}
	else
		document.getElementById("Infomobile").innerHTML="";
	
	
	if(frm.subject.value=='')
	{	
		document.getElementById("Infosubject").innerHTML="<span class='alert'>Please Enter Subject</span>";
			if(checkFocus!=1)
			{	frm.subject.focus();				var checkFocus=1;			}
	}
	else
		document.getElementById("Infosubject").innerHTML="";
		
	if(frm.message.value=='')
	{	
		document.getElementById("Infomessage").innerHTML="<span class='alert'>Please Enter Query</span>";
			if(checkFocus!=1)
			{	frm.message.focus();				var checkFocus=1;			}
	}
	else
		document.getElementById("Infomessage").innerHTML="";
		
		
	if(checkFocus==1)
		return false;
	else
		return true;	

	

}



