﻿var strDefaultKeywords = " Search the site";

function checkSearch() {
    var searchField = document.getElementById('sKeywords');

    switch (searchField.value) {
        case "":
        case strDefaultKeywords:
            window.alert("Please enter a search term");
            searchField.focus();
            return false;
    }
}

function clearDefault() {
    var searchField = document.getElementById('sKeywords');

    switch (searchField.value) {
        case strDefaultKeywords:
            searchField.value = "";
            searchField.className = 'QuickTextFocus';
            return;
    }
}

function bucketTypeTabOnClick(bucketType) {
    var searchField = document.getElementById('sKeywords');

    switch (searchField.value) {
        case "":
        case strDefaultKeywords:
            window.alert(" Search the site");
            searchField.focus();
            return false;
    }
    document.ZibbSearchForm.searchType.value = bucketType;
    document.ZibbSearchForm.submit();
    return false;
}

function searchFieldSetFocus() {
    var searchField = document.getElementById('sKeywords');
    if (searchField != null) {
        searchField.focus();
    }
}


function toggleLayer(whichLayer) {
    var styleSheet;

    if (document.getElementById(whichLayer) != null) {
        if (document.getElementById) {
            // this is the way the standards work
            styleSheet = document.getElementById(whichLayer).style;
        }
        else if (document.all) {
            // this is the way old msie versions work
            styleSheet = document.all[whichLayer].style;
        }
        else if (document.layers) {
            // this is the way nn4 works
            styleSheet = document.layers[whichLayer].style;
        }

        styleSheet.display = styleSheet.display ? "" : "block";
    }
}
