var level='1';

function init(tab,id,sts){
	if (id <0) return false;
	if(tab==''){
		setTimeout("switchtab('div_personal',1)",500,"JavaScript");
	} else {
		setTimeout("switchtab("+tab+","+id +")",500,"JavaScript");
	}
}

function validatedata(id){
	//alert (id);
	if (id==3)
	{
		if(document.phpform.thlname.value == '')
		{
				alert("Login is not populated!");
		}
		else if(document.phpform.thlpwd.value == ''  || (document.phpform.thlpwd.value).length < 4) {
			alert("Password is too short or not populated!\nPassword should be atleast 4 characters long.");
		}
		else {
			var uname=document.phpform.thlname.value;
			var upwd=document.phpform.thlpwd.value;
			var url = "./getter/refreshtable.php?func=login&uname="+uname+"&upwd="+upwd+"&sid="+Math.random();
			document.getElementById("div_statusm").innerHTML="";
			request.open("GET", url, true);
  			request.onreadystatechange = loginredirect;
  			request.send(null);
		}
	} else if(id==1){
		 if(document.phpform.thname.value=='' || (document.phpform.thname.value).length < 4) {
			alert("'Desired User Login' not populated or too short! \nUser Login should be atleast 4 characters long.");
		} else if(document.phpform.thpwd.value =='' || (document.phpform.thpwd.value).length < 4 ) {
			alert("Password is too short or not populated! \nPassword should be atleast 4 characters long.");
		} else if(document.phpform.thpwd.value != document.phpform.thpwdc.value) {
			alert("Password, Confirm Password are not same.");
		
		} else if(document.phpform.themail.value=='') {
			alert("Email not populated!");
		} else if (!isvalidemail(document.phpform.themail.value)) {
			alert ("Email not valid!");
		/*} else if(document.phpform.thsque.value=='') {
			alert("Security Question not populated!");
		} else if(document.phpform.thsans.value=='') {
			alert("Security Answer not populated!");*/
		} else if (document.phpform.themail.value != document.phpform.themailc.value) {
			alert("Please reconfirm your email address!");
		} else if (document.phpform.thpwd.value != document.phpform.thpwdc.value) {
			alert ("Please reconfirm your Password!");
		} else {
			//alert ('Calling the Refreshtable');
			var vals = 'hs' + "|:" + document.phpform.thname.value + "|:" + 
			document.phpform.thpwd.value + "|:" + 
			document.phpform.themail.value + "|:" + 
			//document.phpform.thsque.value + "|:" + 
			//document.phpform.thsans.value;
			"" + "|:" + "";
			var url='';
			url = "./getter/refreshtable.php?func=hscoach&job=insert&vals="+vals+"&id=0&sid="+Math.random();
			document.getElementById("div_status1").innerHTML="";
			//alert (url);
	  		request.open("GET", url, true);
	  		request.onreadystatechange = updatePage;
	  		request.send(null);
		}
	} else if(id==2){
		if(document.phpform.thccname.value=='') {
			alert("Club Team Name not populated!");
		} else if(document.phpform.thcname.value=='' || (document.phpform.thcname.value).length<4) {
			alert("'Desired User Login' not populated or too short! \nUser Login should be atleast 4 characters long.");
		} else if(document.phpform.thcpwd.value =='' || (document.phpform.thcpwd.value).length < 4 ) {
			alert("Password is too short or not populated! \nPassword should be atleast 4 characters long.");
		} else if(document.phpform.thcpwd.value != document.phpform.thcpwdc.value ) {
			alert("Password, Confirm Password are not same.");
		} else if(document.phpform.thcemail.value=='') {
			alert("Email not populated!");
		} else if (!isvalidemail(document.phpform.thcemail.value)) {
			alert ("Email not valid!");
		} else if(document.phpform.thcsque.value=='') {
			alert("Security Question not populated!");
		} else if(document.phpform.thcsans.value=='') {
			alert("Security Answer not populated!");
		} else if (document.phpform.thcemail.value != document.phpform.thcemailc.value) {
			alert("Please reconfirm your email address!");
		} else if (document.phpform.thcpwd.value != document.phpform.thcpwdc.value) {
			alert ("Passwords do not match!");
		} else if (document.getElementById('clbdd')==null || document.getElementById('clbdd')[document.getElementById('clbdd').selectedIndex].value=='0') {
			alert ("Club not selected! If a club association is not registered please request a registration!");
		} else {
			//alert ('Calling the Refreshtable');
			var vals = 'club' + "|:" + document.phpform.thcname.value + "|:" + 
			document.phpform.thcpwd.value + "|:" + 
			document.phpform.thcemail.value + "|:" + 
			document.phpform.thcsque.value + "|:" + 
			document.phpform.thcsans.value + "|:" + document.getElementById('stdd')[document.getElementById('stdd').selectedIndex].value + "|:" + 
			document.getElementById('clbdd')[document.getElementById('clbdd').selectedIndex].value + "|:" + 
			document.phpform.thccname.value;
			var url='';
			url = "./getter/refreshtable.php?func=hscoach&job=insert&vals="+vals+"&id=0&sid="+Math.random();
			document.getElementById("div_status1").innerHTML="";
			//alert (url);
	  		request.open("GET", url, true);
	  		request.onreadystatechange = updatePage;
	  		request.send(null);
		}
	} else if(id==4){
		var clphone = (document.phpform.thcphonenum.value).replace(new RegExp("-","g"),"").replace(new RegExp(" ","g"),"").replace("(","").replace(")","");
		if(document.getElementById('stdd')[document.getElementById('stdd').selectedIndex].value=='0') {
			alert("State not selected!");
		} else if (document.getElementById('ctdd')==null || document.getElementById('ctdd')[document.getElementById('ctdd').selectedIndex].value=='0') {
			alert ("Club City not populated!");
		} else if(document.phpform.thcaszip.value=='' || !isNumeric(document.phpform.thcaszip.value) || document.phpform.thcaszip.value.length!=5) {
			alert("Club Association Zip not populated or not valid!\nIt should be numeric 5 digit value!");
		} else if(document.phpform.thcasnnm.value=='') {
			alert("Club Association Name not populated!");
		} else if(document.phpform.thcteamnm.value=='') {
			alert("Club Association Team Name not populated!");
		} else if(document.phpform.thccadd.value=='') {
			alert("Club Association Address not populated!");
		} else if(clphone=='' || !isNumeric(clphone) || clphone.length!=10) {
			alert("Club Association Phone not populated or not valid!\nIt has to be numeric 10 digit value!");
		} else if(document.phpform.thdrname.value=='') {
			alert("Director's Name is not populated!");
		} else if (document.phpform.thdremail.value=='') {
			alert ("Director's Email not populated!");
		} else if (!isvalidemail(document.phpform.thdremail.value)) {
			alert ("Director's Email not valid!\nIt should in the format xxx@xxxxx.xxx");
		} else if (document.phpform.thyrname.value=='') {
			alert ("Your Name is not populated!");
		} else if (document.phpform.thyrposition.value=='') {
			alert ("Your Position with the Association is not populated!");
		} else if (document.phpform.thyremail.value=='') {
			alert ("Your Email is not populated!");
		} else if (!isvalidemail(document.phpform.thyremail.value)) {
			alert ("Your Email not valid!\nIt should in the format xxx@xxxxx.xxx");
		} else if (document.phpform.thwebadd.value!=''&&!isvalideurl(document.phpform.thwebadd.value)) {
			alert ("Club Web Address not valid!\nIt should in the format www.xxxxx.xxx");
		} else {
			//alert ('Calling the Refreshtable');
			var vals = document.getElementById('stdd')[document.getElementById('stdd').selectedIndex].value + "|:" + 
			document.getElementById('ctdd')[document.getElementById('ctdd').selectedIndex].value + "|:" + 
			document.phpform.thcasnnm.value + "|:" + document.phpform.thcteamnm.value + "|:" + 
			document.phpform.thccadd.value + "|:" + clphone + "|:" + 
			document.phpform.thdrname.value + "|:" + document.phpform.thdremail.value + "|:" + 
			document.phpform.thwebadd.value + "|:" + document.phpform.thyrname.value + "|:" + 
			document.phpform.thyrposition.value + "|:" + document.phpform.thyremail.value + "|:" + document.phpform.thcaszip.value; 

			var url='';
			url = "./getter/refreshtable.php?func=hscoach&job=addclub&vals="+vals+"&id=0&sid="+Math.random();
			document.getElementById("div_status1").innerHTML="";
			//alert (url);
	  		request.open("GET", url, true);
	  		request.onreadystatechange = updatePage;
	  		request.send(null);
		}
	}
}

