
// Show Search watermark on search text box.

var iE = iEVersion();
if (iE > 6 || iE == 0) { // IE7 or above or other browser.
    var searchControl = document.getElementById("dnn_dnnSEARCH_txtSearch");
    searchControl.setAttribute("onfocus", "searchOnFocusHander(this)");
    searchControl.setAttribute("onblur", "searchOnBlurHander(this)");
    searchOnBlurHander(searchControl);
}

function searchOnFocusHander(control) {
    if (control.className == "hint") {
        control.className = "";
        control.value = "";
    }
}

function searchOnBlurHander(control) {
    if (control.value == '') {
        control.className = "hint";
        control.value = "Search...";
    }
}

// This function returns Internet Explorer's major version number,
// or 0 for others. It works by finding the "MSIE " string and
// extracting the version number following the space, up to the decimal
// point, ignoring the minor version number
function iEVersion() {
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");

    if (msie > 0) { // If Internet Explorer, return version number
        return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)));
    } else { // If another browser, return 0
        return 0;
    }
}

