//------------------------------------------------------------------------------------- START
function AtoZ(c) {
    window.location.href = "/search/search_result.aspx?c=" + c + "&_cmd=a_z";
}

function AtoZ_admin(c) {
    window.location.href = "index.aspx?case=" + c + "";
}
//------------------------------------------------------------------------------------- END
function MM_openBrWindow(theURL, winName, features) {
    window.open(theURL, winName, features);
}

function detectBrowser() {
    var BO = new Object();
    BO["ie"] = false/*@cc_on || true@*/;
    BO["ie4"] = BO["ie"] && (document.getElementById == null);
    BO["ie5"] = BO["ie"] && (document.namespaces == null) && (!BO["ie4"]);
    BO["ie6"] = BO["ie"] && (document.implementation != null) && (document.implementation.hasFeature != null);
    BO["ie55"] = BO["ie"] && (document.namespaces != null) && (!BO["ie6"]);
    /*@cc_on
    BO["ie7"] = @_jscript_version == '5.7';
    @*/
    BO["ns4"] = !BO["ie"] && (document.layers != null) && (window.confirm != null) && (document.createElement == null);
    BO["opera"] = (self.opera != null);
    BO["gecko"] = (document.getBoxObjectFor != null);
    BO["khtml"] = (navigator.vendor == "KDE");
    BO["konq"] = ((navigator.vendor == 'KDE') || (document.childNodes) && (!document.all) && (!navigator.taintEnabled));
    BO["safari"] = (document.childNodes) && (!document.all) && (!navigator.taintEnabled) && (!navigator.accentColorName);
    BO["safari1.2"] = (parseInt(0).toFixed == null) && (BO["safari"] && (window.XMLHttpRequest != null));
    BO["safari2.0"] = (parseInt(0).toFixed != null) && BO["safari"] && !BO["safari1.2"];
    BO["safari1.1"] = BO["safari"] && !BO["safari1.2"] && !BO["safari2.0"];
    return BO;
}

var BO = new detectBrowser();

function expandDropdownWidth(sender, e) {
    if (BO["ie"]) {
        if (e == "focus" || (!sender.isFocused && e == "over")) {
            if (e == "focus")
                sender.isFocused = true;

            if (!sender.originalStyleWidth)
                sender.originalStyleWidth = sender.style.width;

            sender.style.width = "";
        }
    }
}

function restoreDropdownWidth(sender, e) {
    if (BO["ie"]) {
        if (e == "blur" || (!sender.isFocused && e == "out")) {
            if (e == "blur")
                sender.isFocused = false;

            sender.style.width = sender.originalStyleWidth;
        }
    }
}

function changeSearchToolHelp(index) {
    var helpDefault = document.getElementById("SearchToolHelpDefault");
    var helpSpecialityArea = document.getElementById("SearchToolHelpSpecialityArea");
    var helpSpecialistName = document.getElementById("SearchToolHelpSpecialistName");
    var helpMedicalCondition = document.getElementById("SearchToolHelpMedicalCondition");

    helpDefault.style.display = "none";
    helpSpecialityArea.style.display = "none";
    helpSpecialistName.style.display = "none";
    helpMedicalCondition.style.display = "none";

    switch (index) {
        case 0:
            helpDefault.style.display = "";
            break;

        case 1:
            helpSpecialityArea.style.display = "";
            break;

        case 2:
            helpSpecialistName.style.display = "";
            break;

        case 3:
            helpMedicalCondition.style.display = "";
            break;
    }
}

function submitSpecialistAreaForm() {
    var specialitySelect = document.getElementById('dd_spc');
    var spcForm = document.getElementById('form_spc_area');

    if (specialitySelect.value != "0")
        spcForm.submit();
}

function submitMedicalConditionForm() {
    var medCondTextbox = document.getElementById('med_cond');
    var mcForm = document.getElementById('form_med_cond');

    if (medCondTextbox.value.length != 0)
        mcForm.submit();
}

function showMap(postcode) {
    window.open("http://www.multimap.com/maps/?zoom=16&countryCode=GB&qs=" + postcode, "ViewMap", "status=0,scrollbars=1,toolbar=0,menubar=0,location=0,directories=0,width=1024,height=768");
}