function updatePage() {
  if (request.readyState == 4) {
    if (request.status == 200) {
	  var res = request.responseText.split(":\n:");
	  //alert (request.responseText);
      if(res[0]=="Error") {
	    	document.getElementById("div_status1").innerHTML=res[1];  
	    	if(document.getElementById("div_status2")!=null) document.getElementById("div_status2").innerHTML=res[1];  
      } else if(res[0]=="Confirm") {
	    	document.getElementById("div_step1").innerHTML=res[1];  
	    	document.getElementById("div_step2").innerHTML=res[1];  
    		document.getElementById("div_current").style.visibility = "visible";
	    	document.getElementById("div_submit").style.visibility = "visible";
      } else {
      		document.getElementById("div_step1").innerHTML=request.responseText;
	    	if(document.getElementById("div_step2")!=null) document.getElementById("div_step2").innerHTML=request.responseText;  
    		if(document.getElementById("div_current")!=null) document.getElementById("div_current").style.visibility = "hidden";
	    	if(document.getElementById("div_submit3")!=null) document.getElementById("div_submit3").style.visibility = "hidden";
      }
    } else if (request.status == 404) {
      alert("Request URL does not exist");
    } else {
      alert("Error: status code is " + request.status);
    }
  }
}

function hslogin(id) {
	url = "./getter/refreshtable.php?func=hscoach&job=gotologin&id="+id+"&sid="+Math.random();
	//alert (url);
  	request.open("GET", url, true);
  	request.onreadystatechange = loadtologin;
  	request.send(null);
}

