function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    
    @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
    @else
        xmlhttp = false;
    @end @*/
    
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    
    return xmlhttp;
}

var http = getHTTPObject();

function getInstitutionDropdown(country, selected) {
    var query = '/api/?method=institutions_by_country&name=institution&value_field=blockContentID&display_field=name&format=HTMLDropdown&default_option=Please+choose&country='+country+'&selected_value='+selected;
//     alert(query);
    http.open("GET", query, true);
    http.onreadystatechange = getInstitutionDropdownResponse;
    http.send(null);
    return true;
}

function getInstitutionDropdown_urlencoding(country, selected) {
    var query = '/api/?method=institutions_by_country&name=institution&value_field=blockContentID&display_field=name&format=HTMLDropdown_urlencoding&default_option=Please+choose&country='+country+'&selected_value='+selected;
//     alert(query);
    http.open("GET", query, true);
    http.onreadystatechange = getInstitutionDropdownResponse;
    http.send(null);
    return true;
}

function getInstitutionDropdownResponse() {
    if (http.readyState != 4) {
        return;
    }
    
    document.getElementById('institution_select_div').innerHTML = http.responseText;
}