var isError=false;var ErrorCode=0;var ErrorMSG="";var uTypeName="";function onTopLogin(){if(xml.readyState==4||xml.readyState=="complete"){var frmUName=document.getElementById('unameTopUL');var frmPword=document.getElementById('pwordTopUL');if(xml.responseText&&xml.responseText.length>0){ErrorCode=xml.responseText;if(ErrorCode==1){alert("ERROR: Please enter your Username AND Password");frmUName.focus()}else if(ErrorCode==2){alert("ERROR: There is no "+uTypeName+" registered with that email address on our system.\nPlease ensure that you have entered the correct email address, and try again");frmUName.select()}else if(ErrorCode=3){alert("ERROR: The password that you entered is incorrect, please try again");frmPword.select()}isError=true}else{isError=false}}}function onLogin(){if(xml.readyState==4||xml.readyState=="complete"){var ErrorDIV=document.getElementById('errMSG-ulogin');var frmUName=document.getElementById('unameUL');var frmPword=document.getElementById('pwordUL');if(xml.responseText&&xml.responseText.length>0){ErrorCode=xml.responseText;if(ErrorCode==1){alert("ERROR: Incomplete Form");ErrorMSG="<b class='red'>ERROR</b>: Please enter your Email Address <b>AND</b> Password.";frmUName.focus()}else if(ErrorCode==2){alert("ERROR: Invalid User");ErrorMSG="<b class='red'>ERROR</b>: There is no <b>"+uTypeName+"</b> registered with that email address on our system. Please ensure that you have entered the correct email address, and try again.";frmUName.select()}else if(ErrorCode=3){alert("ERROR: Incorrect Password");ErrorMSG="<b class='red'>ERROR</b>: The password that you entered is incorrect, please try again";frmPword.select()}isError=true;ErrorDIV.innerHTML=ErrorMSG;ErrorDIV.style.display=""}else{ErrorDIV.style.display="none";isError=false}}}function uLogin(f){var url="/_ssi/ajax/_login.asp";var fvars="ut="+f.ut.value+"&uname="+escape(f.uname.value)+"&pword="+f.pword.value;if(f.id=='pgTopLogin'){if(f.ut.value==1){f.action='/agencies/'}else if(f.ut.value==2){f.action='/parents/'}else if(f.ut.value==3){f.action='/carers/'}else if(f.ut.value==4){f.action='/cccentres/'}uTypeName=getUT(document.getElementById('utypeTopUL').value);exeAjax(url,fvars,onTopLogin)}else{uTypeName=getUT(document.getElementById('utypeUL').value);exeAjax(url,fvars,onLogin)}if(isError){return false}return true}function onFPass(){if(xml.readyState==4||xml.readyState=="complete"){var ErrorDIV=document.getElementById('errMSG-fpass');var frmUName=document.getElementById('unameFP');if(xml.responseText&&xml.responseText.length>0){ErrorCode=xml.responseText;if(ErrorCode==1){alert("ERROR: Incomplete Form");ErrorMSG="<b class='red'>ERROR</b>: Please enter your Email Address.";frmUName.focus()}else if(ErrorCode==2){alert("ERROR: Invalid User");ErrorMSG="<b class='red'>ERROR</b>: There is no <b>"+uTypeName+"</b> registered with that email address on our system. Please ensure that you have entered the correct email address, and try again.";frmUName.select()}isError=true}else{alert('Thank you for your request\nYour password details have now been sent to:\n'+frmUName.value);showHide('ulogin','fpass');document.getElementById('errMSG-ulogin').style.display='';document.getElementById('errMSG-ulogin').innerHTML="<b class='red'>NOTE</b>: Your password has been sent by email to <b>"+frmUName.value+"</b>. Please enter the password below to login.";document.getElementById('unameUL').value=frmUName.value;isError=false}ErrorDIV.innerHTML=ErrorMSG;ErrorDIV.style.display=""}}function fPass(f){uTypeName=getUT(document.getElementById('utypeFP').value);var url="/_ssi/ajax/_fpass.asp";var fvars="ut="+f.ut.value+"&uname="+f.uname.value;exeAjax(url,fvars,onFPass);return false}function showHide(show,hide){document.getElementById(hide).style.display='none';document.getElementById(show).style.display='';document.getElementById('errMSG-'+show).style.display='none';document.getElementById('errMSG-'+show).innerHTML='';document.getElementById('errMSG-'+hide).style.display='none';document.getElementById('errMSG-'+hide).innerHTML=''}function copyFRM(frmFrom,frmTo){document.getElementById('utype'+frmTo).selectedIndex=document.getElementById('utype'+frmFrom).selectedIndex;document.getElementById('uname'+frmTo).value=document.getElementById('uname'+frmFrom).value}
