﻿
$(function() {
    $("#keyword").focus(function() {
        //$(this).css({ border: "1px solid #f00", background: "#fcc" });
        if ($(this).val() == this.defaultValue) {
            $(this).val("");
        }
    }).blur(function() {
        $(this).removeAttr("style");
        if ($(this).val() == '') {
            $(this).val(this.defaultValue);
        }
    });
    $("#btn_search").click(function() {
        return headsearch();
    });
    var host = location.host;
    //if(host.indexOf("www")!=-1)
    $("#sign").load("http://" + location.host + "/ashx/user.ashx", { act: "status" });
    //else
    //    $("#sign").load("http://" + location.host + "/Ebay/ashx/user.ashx", { act: "status" });

});

function headsearch() {
    var searchkey = $("#keyword").val();
    var producttype = $(".search input:hidden").val();
    var url = "http://" + location.host + "/Productlist.aspx";
    if ($.trim(searchkey) == "" || $.trim(searchkey) == "Enter search keywords here") {
        $("#keyword").val("");
        $("#keyword").focus();
        alert("Please input a keyword.");
        return false;
    } else {
        if ($.trim(searchkey) != "")
            url = url + "?keyword=" + searchkey;
        if ($.trim(producttype) != "")
            url += "&producttype=" + producttype;
    }
    location.href = url;
    window.event.returnValue = false;
    return false;
}
function show(e) {
    if (e.children.length > 1) {
        e.children[1].style.display = '';
    }
    e.firstChild.className = 'hover';
}
function hide(e) {
    if (e.children.length > 1) {
        e.children[1].style.display = 'none';
    }
    e.firstChild.className = '';
}
