// JavaScript Document

function validate()
{
	if(document.getElementById('logg').value=="")
	{
		alert("Please provide your login");	
		document.getElementById('logg').focus();
		return false;
	}
	else if(document.getElementById('logg').value=="  Enter Username")
	{
		alert("Please provide your login");	
		document.getElementById('logg').focus();
		return false;
	}
	else if(document.getElementById('pw').value=="")
	{
		alert("Please provide your password");	
		document.getElementById('pw').focus();
		return false;
	}
	else if(document.getElementById('pw').value=="password")
	{
		alert("Please provide your password");	
		document.getElementById('pw').focus();
		return false;
	}
	else
	{
		loggedin();	
	}
}
function getNewHTTPObject1()
{
        var xmlhttp;

        /** Special IE only code ... */
        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xmlhttp = false;
                  }
             }
          @else
             xmlhttp = false;
        @end @*/

        /** Every other browser on the planet */
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xmlhttp = new XMLHttpRequest();
            }
            catch (e)
            {
                xmlhttp = false;
            }
        }

        return xmlhttp;
}
function loggedin()
{
//alert(p);
//alert("a");
   var strURL="vallogin.php?u="+document.getElementById('logg').value+"&pw="+document.getElementById('pw').value;
//alert("b");
//var xmlhttp1 = new ActiveXObject("Msxml2.XMLHTTP");
//var xmlhttp1 =new xmlhttpRequest();
var xmlhttp1 = getNewHTTPObject1();

//alert("c");
   if (xmlhttp1)
   {
//alert("d");
     xmlhttp1.onreadystatechange = function()
     {
      if (xmlhttp1.readyState == 4)
      {
	 // only if “OK”
	 if (xmlhttp1.status == 200)
         {
		// alert("e");
	    document.getElementById("l").innerHTML=xmlhttp1.responseText;
		//alert(xmlhttp1.responseText);
		//$('scatsdiv').innerHTML=xmlhttp.responseText;
		 //alert("f");
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
	 }
       }
      }
   xmlhttp1.open("GET", strURL, true);
   xmlhttp1.send(null);
   }
}
