﻿
var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);


$(document).ready(function(){

    if( $("#ctl00_ctl00_ContentPlaceHolder1_IdeasSearchDiv").is(':visible'))
    {
        $("#searchholder").css("height","90px");
    }

    $("#descriptionSearchBtn").click(function(e){
        window.location.href = "/catalog/searchresults.aspx?Description=" + 
            $("#searchDescription").val();
        return false;
    });
    
    $("#ideaSearchButton").click(function(e){
        window.location.href = "/ckideas/Search.aspx?Description=" + 
            $("#ideasSearch").val();
        return false;
    });

    $("#searchDescription").click(function(){
        if($(this).val() == "keywords or item #"){
            $(this).val("");
        }
    });
    $("#ideasSearch").click(function(){
        if($(this).val() == "idea gallery #"){
            $(this).val("");
        }
    });
    $(".water").each(function() {
        $tb = $(this);
        if ($tb.val() != this.title) {
            $tb.removeClass("water");
        }
    }); 
    $(".water").focus(function() {
        $tb = $(this);
        if ($tb.val() == this.title) {
            $tb.val("");
            $tb.removeClass("water");
        }
    });
    $(".water").blur(function() {
        $tb = $(this);
        if ($.trim($tb.val()) == "") {
            $tb.val(this.title);
            $tb.addClass("water");
        }
    });
});

function FireDefaultButton(event, target) {
    if (event.keyCode == 13) {
        var src = event.srcElement || event.target;
        if (!src || (src.tagName.toLowerCase() != "textarea")) {
            var defaultButton;
            if (__nonMSDOMBrowser) {
               defaultButton = document.getElementById(target);
            }
            else {
                defaultButton = document.all[target];
            }
            if (defaultButton && typeof(defaultButton.click) != "undefined") {
                defaultButton.click();
                event.cancelBubble = true;
                if (event.stopPropagation) event.stopPropagation();
                return false;
            }
        }
    }
    return true;
}        

