function uservalidate()
{
	var  username =  document.getElementById("username").value;
	var password =  document.getElementById("password").value;
	
if (username.length ==0 && password.length == 0)
  {
	  document.getElementById("txtHint").innerHTML="Fill username and password";
      return 0;
  }
    document.getElementById("txtHint").innerHTML="Processing Form......";
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    var rs = xmlhttp.responseText;
	
	if(rs == 0)
	{
		
		document.getElementById("txtHint").innerHTML="Username and password are incorrect";
        return 0;
	}
	else
	{
	document.location='setinfo.php?UserID='+rs;
	return 1;
	}
    }
  }

  var url ="setcookie_login.php?u="+username+"&p="+password;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
function checkcookie()
{
	
	//document.getElementById("txtHint").innerHTML="Processing Form......";
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    var rs = xmlhttp.responseText;
	
	if(rs == 0)
	{
		
		return true;
	}
	if(rs==1)
	{
	document.location='member/gallery.php';
	
	}
    }
  }

  var url ="check_cookie.php";
  
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
