function logchk(str1,str2) {  // This function does the AJAX request

  //  Set our destination PHP page "ajaxpost.php"…
alert(str1+str2);
if (str1!="" && str2!="")
{
if (str1.indexOf(".") > 0 && str1.indexOf("@") > 0)
{
if (document.getElementById('rpwdchk').checked){
var str3="1";
}
else
{
var str3="";
}

  http.open("POST", "loginpost.php", true);
  http.onreadystatechange = getHttpRes1;

  // Make our POST parameters string…
  //var params = "userid1=" + encodeURI(str1);

var params = "userid1=" + encodeURI(str1)+
	"&pwd1=" + encodeURI(str2)+
	"&str3=" + encodeURI(str3);
	
  // Set our POST header correctly…
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…
  http.send(params);
}
else
{
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Incorrect test UserID</font>";
					//document.getElementById('useridtxt').focus();
setTimeout(function(){useridtxt.focus();useridtxt.select();},10);
}
}
else
{
//alert("Enter UserID");
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Enter UserID/Password</font>";
//document.getElementById('useridtxt').focus();
setTimeout(function(){useridtxt.focus();useridtxt.select();},10);
}
}




function rpwdchk(str1) {  // This function does the AJAX request

  //  Set our destination PHP page "ajaxpost.php"…
//alert (str1);
if (str1!="")
{
if (str1.indexOf(".") > 0 && str1.indexOf("@") > 0)
{
  http.open("POST", "rpwdchk.php", true);
  http.onreadystatechange = getHttpRes2;

  // Make our POST parameters string…
  //var params = "userid1=" + encodeURI(str1);

var params = "userid1=" + encodeURI(str1);
  // Set our POST header correctly…
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…
  http.send(params);
}
else
{
//alert ("sdsd");
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Incorrect UserID</font>";
					//document.getElementById('useridtxt').focus();
setTimeout(function(){useridtxt.focus();useridtxt.select();},10);
}
}
else
{
document.getElementById('useridtxt').value="-Username-";
}
}
function rpwdstore(str1,str2) {  // This function does the AJAX request

  //  Set our destination PHP page "ajaxpost.php"…
//alert (str1);
if (str1!="" && str2!="")
{
if (str1.indexOf(".") > 0 && str1.indexOf("@") > 0)
{
var chk = document.getElementById('rpwdchk').checked;
var chkvalue="";
if (chk)
{
chkvalue="Y";
}
else
{
chkvalue="N";
}
  http.open("POST", "rpwdstore.php", true);
  http.onreadystatechange = getHttpRes3;

  // Make our POST parameters string…
var params = "userid1=" + encodeURI(str1)+
	"&chkvalue=" + encodeURI(chkvalue);
  // Set our POST header correctly…
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…
  http.send(params);
}
else
{
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Incorrect UserID</font>";
					//document.getElementById('useridtxt').focus();
setTimeout(function(){useridtxt.focus();useridtxt.select();},10);

var chk = document.getElementById('rpwdchk').checked;
var chkvalue="";
if (chk)
{
document.getElementById('rpwdchk').checked=false;
}
else
{
document.getElementById('rpwdchk').checked=true;
}


}
}
else
{
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Enter UserID/Password</font>";
setTimeout(function(){useridtxt.focus();useridtxt.select();},10);
var chk = document.getElementById('rpwdchk').checked;
var chkvalue="";
if (chk)
{
document.getElementById('rpwdchk').checked=false;
}
else
{
document.getElementById('rpwdchk').checked=true;
}
}
}