function deleteathlete(uid, cid, uname){
	url = "./getter/refreshtable.php?func=deleteathlete&uid="+uid+"&uname="+uname+"&cid="+cid+"&sid="+Math.random();
  	request.open("GET", url, true);
  	request.onreadystatechange = refreshConfirmAthlete;
  	request.send(null);
}

function refreshConfirmAthlete() {
  if (request.readyState == 4) {
    if (request.status == 200) {
    	ischanged=false;
		isdirty=false;
		var resp = eval(request.responseText);
		if( resp.status == 1)
			document.getElementById('div_results').innerHTML = resp.content;
	} else if (request.status == 404) {
      alert("Request URL does not exist");
    } else {
      if(request.status=='0') 
		  alert("Loading..");
      else
		  alert("Error: status code is " + request.status);
    }
  }
}

function loadtologin() {
  if (request.readyState == 4) {
    if (request.status == 200) {
	   //alert (request.responseText);
	  document.getElementById("div_main").innerHTML=request.responseText;
    } else if (request.status == 404) {
      alert("Request URL does not exist");
    } else {
      alert("Error: status code is " + request.status);
    }
  }
}

function switchtab(tab,id,th) {

	if (id <0 || !document.getElementById('div_personal')) return false;
	if(tab=='div_personal') {
		document.getElementById('div_personal').style.display	= "block";
		document.getElementById('div_academics').style.display	= "none";
		document.getElementById('div_athletic1').style.display	= "none";
		document.getElementById('div_athletic2').style.display	= "none";
		document.getElementById('div_athletic3').style.display	= "none";
		document.getElementById('tabpersonal').className = "mnuheaderactive";
		document.getElementById('tabacademics').className = "mnuheader";
		document.getElementById('tabathletic1').className = "mnuheader";
		document.getElementById('tabathletic2').className = "mnuheader";
		document.getElementById('tabathletic3').className = "mnuheader";
	} else if(tab=='div_academics'){
		setLevel();
		document.getElementById('div_personal').style.display	= "none";
		document.getElementById('div_academics').style.display	= "block";
		document.getElementById('div_athletic1').style.display	= "none";
		document.getElementById('div_athletic2').style.display	= "none";
		document.getElementById('div_athletic3').style.display	= "none";
		document.getElementById('tabpersonal').className = "mnuheader";
		document.getElementById('tabacademics').className = "mnuheaderactive";
		document.getElementById('tabathletic1').className = "mnuheader";
		document.getElementById('tabathletic2').className = "mnuheader";
		document.getElementById('tabathletic3').className = "mnuheader";


		document.getElementById('tabpersonal1').className = "mnuheader";
		th.className = "mnuheaderactive";
	} else if(tab=='div_athletic1'){
		document.getElementById('div_personal').style.display	= "none";
		document.getElementById('div_academics').style.display	= "none";
		document.getElementById('div_athletic1').style.display	= "block";
		document.getElementById('div_athletic2').style.display	= "none";
		document.getElementById('div_athletic3').style.display	= "none";
		document.getElementById('tabpersonal').className = "mnuheader";
		document.getElementById('tabacademics').className = "mnuheader";
		document.getElementById('tabathletic1').className = "mnuheaderactive";
		document.getElementById('tabathletic2').className = "mnuheader";
		document.getElementById('tabathletic3').className = "mnuheader";


		document.getElementById('tabpersonal1').className = "mnuheader";
		th.className = "mnuheaderactive";
	} else if(tab=='div_athletic2'){
		document.getElementById('div_personal').style.display	= "none";
		document.getElementById('div_academics').style.display	= "none";
		document.getElementById('div_athletic1').style.display	= "none";
		document.getElementById('div_athletic2').style.display	= "block";
		document.getElementById('div_athletic3').style.display	= "none";
		document.getElementById('tabpersonal').className = "mnuheader";
		document.getElementById('tabacademics').className = "mnuheader";
		document.getElementById('tabathletic1').className = "mnuheader";
		document.getElementById('tabathletic2').className = "mnuheaderactive";
		document.getElementById('tabathletic3').className = "mnuheader";


		document.getElementById('tabpersonal1').className = "mnuheader";
		th.className = "mnuheaderactive";
	} else if(tab=='div_athletic3'){
		document.getElementById('div_personal').style.display	= "none";
		document.getElementById('div_academics').style.display	= "none";
		document.getElementById('div_athletic1').style.display	= "none";
		document.getElementById('div_athletic2').style.display	= "none";
		document.getElementById('div_athletic3').style.display	= "block";
		document.getElementById('tabpersonal').className = "mnuheader";
		document.getElementById('tabacademics').className = "mnuheader";
		document.getElementById('tabathletic1').className = "mnuheader";
		document.getElementById('tabathletic2').className = "mnuheader";
		document.getElementById('tabathletic3').className = "mnuheaderactive";


		document.getElementById('tabpersonal1').className = "mnuheader";
		th.className = "mnuheaderactive";
	}
}

