﻿// JScript File

function valid()
{
    if( arguments[0] == "ju" )
    {
        if( !isItEmail( 'tbEmailID' ,'Email ID') ) return false;
    }
    if( isItEmpty( 'tbFirstName' ,'First Name') ) return false;
    if( !isItAlphaNumericSpace( 'tbFirstName' ,'First Name') ) return false;

    if( isItEmpty( 'tbLastName' ,'Last Name') ) return false;
    if( !isItAlphaNumericSpace( 'tbLastName' ,'Last Name') ) return false;
    
    if( isItEmpty( 'tbAddress' ,'Address') ) return false;
    if( isItEmpty( 'tbAddress' ,'Address') ) return false;

    if( isItEmpty( 'ddlCity' ,'City') ) return false;
    if( isItEmpty( 'ddlGender' ,'Gender') ) return false;
    
    if( isItEmpty( 'tbDateOfBirthday' ,'Date of Birthday') ) return false;
   
    
    if( arguments[0] == "ju" )
    {
        if( document.getElementById('tbPassword').value != document.getElementById('tbVerifyPassword').value )
        {
            alert("The Password you entered is invalid!");
            document.getElementById('tbPassword').focus();
            return false;
        }
    }
    
    return true;
}


function valid1()
{
    if( isItEmpty( 'tbInstitutionName' ,'Institution Name') ) return false;
    if( !isItAlphaNumericSpace( 'tbInstitutionName' ,'Institution Name', /[A-z\s\&\-\d]+/ ) ) return false;

    if( isItEmpty( 'ddlTypeOfInstitution' ,'Type of Institution') ) return false;
    
    if( isItEmpty( 'tbAddress' ,'Address') ) return false;

    if( isItEmpty( 'ddlCity' ,'City') ) return false;
    
    if( document.getElementById('tbPhoneNo').value != "" && 
        !IsItPhone( 'tbPhoneNo','Phone No' , /[\d\s\-]+/ ) ) return false;

    if( document.getElementById('tbMobile').value != ""  && !IsItPhone( 'tbMobile','Mobile No')
        ) return false;
    
    if( document.getElementById('tbEmailID').value != ""   && 
    !isItEmail('tbEmailID','Email') ) return false;

    if( isItEmpty( 'tbDateOfEstablished' ,'Date of Established') ) return false;
    if( isItEmpty( 'ddlMFB' ,'Boy only/Girl only/Both') ) return false;
  
    return true;
}


function ddlStateChanged()
{
    id=parseInt( document.getElementById('ddlState').value );
    tbl = joinus.getCity(id).value;
    Table2DropDown(tbl, "CityID,CityName", "ddlCity", null,"City",false);
}

function ddlStateChanged1()
{
    id=parseInt( document.getElementById('ddlState').value );
    tbl = institutioninformation.getCity(id).value;
    Table2DropDown(tbl, "CityID,CityName", "ddlCity", null,"City",false);
}