var idPrefix = "ctl00_tdsSearchPlaceHolder_";

function setType(type) {
    var text = document.getElementById(idPrefix+"SearchText");
    var dept = document.getElementById(idPrefix+"SelectDepartment");
    var area = document.getElementById(idPrefix+"SelectArea");
    var bldg = document.getElementById(idPrefix+"SelectBuilding");
    var expt = document.getElementById(idPrefix+"SelectExpertise");

    switch (type.value) {
        case "Department":
            text.style.display = 'none';
            dept.style.display = '';
            area.style.display = 'none';
            bldg.style.display = 'none';
            expt.style.display = 'none';
            break;
        case "Area":
            text.style.display = 'none';
            dept.style.display = 'none';
            area.style.display = '';
            bldg.style.display = 'none';
            expt.style.display = 'none';
            break;
        case "Building":
            text.style.display = 'none';
            dept.style.display = 'none';
            area.style.display = 'none';
            bldg.style.display = '';
            expt.style.display = 'none';
            break;
        case "Expertise":
            text.style.display = 'none';
            if (dept) { dept.style.display = 'none'; }
            if (area) { area.style.display = 'none'; }
            if (bldg) { bldg.style.display = 'none'; }
            expt.style.display = '';
            break;
        default:
            text.style.display = '';
            if (dept) { dept.style.display = 'none'; }
            if (area) { area.style.display = 'none'; }
            if (bldg) { bldg.style.display = 'none'; }
            expt.style.display = 'none';
            break;
    }
}

function filterText(obj, event) {
    var key = (event) ? event.which : event.keyCode;
    var lastKey = String.fromCharCode(key);
    // as soon as we detect the search is for "security", jump to custom page
    if (obj.value != null && (obj.value+lastKey).toLowerCase() == 'securit') {
        window.location = 'security.aspx';
    }
}






