﻿// JScript File

var CollegeSearch_CollegeID = 0;
var CollegeSearch_CollegeName = "";
var CollegeSearch_CallBack = null;

function ShowCollegeSearchPanel(cb)
{
    CollegeSearch_CallBack = cb;
    $find('zmpe_CollegeSearch_BID').show();
    return false;
}
function OnCollegeSelect()
{   
    //Set selected College Text and Value into the GridView   
    
    var lst = $("select[id$=lstCollegeNames]")[0];   
   
    if (lst)
    {
        var selection = lst.options[lst.selectedIndex];
        CollegeSearch_CollegeID = selection.value;
        $("input[id$=HiddenSchoolID]")[0].value = CollegeSearch_CollegeID;
        CollegeSearch_CollegeName = selection.text;

        //Reset Search Tool Controls.
        $("select[id$=ddlCollegeState]")[0].selectedIndex = 0;
        //            $get('<%=ddlCollegeState.ClientID%>').selectedIndex = 0;
        $("input[id$=txtCollegeKeyword]")[0].value = '';
        $(lst).hide();
        $("span[id$=lblSelectCollege]").hide();
       
        if (CollegeSearch_CallBack)
            CollegeSearch_CallBack(CollegeSearch_CollegeName, CollegeSearch_CollegeID);
    
    }
    else if($("input[id$=txtInternational]")[0].value != '')
    {
       Common.SendMailForInternational($("input[id$=txtInternational]")[0].value, SShowInternationalComplete, ShowInternationalError);
       
       if (CollegeSearch_CallBack)        
        CollegeSearch_CallBack(CollegeSearch_CollegeName, CollegeSearch_CollegeID, $("input[id$=txtInternational]")[0].value); 
    }
}        

function SShowInternationalComplete(result)
{
    if(result)
    {
        $get('<%=lblMessage.ClientID%>').style.display = "block";
        $find('zmpe_CollegeSearch_BID').show();
    }
}

function ShowInternationalError()
{

}

if (typeof (Sys) !== "undefined") Sys.Application.notifyScriptLoaded();