$(function() {
    //设置分类菜单位置
    $("div[class^=menubig] li").mouseover(function() {
        //$(".tuc").hide();
        var h = $(this).children(".tuc").height();
        $(this).children("a").addClass("sel");
        var t1 = $(this).children("a").position().top;
        $(this).children(".tuc").css("top", (t1 - h / 2) + "px").show();
    }).mouseout(function() {
        $(".tuc").hide(); $(this).children("a").removeClass("sel");
    });


    //育婴导购切换
    $(".yydgtt li").each(function(i) {
        $(this).mouseover(function() {
            $(this).parent().find("a").attr("class", "");
            $(this).find("a").attr("class", "sel");
            $(".yydgcon div.yy").hide();
            $(".yydgcon div.yy:eq(" + i + ")").show();
        });
    });
    //右侧公告分页
    $("#con_two_3 .snews span").each(function(i) {
        if (i == 0) {
            $(this).css("color", "#009FDC");
        }
        $(this).mouseover(function() {
            $("#con_two_3 .snews span").css("color", "");
            $("#con_two_3 .snews1 ul").hide();
            $("#con_two_3 .snews1 ul:eq(" + i + ")").show();
            $(this).css("color", "#009FDC");
        });
    });
});


//限时物价
function xstj(remainSec) {
    var s = countdownTime(remainSec);
    if (s != null && s != "") {
        var datanow = s.split(',');
        $("#countdownTime li").eq(0).html(datanow[0]);
        $("#countdownTime li").eq(1).html(datanow[1]);
        $("#countdownTime li").eq(2).html(datanow[2]);
        if (datanow[0] == "00" && datanow[1] == "00" && datanow[2] == "00") {
            $("#con_two_1").html(" <div style='width:193px;height:239px;background:url(http://www.aiyingshi.com/resource/images/xstj_end.jpg) no-repeat scroll 0 0 transparent' class=''></div>" +
                                        "<div class='djs'><span><a href='http://www.aiyingshi.com/Service/ProductXstj.aspx'><img src='http://www.aiyingshi.com/resource/images/more.jpg'" +
                                        " border='0'></a></span><ul id='countdownTime'><li>00</li><li id='djs01'>00</li><li id='djs01'>00</li></ul></div>");
        }
        xstj_timeout = setTimeout("xstj(" + (--this.remainSec) * 1000 + ")", 1000);
    }
}




//大广告   begin////////////////////////////////////////////////////////////////////////////////////////////////
var t = n = 0, count;
$(document).ready(function() {
    count = $("#banner_list a").length;
    $("#banner_list a:not(:first-child)").hide();
    $("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt'));
    $("#banner_info").click(function() { window.open($("#banner_list a:first-child").attr('href'), "_blank") });
    $("#banner li").mouseover(function() {
        var i = $(this).text() - 1; //获取Li元素内的值，即1，2，3，4
        n = i;
        if (i >= count) return;
        $("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt'));
        $("#banner_info").unbind().click(function() { window.open($("#banner_list a").eq(i).attr('href'), "_blank") })
        $("#banner_list a").filter(":visible").fadeOut(300).parent().children().eq(i).fadeIn(100);
        document.getElementById("banner").style.background = "";
        $(this).toggleClass("on");
        $(this).siblings().removeAttr("class");
    });
    t = setInterval("showAuto()", 4000);
    $("#banner").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 4000); });
})
function showAuto() {
    n = n >= (count - 1) ? 0 : ++n;
    $("#banner li").eq(n).trigger('mouseover');
} 
//大广告   begin////////////////////////////////////////////////////////////////////////////////////////////////
