function onEnter(event,on_search) {        
    var bolOldBrowser = (document.layers) ? true : false;
    var intKeyCode = 0;
    if (bolOldBrowser)          intKeyCode = event.which;
    else                        intKeyCode = event.keyCode;
     if (intKeyCode == 13 && on_search == "google") {            
        onsearch();
    } else if(intKeyCode == 13 && on_search == "local") {
        on_local();
    }
}

function onsearch() {
    var chid = document.getElementsByName("chid")[0].value;
    var sitekind = document.getElementById("site_kind").value;
    var q = document.getElementsByName("q")[0].value;
    if(q == "") {
        return false;
    }
    if(sitekind == "local"){
        location.href = "/index/search/sfield=1&keyword=" + q;
    }else{
        location.href = encodeURI("http://google.pchome.com.tw/channel/ch2_header.jsp?chid="+chid+"&site_kind="+sitekind+"&q=" + q);
    }
}

function on_local() {
    alert("local");
}

function greetStr()
{
    var now=new Date()
    var hr = now.getHours();
    if (hr >= 3 && hr < 11) return '早安!';
    if (hr >= 11 && hr < 19) return '日安!';
    if (hr >= 19) return '晚安!';
    if (hr >= 0 && hr < 3) return '晚安!';
    return false;
}