function setLevel(){
	if(!document.getElementById('level') && !(document.phpform.tlvl)) return false;
	//alert ("Setlevel:"+level);
	if(document.phpform.tlvl) if(document.phpform.tlvl.value=='High School') level='1'; else level='3'; 
	if(document.getElementById('level')) level=document.getElementById('level')[document.getElementById('level').selectedIndex].value;
	if(level=='1') {
		document.getElementById("div_hs").style.visibility = "visible";
		document.getElementById("div_club").style.visibility = "hidden";
		if(document.getElementById('thname')) document.getElementById('thname').tabIndex="1";
		if(document.getElementById('thpwd')) document.getElementById('thpwd').tabIndex="2";
		if(document.getElementById('thpwdc')) document.getElementById('thpwdc').tabIndex="3";
		if(document.getElementById('themail')) document.getElementById('themail').tabIndex="4";
		if(document.getElementById('themailc')) document.getElementById('themailc').tabIndex="5";
		//if(document.getElementById('thsque')) document.getElementById('thsque').tabIndex="6";
		//if(document.getElementById('thsans')) document.getElementById('thsans').tabIndex="7";
		if(document.getElementById('submit1')) document.getElementById('submit1').tabIndex="8";
	} else{
		if(document.getElementById('thccname')) document.getElementById('thccname').tabIndex="1";
		if(document.getElementById('thcname')) document.getElementById('thcname').tabIndex="2";
		if(document.getElementById('thcpwd')) document.getElementById('thcpwd').tabIndex="3";
		if(document.getElementById('thcpwdc')) document.getElementById('thcpwdc').tabIndex="4";
		if(document.getElementById('thcemail')) document.getElementById('thcemail').tabIndex="5";
		if(document.getElementById('thcemailc')) document.getElementById('thcemailc').tabIndex="6";
		if(document.getElementById('thcsque')) document.getElementById('thcsque').tabIndex="7";
		if(document.getElementById('thcsans')) document.getElementById('thcsans').tabIndex="8";
		if(document.getElementById('submit2')) document.getElementById('submit2').tabIndex="9";
		document.getElementById("div_hs").style.visibility = "hidden";
		document.getElementById("div_club").style.visibility = "visible";
	}   
}