function dispfpwd()
{

var ftxt="";
ftxt = "<table width='100%'  border='0' cellpadding='0' cellspacing='0'  bordercolorlight='#999999'>";
ftxt = ftxt + "<tr>";
ftxt = ftxt + "<td align='right'><img id='closeBut' style='cursor:pointer;cursor:hand;' onMouseout='lightup_close(2)' onMouseover='lightup_close(1)' src='images/close.jpg' border='0' onClick='closepwd()'></td></tr>";
ftxt = ftxt + "<tr><td height='24' width='40%' class='style3' align='center'>Forgot Password</td></tr>";
ftxt = ftxt + "<tr height='25'>";
ftxt = ftxt + "<td width='33%' align='center'><span class='style17'>Enter your registered email ID</span></td></tr>";
ftxt = ftxt + "<tr height='40'><td width='67%' align='center'>";
ftxt = ftxt + "<input name='useridtxt' type='text' id='useridtxt12' style='border: 1px solid black' size='20' >";
ftxt = ftxt + "</td>";
ftxt = ftxt + "</tr>";
ftxt = ftxt + "<tr height='30'>";
ftxt = ftxt + "<td>";
ftxt = ftxt + "<div align='center'><img onMouseout='lightup12(2)' style='cursor:pointer;cursor:hand;' onMouseover='lightup12(1)' src='Buttons/submit.png' border='0' id='pic3'   onClick='logchk1(useridtxt12.value)'>";
ftxt = ftxt + "</div></td>";
ftxt = ftxt + "</tr>";
ftxt = ftxt + "</table>";
document.getElementById("fpwd").innerHTML=ftxt;
}


function closepwd()
{
document.getElementById("fpwd").innerHTML="";
}


function logchk1(str1,str2,str3) {  // This function does the AJAX request

if(str2 =="")
{
if (str1!="")
{
if (str1.indexOf(".") > 0 && str1.indexOf("@") > 0)
{
	
  http.open("POST", "loginpost1.php", true);
  http.onreadystatechange = getHttpRes4;

  // Make our POST parameters string…
  //var params = "userid1=" + encodeURI(str1);

var params = "userid1=" + encodeURI(str1);

  // Set our POST header correctly…
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…
  http.send(params);
}
else
{
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Incorrect UserID</font>";
					//document.getElementById('useridtxt').focus();
setTimeout(function(){useridtxt1.focus();useridtxt.select();},10);
}
}
else
{
//alert("Enter UserID");
document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Enter UserID</font>";
//document.getElementById('useridtxt').focus();
setTimeout(function(){useridtxt1.focus();useridtxt.select();},10);
}

}
else
{
	if (str1!="" && str3!="" )
	{
		  http.open("POST", "loginpost1.php", true);
		  http.onreadystatechange = getHttpRes4;
		  var params = "userid1=" + encodeURI(str1);
		  params = params + "&userid2=" + encodeURI(str3);
		  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		  http.setRequestHeader("Content-length", params.length);
		  http.setRequestHeader("Connection", "close");
		  http.send(params);
	}
	else
	{
		//alert("Enter UserID");
		document.getElementById("ltxt").innerHTML="<font face='Tahoma' size='2' color='#FF0000'>Enter UserID & Last name</font>";
		//document.getElementById('useridtxt').focus();
		setTimeout(function(){useridtxt1.focus();useridtxt.select();},10);
	}
}



}


function getHttpRes1( ) {
  if (http.readyState == 4 && http.status == 200) { 
    res = http.responseText;  // These following lines get the response and update the page
//    document.getElementById('ltxt').innerHTML = res;


var data=res;
var data=data.split("|");
var v = data[1];
document.getElementById("ltxt").innerHTML=data[0];



if ( v=="2")
{
//document.getElementById("ctxt").innerHTML=data1[0];
//document.getElementById('useridtxt').focus();
//setTimeout(function(){useridtxt.focus();useridtxt.select();},10);
//window.open = 'services.php';
//window.location.href='explain.php?id=8';
window.location.href='index.php';
}

  }
else
{
document.getElementById('ltxt').innerHTML = "<div align='center'><img src='flower.gif'></div>";
//document.getElementById('english1').focus();
}
}



function getHttpRes2( ) {
  if (http.readyState == 4 && http.status == 200) { 
    res = http.responseText;  // These following lines get the response and update the page

var data=res;
var data=data.split("|");
var v = data[1];
if ( v=="2")
{
document.getElementById('rpwdchk').checked=true;
document.getElementById('pwdtxt').value=data[0];
}
else
{
document.getElementById('rpwdchk').checked=false;
}
  }
}

function getHttpRes3( ) {
  if (http.readyState == 4 && http.status == 200) { 
    res = http.responseText;
  }
}


