﻿function barNewOver() {
    $('#bar_new').removeClass();
    $('#bar_new').addClass("off2");
    $('#bar_hot').removeClass();
    $('#bar_hot').addClass("on1");
    $('.content_hot').css("display", "none");
    $('.content_new').css("display", "block");
}
function barHotOver() {
    $('#bar_hot').removeClass();
    $('#bar_hot').addClass("off1");
    $('#bar_new').removeClass();
    $('#bar_new').addClass("on2");
    $('.content_new').css("display", "none");
    $('.content_hot').css("display", "block");   
}
$(document).ready(function() {
    var a, b;
    $('#bar_new').mouseover(function(e) {
        a = setTimeout("barNewOver()", "500");
    });

    $('#bar_hot').mouseover(function(e) {
        b = setTimeout("barHotOver()", "500");
    });
    $("#bar_new").mouseout(function() {
        clearTimeout(a)
    })
    $("#bar_hot").mouseout(function() {
        clearTimeout(b)
    })

    $('#submit').hover(function() { $(this).removeClass().addClass("sub_over"); }, function() { $(this).removeClass().addClass("sub"); });

    var rowClass = "even";
 
    $('.index_text').each(function(index) {
        var indexRow = 0;
        $(this).children('li').each(function(index) {
            if (indexRow % 3 == 0) {
                rowClass = (rowClass == 'even' ? 'odd' : 'even');
            }
            $(this).addClass(rowClass);
            indexRow++;
        });
    });
    $('.index_pic li a').hover(function() { $(this).removeClass().addClass('over'); }, function() { $(this).removeClass().addClass('out'); });

    $('.list_content li').addClass("bg").hover(function() { $(this).removeClass().addClass('bg_ov'); }, function() { $(this).removeClass().addClass('bg'); });


    var name = "";
    $(".tip").hover(function(e) {
        var img = $(this).attr("img");
        name = $(this).attr("title");
        $(this).attr("title", "");
        var pageYY = e.pageY || e.clientY + html.scrollTop;
        var pageXX = e.pageX || e.clientX + html.scrollLeft;
        var $tip = $("<div id='tip' style='top:" + pageYY + ";left:" + pageXX + ";'><img src='" + img + "' width='48' height='48' alt='" + name + "' /><p><span class='tanhang' >" + name + "</span></p></div>"); //创建 div 元素
        $tip.css("top", pageYY + "px");
        $tip.css("left", pageXX + "px");
        $("body").append($tip); //把它追加到文档中
        $("#tip").show("fast");  //设置x坐标和y坐标，并且显示.cont_bom.cont_bom
    }, function() {
        $("#tip").remove();
        $(this).attr("title", name);
    });
});
