﻿$(function () {


    $(".szbz").click(function () {

        AddFavorite("http://www.norco.com.cn", "NORCO");

    });

    $("body").keydown(function () {
        if (event.keyCode == 13) {

            var searchValue = $.trim($("#txtKey").val());
            if (searchValue == "") {


                $("#txtKey").css("border", "solid 1px red");


                return false;
            }


            window.location = "/SearchProduct.aspx?id=" + searchValue ;
            return false;


        }
    });
    //关闭

    $("#close").click(function () {

        window.opener = null; window.open('', '_self'); window.close();
    });
    $("#btnKey").mouseover(function () {
        $(this).attr("src", "/images/search.gif");

    })
    $("#btnKey").mouseout(function () {
        $(this).attr("src", "/images/search.gif");

    })


    $("#btnKey").click(function () {
        var searchValue = $.trim($("#txtKey").val());
        if (searchValue == "") {


            $("#txtKey").css("border", "solid 1px red");


            return false;
        }


        window.location = "/SearchProduct.aspx?id=" + searchValue ;
        return false;


    })

    //txtKey



    //以上是搜索按钮


})





function ShowYear() {
    document.write((new Date).getFullYear());
}



function AddFavorite(sURL, sTitle) {
    try {
        window.external.addFavorite(sURL, sTitle);
    } catch (e) {
        try {
            window.sidebar.addPanel(sTitle, sURL, "");
        } catch (e) {
            alert("Add failed,You can try 'Ctrl+D' ");
        }
    }
}


$(document).ready(function () {
    //speed
    var speed = 500;
    //bindEvent
    $("#btnShow").click(function (event) {
        //cancle 
        event.stopPropagation();
        
        var offset = $(event.target).offset();
        $("#divTop").css({ top: offset.top + $(event.target).height() + "px", left: offset.left-94 });
        $("#divTop").show(speed);

    })

   
    $(document).click(function (event) {
        $("#divTop").hide(speed);
    }
     )
  
    $("#divTop").click(function (event) {
        $("#divTop").hide(speed);
    })

}

    )
   
