


$(function() {
    $(".logoright .menu li").mouseover(function() {
        $(".logoright .menu li a").attr("class", "");
        $(this).find("a").attr("class", "sel");
    });

//    //搜索功能
//    $(".serchbutt input").click(function() {
//        var words = $(".searchbb input").val();
//        if ($.trim(words) == "")
//            return false;
//        window.location.href = "http://www.aiyingshi.com/Products/ProductQuery.aspx?keyword=" + words + "&searchtype=and";
//        return false;
//    });

    //自动提示层显示位置
    $(".searchbb input").autocomplete("/ajax/autocomplete.ashx", {
        matchContains: true,
        minChars: 0, 
        width: 386,
        scroll: false,
        selectFirst:false
    });

    //购物车链接、样式
    $(".gwcanl").attr("style", "cursor:pointer;").mouseover(function() {
        $(this).css("text-decoration", "underline ");
    }).mouseout(function() {
        $(this).css("text-decoration", "");
    }).click(function() {
        window.location.href = '/Sale/Shopping.aspx';
    });


    //关闭
    $(".kuan1 .cc").click(function() {
        $(".meng").add($(".kuan1")).fadeOut(500);
    });

});


//窗口改变大小 改变窗口大小，蒙层设置
$(window).resize(function() {
    $(".meng").css("height", $(this).height() + "px");
    $(".kuan1").css("left", (($(this).width() - $(".kuan1").width()) / 2) + "px");
    $(".kuan1").css("top", (($(this).height() - $(".kuan1").height()) / 2) + "px");
});
//滚动 改变窗口大小，蒙层设置
$(window).scroll(function() {
    $(".meng").css("height", $(this).height() + $(this).scrollTop() + "px");
    $(".kuan1").css("left", (($(this).width() - $(".kuan1").width()) / 2) + "px");
    $(".kuan1").css("top", (($(this).height() - $(".kuan1").height()) / 2) + "px");
    
});


//旗舰店点击调用
function fade() {
    $(".meng").fadeIn(500, function() { $(this).css("filter", "alpha(opacity=50); BACKGROUND-COLOR: #aaa") });
    $(".kuan1").fadeIn(500);
    
    //蒙层弹位置、高度  蒙层关闭
    $(".meng").css("height", $(window).height() + "px");
    $(".kuan1").css("left", (($(window).width() - $(".kuan1").width()) / 2) + "px");
    $(".kuan1").css("top", (($(window).height() - $(".kuan1").height()) / 2) + "px");
    return;
}





//tab页切换
function setTab(name,cursel,n){
    for (i = 1; i <= n; i++) {
        var menu = document.getElementById(name + i);
        var con = document.getElementById("con_" + name + "_" + i);
        menu.className = i == cursel ? "hover" : "";
        con.style.display = i == cursel ? "block" : "none";
    }
}


//倒计时JS
function countdownTime(remainTime) {
    this.remainSec = remainTime / 1000;
    if (this.remainSec >= 0) {
        // var day=Math.floor(this.remainSec / (60 * 60 * 24));
        var hour = Math.floor(this.remainSec / (60 * 60)); // - (day * 24);
        var minute = Math.floor(this.remainSec / 60) /*- (day * 24 * 60)*/ - (hour * 60);
        var second = Math.floor(this.remainSec) /*- (day * 24 * 60 * 60)*/ - (hour * 60 * 60)
				- (minute * 60);
        if (hour >= 0 && hour <= 9)
            hour = "0" + hour;
        if (minute >= 0 && minute <= 9)
            minute = "0" + minute;
        if (second >= 0 && second <= 9)
            second = "0" + second;

        return hour + "," + minute + "," + second + ",";

    }
};




//回到顶部js  begin////////////////////////////////////////////////////////////////////////////////////////////////
$(function() {
    var windowWidth = $(window).width();
    var contentWidth = 960;
    var windowHeight = $(window).height();
    var theLeft = (windowWidth - contentWidth) / 2 + contentWidth;
    var theTop = windowHeight;

    $("#go2Top").css("left", theLeft + "px").css("top", (theTop - 100) + "px").hover(
			function() {
			    $(this).find("img").attr("src", "http://www.aiyingshi.com/resource/images/index/toTop.jpg").css("cursor", "pointer")
			},
			function() {
			    $(this).find("img").attr("src", "http://www.aiyingshi.com/resource/images/index/toTop_1.jpg")
			}).click(function() {
			    $(window).scrollTop(0);
			});
    $("#go2Top img").hide();
})


//窗口滚动
$(window).scroll(function() {
    var windowHeight = $(window).height();
    var theTop = $("#go2Top").position().top;
    if (windowHeight < theTop) {
        $("#go2Top img").show();
    }
    else {
        $("#go2Top img").hide();
    }
});


//回到顶部js  end////////////////////////////////////////////////////////////////////////////////////////////////	
				
				
				