function validateprofile(){

	var cphone1 = (document.phpform.thsmphn.value).replace(new RegExp("-","g"),"").replace(new RegExp(" ","g"),"").replace("(","").replace(")","");
	var cphone2 = (document.phpform.tcassmph.value).replace(new RegExp("-","g"),"").replace(new RegExp(" ","g"),"").replace("(","").replace(")","");
	err='error';
	if(document.phpform.tlvl) if(document.phpform.tlvl.value=='High School') level='1'; else level='3'; 
	if(document.getElementById('level')) level=document.getElementById('level')[document.getElementById('level').selectedIndex].value;
	
	if(document.phpform.thfname.value=='') {
		alert("Personal - FirstName not populated!");
	} else if(document.phpform.thlname.value=='') {
		alert("Personal - LastName not populated!");
	} else if(document.phpform.themail.value=='') {
		alert("Personal - Email not populated!");
	} else if (!isvalidemail(document.phpform.themail.value)) {
		alert ("Personal - Email not valid!");
	//} else if(document.phpform.tcyournm.value=='') {
	//	alert("Academic - Your Name not populated!");
	} else if(document.phpform.thswebadd.value!='' && !isvalideurl(document.phpform.thswebadd.value)) {
		alert("Academic - Invalid Web Address!\n Should be in www.XXXX.XXX format.");
	} else if(document.phpform.tcwebadd.value!='' && !isvalideurl(document.phpform.tcwebadd.value)) {
		alert("Academic - Invalid Web Address!\n Should be in www.XXXX.XXX format.");
	} else if(document.phpform.thsatwebadd.value!='' && !isvalideurl(document.phpform.thsatwebadd.value)) {
		alert("Academic - Invalid Athletic Web Address!\n Should be in www.XXXX.XXX format.");
	} else if(document.phpform.tcyrptwithass.value=='') {
		alert("Academic - Your Position not populated!");
	//} else if(document.phpform.tcyremailadd.value=='') {
	//	alert("Academic - Your Email not populated!");
	} else if(!document.phpform.tsprt1 && document.getElementById('spdd1')[document.getElementById('spdd1').selectedIndex].value=='0') {
		alert("Athletic 1 - Sport not selected!");
	} else if(level=='1') {
		if((!document.phpform.thsnm || document.phpform.thsnm.value=='') && (!document.getElementById('schdd') || document.getElementById('schdd')[document.getElementById('schdd').selectedIndex].value==0)) {
			alert("Academic - High School Name not selected/populated!");
		} else if(document.phpform.thsadd.value=='') {
			alert("Academic - High School Address not populated!");
		} else if(cphone1=='' || (cphone1!='' && (!isNumeric(cphone1) || cphone1.length!=10))) {
			alert("Academic - High School Phone not populated or not valid!\nIt has to be numeric 10 digit value!");
		} else if(document.phpform.thsardnm.value=='') {
			alert("Academic - High School Director Name not populated!");
		} else if(document.phpform.thsprnm.value=='') {
			alert("Academic - High School Principal Name not populated!");
		} else err='';
	} else if(level=='3') {
		if((!document.phpform.thcnm || document.phpform.thcnm.value=='') && (!document.getElementById('clbdd') || document.getElementById('clbdd')[document.getElementById('clbdd').selectedIndex].value==0)) {
			alert("Academic - Club Name not populated!");
		} else if(document.phpform.thcteamnm.value=='') {
			alert("Academic - Club Team Name not populated!");
		} else if(document.phpform.thccity && document.phpform.thccity.value=='') {
			alert("Academic - Club City not populated!");
		} else if(document.phpform.tchcaadd.value=='') {
			alert("Academic - Club Address not populated!");
		} else if(cphone2=='' || (cphone2!='' && (!isNumeric(cphone2) || cphone2.length!=10))) {
			alert("Academic - Club Phone not populated or not valid!\nIt has to be numeric 10 digit value!");
		} else if(document.phpform.tcdrnm.value=='') {
			alert("Academic - Club Director Name not populated!");
		} else if(document.phpform.tcdremail.value=='') {
			alert("Academic - Club Director Email not populated!");
		} else if (!isvalidemail(document.phpform.tcdremail.value)) {
			alert ("Academic - Club Director Email not valid!");
		} else err='';
	}
	
	if(err=='')	{
	
		var vals = level + "|:" + document.phpform.thfname.value + "|:" + document.phpform.thlname.value + "|:" + 
		document.getElementById('genderdd')[document.getElementById('genderdd').selectedIndex].value + "|:" +
		document.phpform.themail.value + "|:" +	'' + "|:" +// document.phpform.tcyournm.value + "|:" +
		document.phpform.tcyrptwithass.value + "|:" + ''; //	document.phpform.tcyremailadd.value;
		if(level=='1'){
			vals= vals + "|:" + '' + "|:" + //document.phpform.thscity.value + "|:" + 
			document.phpform.thsadd.value + "|:" + cphone1 + "|:" + 
			document.phpform.thsardnm.value + "|:" + document.phpform.thsprnm.value + "|:" + 
			document.phpform.thswebadd.value + "|:" + document.phpform.thsatwebadd.value; 
		} else {
			vals= vals + "|:" + '' + "|:" + //document.phpform.thccity.value + "|:" + 
			document.phpform.tchcaadd.value + "|:" + cphone2 + "|:" + 
			document.phpform.tcdrnm.value + "|:" + document.phpform.thcteamnm.value + "|:" + 
			document.phpform.tcwebadd.value + "|:" + document.phpform.tcdremail.value; 
		}
		
		if(document.phpform.tsprt1id) vals= vals + "|:" + document.phpform.tsprt1id.value;
		else vals= vals + "|:" +document.getElementById('spdd1')[document.getElementById('spdd1').selectedIndex].value;
		
		if(document.phpform.tsprt2id) vals= vals + "|:" + document.phpform.tsprt2id.value;
		else vals= vals + "|:" +document.getElementById('spdd2')[document.getElementById('spdd2').selectedIndex].value;
		
		if(document.phpform.tsprt3id) vals= vals + "|:" + document.phpform.tsprt3id.value;
		else vals= vals + "|:" +document.getElementById('spdd3')[document.getElementById('spdd3').selectedIndex].value;

		if(document.getElementById('schdd') && document.getElementById('schdd')[document.getElementById('schdd').selectedIndex].value!='0')
			vals= vals + "|:" +document.getElementById('schdd')[document.getElementById('schdd').selectedIndex].value;
		if(document.getElementById('clbdd') && document.getElementById('clbdd')[document.getElementById('clbdd').selectedIndex].value!='0')
			vals= vals + "|:" +document.getElementById('clbdd')[document.getElementById('clbdd').selectedIndex].value;

		var url='';
		url = "./getter/refreshtable.php?func=hscoach&job=insertprofile&vals="+(vals)+"&sid="+Math.random();
		//alert (vals);
		request.open("GET", url, true);
		request.onreadystatechange = displayalert;
		request.send(null);
	}
}
function displayalert() {
  if (request.readyState == 4) {
    if (request.status == 200) {
	  alert (request.responseText);
	  ischanged=false;
	  if(request.responseText.substring(0,23)=='Successfully Registered') {
		  document.getElementById("status").innerHTML="Unconfirmed";
	  } else if(request.responseText.substring(0,20)=='Successfully Updated'){
	  }
    } else if (request.status == 404) {
      alert("Request URL does not exist");
    } else {
      alert("Error: status code is " + request.status);
    }
  }
}

