//Added By Ravikiran For Counselor State Access Restriction

var req;
var temp=0;
function retrieveCounselorStateOptions(id){
               
    country= document.getElementById('country');
            
    country_id = country.options[country.selectedIndex].value;

    if(country_id==0)
    {
       document.getElementById('state1').options[0]= new Option('-----Select-----','-----Select-----');
    }
    url="./counsStudRegStateSelect.do?country_id="+country_id;
               
    //Do the Ajax call
    try
    {
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
                                   
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
              
    req.open("GET", url, true);
    req.send(null);
    req.onreadystatechange = populateStateBox;
}
function populateStateBox(){
    document.getElementById('state1').options.length = 0;
    if (req.readyState == 4) {
        textToSplit = req.responseText;      
        var returnElements=textToSplit.split("|");
        if (req.status == 200) {                                        // OK response
            document.getElementById('state1').options[0] = new Option("-----Select-----", "0");
            for ( var i=1; i<(returnElements .length)+1; i++ ){
                valueLabelPair = returnElements[i-1].split(",");
                document.getElementById('state1').options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
            }
        }
    }                 
}
//Ended By Ravikiran