﻿///<reference path="jquery-1.3.2-vsdoc.js"/>
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 + "' 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);
    });


})
var v="";
function startScreen() {
    var screenCount = $(".screenlist li").length;
    $(".screenlist li:gt(9)").hide();
    $(".screenlist li").click(function() {
        var number = $(".screenlist li").index(this);
        clearTimeout(v);
        showScreen(screenCount,number+1);
    });
    showScreen(screenCount, 1);
}
function showScreen(count, startIndex) {
    var imgSrc = $(".screenlist li:eq(" + (startIndex - 1) + ")").find("img").attr("src");

    $("#mainscreen").hide();
    $("#mainscreen").html("<img src=\"" + imgSrc + "\" width=\"176\" height=\"208\" />");
    $("#mainscreen").fadeIn("slow");
    $(".screenlist li").css("border", "1px solid black");
    $(".screenlist li:eq(" + (startIndex - 1) + ")").css("border", "1px solid #FD6D04");
    
    if (count > 1) {
        $(".screenlist li:eq(" + (startIndex - 1) + ")").fadeIn("slow");

        $("#screenpage").html(startIndex + "/" + count);
        startIndex++;
        if (startIndex > count || startIndex > 10) { startIndex = 1; }
       v= window.setTimeout("showScreen(" + count + "," + startIndex + ")", 3000);
    }
}


