﻿
$(document).ready(function(){
    //注册
    $("#btnRegister").click(function(){
        window.open("/PersonalUserReg.aspx","_blank");
    });
    //加入收藏
    $("#lnkAddFavorite").click(function(){
        window.external.AddFavorite('http://www.cnjzjj.com/', '中国家装家居网');
    });
    //类别下拉框
    var bigSle = $("#ShopTop1_ddlBigCategory");
    var smallSle = $("#ShopTop1_ddlSmallCategory");
    var bigVal = 0;
    bigSle.change(function(){
        bigVal = $(this).val();
            $.getJSON("/Ajax.ashx?op=ddGetSmall&bigId=" + bigVal,function(result){
                smallSle.empty();
                if (result.length == 0){
                    smallSle.append("<option value='-1'>请选择</option>");
                }
                else{
                    $.each(result,function(i,v){
                        smallSle.append("<option value='"+ this.Value +"'>"+ this.Text +"</option>");
                    });
                }
            });
    });
    //搜索
    $("#btnSearch").click(function(){
        var bigId = bigSle.val();
        var smallId = smallSle.val();
        var price = $("#slePrice").val();
        var idn = $("#txtProductIDNumber").val();
        var key = $("#txtKeyword").val();
        
        var url = "/eshop/ProductList.aspx?ParCId=" + bigId;
        if (smallId > 0)
            url += '&SubCId=' + smallId;
        url += '&Price=' + price;
        if (idn != "")
            url += '&IDN=' + idn;
        if (key != "" && key != "请输入...")
            url += '&key=' + key;
        window.open(url,'_self');
    });
    $("#txtKeyword").focus(function(){
        if ($(this).val() == "请输入..."){
            $(this).val('');
        }
    });
    $("#txtKeyword").blur(function(){
        if ($(this).val() == ""){
            $(this).val("请输入...");
        }
    });
    //高级搜索
    $("#btnAdvancedSearch").click(function(){
        window.open("/AdvancedSearch.aspx","_self");
    });
    

});

function CheckLogin(){
    if ($("#Top1_txtUserName").val() == ""){
        alert("用户名不能为空！");
        return false;
    }
    if ($("#Top1_txtPassword").val() == ""){
        alert("密码不能为空！");
        return false;
    }
    return true;
}



