var isIE = false;
if (navigator.userAgent.indexOf("MSIE",0) != -1) {   // IE?
    isIE = true;
} else {
    document.addEventListener('keypress', search_keypressHandler, true);
}

var isSearch;
function search_keypressHandler(e) {
    isSearch = false;
    if (e.target.id == "TextLeftSrchKey" && e.which == 13) {
        targetValue = e.target.value;
        isSearch = true;
    }
}

function search_keypress(obj) {
    if (isIE == true) {
       if (window.event.keyCode == 13) {
           window.open("/search/result1?ingre_recipe=" + escape(obj.value), "_self");
           return true;
       }
    } else {
       if (isSearch == true) {
           window.open("/search/result1?ingre_recipe=" + escape(obj.value), "_self");
           return true;
       }
    }
    return false;
}

function search_click() {
    var key = document.getElementById("TextLeftSrchKey").value;
    if (key == document.getElementById("TextLeftSrchKey").defaultValue) {
        key = "";
    }
    window.open("/search/result1?ingre_recipe=" + escape(key), "_self");
}

function clearField(field) {
    if (field.value == field.defaultValue) {
        field.value = '';
    }
}

function checkField(field) {
    if (field.value == '') {
        field.value = field.defaultValue;
    }
}



