﻿var flipDelay = 3000;
var flipId = 1;
var flip_rightId = 1;
var flipTimer = null;
var flipRightTimer = null;

//var flip_right = function () {
//    $("div.right  > div.right_info").fadeOut("slow");
//    $($("div.right > div.right_info ").get(flip_rightId)).fadeIn("slow");
//    flip_rightId = (flip_rightId + 1) % 2;
//    flipRightTimer = window.setTimeout(flip_right, 7000);
//}

var rollUp = function () {
    $("div#new cite:first").slideUp("normal", function () {
        $("div#new").append($("div#new cite:first"));
        $("div#new cite:last").show();
    });
}

var flip = function () {
    flipId = (flipId + 1) % ($("div#new cite").size());
    flipTimer = window.setTimeout(flip, flipDelay);
}

$(function () {
    //flipRightTimer = window.setTimeout(flip_right, 7000);
    if ($("div#new cite").size() > 1) window.setInterval(rollUp, flipDelay);
    $(".dummy").click(function () { return false; });


    $("div.new_news div.nav a").click(function () {
        flipId = $("div.new_news div.nav a").index(this);
        $("div.new_news div.nav a").removeClass("current");
        $($("div.new_news div.nav a").get(flipId)).addClass("current");
        $("div.new_news div.new_news_content").hide();
        $($("div.new_news div.new_news_content").get(flipId)).show();
        return false;
    });




    var speed = 10; //数字越大速度越慢 
    var tab = document.getElementById("demo");
    var tab1 = document.getElementById("demo1");
    var tab2 = document.getElementById("demo2");
    tab2.innerHTML = tab1.innerHTML;
    function Marquee() {
        if (tab2.offsetWidth - tab.scrollLeft <= 0)
            tab.scrollLeft -= tab1.offsetWidth
        else {
            tab.scrollLeft++;
        }
    }
    var MyMar = setInterval(Marquee, speed);
    tab.onmouseover = function () { clearInterval(MyMar) };
    tab.onmouseout = function () { MyMar = setInterval(Marquee, speed) }; 

});