/*
function validateuser(sessionid,uname) {
	//alert ('yahoo');
	url = "./getter/refreshtable.php?func=hscoach&job=confirmuser&sessionid="+sessionid+"&uname="+uname+"&sid="+Math.random();
	document.getElementById("div_status1").innerHTML="Validating";
	//alert (url);
  	request.open("GET", url, true);
  	request.onreadystatechange = loadlogin;
  	request.send(null);
}
*/
/*
function loadlogin() {
  if (request.readyState == 4) {
    if (request.status == 200) {
	  var res = request.responseText.split(":\n:");
      if(res[0]=="Error") {
	    	document.getElementById("div_status1").innerHTML=res[1];  
      } else if(res[0]=="Confirm") {
	    	window.location="./hscoach.php"; 
	  } else if(request.responseText.substring(0,12)=='Invalid user'){
		  //alert (res[1]);
		  document.getElementById("div_status3").innerHTML=res[1]; 
		  document.phpform.thlname.value='';
		  document.phpform.thlpwd.value='';
      } else {
      		window.location=window.location;
      }
    } else if (request.status == 404) {
      alert("Request URL does not exist");
    } else {
      alert("Error: status code is " + request.status);
    }
  }
}
*/
/*
function reloadPage() {
  if (request.readyState == 4) {
    if (request.status == 200) {
	  alert (request.responseText.substring(0,12));
	  if(request.responseText.substring(0,6).equals('Invalid user')){
		  document.getElementById("div_status2").innerHTML=request.responseText; 
	  } else {
		  window.location=window.location;  
	  }
    } else if (request.status == 404) {
      alert("Request URL does not exist");
    } else {
      alert("Error: status code is " + request.status);
    }
  }
}
*/
