﻿// JScript File


function chkVisibility(){
if(document.getElementById(""+lblSchool+""))
 document.getElementById(""+lblSchool+"").style.display="none";
 return false;
}
          
function changePassword()
{
	var basepath="";
	if(document.location.port.length>0)
	basepath=document.location.protocol+"//"+document.location.host+"/"+document.location.pathname.split('/')[1]+"/";
	else
	basepath=document.location.protocol+"//"+document.location.host+"/";
    document.getElementById("ctl00_mainContentPlaceHolder_valSummary").style.display="none";
    basepath=basepath+"ChangePassword.aspx";

    var _win = window.open(basepath,'windowOpen','height=500,width=900,left='+((screen.width/2) - (900/2))+',top ='+((screen.height/2)-(500/2)),'');
    _win.focus();
}
function forgotPassword()
{
    var basepath="";
	if(document.location.port.length>0)
	basepath=document.location.protocol+"//"+document.location.host+"/"+document.location.pathname.split('/')[1]+"/";
	else
	basepath=document.location.protocol+"//"+document.location.host+"/";
    document.getElementById("ctl00_mainContentPlaceHolder_valSummary").style.display="none";
    basepath=basepath+"ForgotPassword.aspx";
    var _win = window.open(basepath,'windowOpen','height=400,width=650,left='+((screen.width/2) - (500/2))+',top ='+((screen.height/2)-(500/2)),'');
    _win.focus();
}
      
function HideMsgs()
{
   $('#ctl00_mainContentPlaceHolder_dvMessage').slideUp();
    if(document.getElementById("ctl00_mainContentPlaceHolder_message"))document.getElementById("ctl00_mainContentPlaceHolder_message").style.display="none";
    if(document.getElementById("ctl00_mainContentPlaceHolder_lbl_avail"))document.getElementById("ctl00_mainContentPlaceHolder_lbl_avail").style.display="none";
    if(document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail"))document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").style.display="none";
    if(document.getElementById("ctl00_mainContentPlaceHolder_lblSecurityCode"))document.getElementById("ctl00_mainContentPlaceHolder_lblSecurityCode").innerHTML=""; 
}

function chkSchoolavailability()
{   
    document.getElementById("state").className="even";
    
    //if(document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail")) document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").style.display="block";
    
    //if(document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail")) document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").className = "instruction show";
    
    document.getElementById("divSchoolAvail").className = "instruction show"; 
    $txt_schoolname = $.trim(document.getElementById("ctl00_mainContentPlaceHolder_txt_schoolname").value);
    $txt_city = $.trim(document.getElementById("ctl00_mainContentPlaceHolder_txt_city").value);
    if($txt_schoolname=="" )
    {   
        document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").innerHTML="Please Enter the SiteName";
        document.getElementById("ctl00_mainContentPlaceHolder_txt_schoolname").focus();
        return false;
    }
    else if($txt_city=="")
    {
    document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").style.color="red";
        document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").innerHTML="Please Enter the City";
        document.getElementById("ctl00_mainContentPlaceHolder_txt_city").focus();
        return false;
    }
    else if(document.getElementById("ctl00_mainContentPlaceHolder_ddl_state").value=="-1" )
    {
        document.getElementById("ctl00_mainContentPlaceHolder_lbl_schoolavail").innerHTML="Please Enter the State";
        document.getElementById("ctl00_mainContentPlaceHolder_ddl_state").focus();
        return false;
    }
    else if(document.getElementById(""+ddlStateValue+"").value == "0" )
    {
        
        if( trim(document.getElementById(""+txtStateName+"").value) == "")
        {
           document.getElementById(""+labelAvail+"").className = "Red smallText";
           document.getElementById(""+txtStateName+"").focus();
           document.getElementById(""+labelAvail+"").innerHTML = "Please Enter the Statename";
           return false;
        } 
        if(trim (document.getElementById(""+txtCountryName+"").value) == "" )
        {
           document.getElementById(""+labelAvail+"").className = "Red smallText";
           document.getElementById(""+txtCountryName+"").focus();
           document.getElementById(""+labelAvail+"").innerHTML = "Please Enter the Countryname";
           return false;
        }
    }  
    else
    {
        document.getElementById("divSchoolAvail").className = "instruction hide"; 
        document.getElementById("state").className="";
        document.getElementById(""+labelAvail+"").innerHTML = "";
        return true;
    }
}

function chkUserAvailability()
{  
   
    if(document.getElementById("ctl00_mainContentPlaceHolder_txt_login").value=="")
    {   
        document.getElementById("ctl00_mainContentPlaceHolder_lbl_avail").style.display="block";
        document.getElementById("ctl00_mainContentPlaceHolder_lbl_avail").innerHTML="Please Enter the LoginID";
        document.getElementById("ctl00_mainContentPlaceHolder_lbl_avail").style.color="red";
        document.getElementById("ctl00_mainContentPlaceHolder_txt_login").focus();
        return false;
    }
      if(document.getElementById(""+LoginID+"").value.length < 6)
      {
         document.getElementById(""+lbl_avail+"").style.display="block";
         document.getElementById(""+lbl_avail+"").innerHTML="LoginID should be minimum 6 characters";
         document.getElementById(""+lbl_avail+"").style.color="red";
         document.getElementById(""+LoginID+"").focus();
         return false;
      }
    return true;
   // else
   // {
       // document.getElementById("ctl00_mainContentPlaceHolder_trLogin").className="";
       // return true;
  //  }
}

     
 function trim(stringToTrim)
    {
        return stringToTrim.replace(/^\s+|\s+$/g,"");
    }
      