/*
''' -----------------------------------------------------------------------------
''' Project	    : Parent Login
''' JScript     : Login.js
''' Created By  : Parthasarathy H
''' Created on  : 6-Aug-2007
''' Summary     : All the Javascript function for Login.aspx handled here
''' -----------------------------------------------------------------------------
*/
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

function ValidateForm()
{
	//validate the Login Form
	/*alert("hi");
	alert(document.getElementById("cboSchool").options.selectedIndex);
	alert(document.getElementById("cboSchool").options[document.getElementById("cboSchool").options.selectedIndex].text.trim());
	alert(document.getElementById("txtLoginID").value.trim());
	alert(document.getElementById("txtPassword").value.trim());*/
	
	//Check School is Selected
	if (document.getElementById("cboSchool").options[document.getElementById("cboSchool").options.selectedIndex].text.trim()=="")
	{
		document.getElementById("DivWarning").innerHTML="&nbsp;Please select the School."
		document.getElementById("cboSchool").focus();
		return false;
	}
	//Check for Login
	if (document.getElementById("txtLoginID").value.trim()=="")
	{
		document.getElementById("DivWarning").innerHTML="&nbsp;Please enter the Login ID."
		document.getElementById("txtLoginID").focus();
		return false;	
	}
	//Check for Password
	if (document.getElementById("txtPassword").value.trim()=="")
	{
		document.getElementById("DivWarning").innerHTML="&nbsp;Please enter the Password."
		document.getElementById("txtPassword").focus();
		return false;	
	}	
	return true;
}
//<TD3369>-Set the School name according to the selection
function SetSchoolName()
{
    var lsaSchoolName;
    var lsaNames;
    var liCount;
    
	if (document.getElementById("hdSchoolNames").value.trim()!="") 
	{
		lsaSchoolName=document.getElementById("hdSchoolNames").value.trim().split("|");
		
		if (lsaSchoolName!="")
		{
			for(liCount=0; liCount<lsaSchoolName.length-1; liCount++)
			{
				lsaNames=lsaSchoolName[liCount].split("@");
									
				if (document.getElementById("cboSchool").options[document.getElementById("cboSchool").options.selectedIndex].text.trim()==lsaNames[1])
				{
				
					document.getElementById("lblSchName").innerText=lsaNames[1];
					break;
				}
			}
		}
	}
}