function getHttpRes4( ) {
  if (http.readyState == 4 && http.status == 200) { 
    res = http.responseText;  // These following lines get the response and update the page
//    document.getElementById('ltxt').innerHTML = res;


var data=res;
var data=data.split("|");
var v = data[1];
document.getElementById("ltxt").innerHTML=data[0];

if ( v=="2")
{
//document.getElementById("ctxt").innerHTML=data1[0];
//document.getElementById('useridtxt').focus();
//setTimeout(function(){useridtxt.focus();useridtxt.select();},10);
//window.open = 'services.php';
//window.location.href='/quicketch/explain.php';
document.getElementById("fpwd").innerHTML="";
}

  }
else
{
document.getElementById('ltxt').innerHTML = "<div align='center'><img src='flower.gif'></div>";
//document.getElementById('english1').focus();
}
}



function getXHTTP( ) {
  var xhttp;
   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
      xhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
 		 // This block handles Mozilla/Firefox browsers...
	    try {
	      xhttp = new XMLHttpRequest();
	    } catch (e3) {
	      xhttp = false;
	    }
      }
    }
  return xhttp; // Return the XMLHTTP object
}

var http = getXHTTP(); // This executes when the page first loads.


///Forgot User name


function dispname()
{
/*
var ftxt="";
ftxt = "<table width='100%'  border='0' cellpadding='0' cellspacing='0'  bordercolorlight='#999999'>";
ftxt = ftxt + "<tr>";
ftxt = ftxt + "<td align='right'><img src='images/close.jpg' border='0' onClick='closepwd()'></td></tr>";
ftxt = ftxt + "<tr><td height='24' width='40%' class='style3' align='center'>Forgot User ID</td></tr>";
ftxt = ftxt + "<tr height='25'>";
ftxt = ftxt + "<td width='33%' align='center'><span class='style17'>Enter registered First Name</span></td></tr>";
ftxt = ftxt + "<tr height='40'><td width='67%' align='center'>";
ftxt = ftxt + "<input name='useridfname' type='text' id='useridfname' style='border: 1px solid black' size='20' >";
ftxt = ftxt + "</td>";
ftxt = ftxt + "</tr>";

ftxt = ftxt + "<tr height='25'>";
ftxt = ftxt + "<td width='33%' align='center'><span class='style17'>Enter registered Last Name</span></td></tr>";
ftxt = ftxt + "<tr height='40'><td width='67%' align='center'>";
ftxt = ftxt + "<input name='useridlname' type='text' id='useridlname' style='border: 1px solid black' size='20' >";
ftxt = ftxt + "</td>";
ftxt = ftxt + "</tr>";

ftxt = ftxt + "<tr height='30'>";
ftxt = ftxt + "<td>";
	ftxt = ftxt + "<div align='center'><img src='Buttons/submit.png' border='0' onClick='logchk1(useridfname.value,2,useridlname.value)'>";
ftxt = ftxt + "</div></td>";
ftxt = ftxt + "</tr>";
ftxt = ftxt + "</table>";
*/


var ftxt="";
ftxt = "<table width='100%'  border='0' cellpadding='0' cellspacing='0'  bordercolorlight='#999999'>";
ftxt = ftxt + "<tr>";
ftxt = ftxt + "<td align='right'><img src='images/close.jpg' border='0' onClick='closepwd()'></td></tr>";
ftxt = ftxt + "<tr><td height='24' width='40%' class='style3' align='center'>Forgot User name</td></tr>";
ftxt = ftxt + "<tr height='25'>";
ftxt = ftxt + "<td width='33%' align='center'><span class='style17'>Registered email ID is your User name</span></td></tr>";
ftxt = ftxt + "</table>";
document.getElementById("fpwd").innerHTML=ftxt;
}















function passset(str1) {  // This function does the AJAX request


	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	var url="loginpost2.php"
	url=url+"?userid1="+str1
	
	//url=url+"&sid="+surgeons
	//alert(url)
	//document.getElementById("suca_display").innerHTML='Please wait..<img border="0" src="images/ajax-loader.gif">'
	if(xmlHttp.onreadystatechange=stateChanged)
	{
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		return true;
	}
	else
	{
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		return false;
	}


}

function stateChanged() 
{ 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
			document.getElementById("ltxt").innerHTML=xmlHttp.responseText
			document.getElementById('pwdtxt').focus()
			return true;
	} 
} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
//UnTip
