// JavaScript Document

jQuery(function($){
$(".Gst-news-list-module-module").each(function(){
var gitem=$(this);
var tnum=gitem.find(".Gst-news-list-item").size();
var activeG=gitem.find(".Gst-news-list-item").eq(0);
gitem.find(".Gst-news-list-item").not(":first").hide();
//activeG.fadeIn(2000);

var times=2;
var currentIndex=0;
var change_news=function(){
	if(times==0){
		activeG.fadeOut(1000);
		currentIndex+=1;
		if(currentIndex==tnum) currentIndex=0;
		activeG=gitem.find(".Gst-news-list-item").eq(currentIndex);
		activeG.fadeIn(1000);
		times=2;
	}
	times--;
}
change_news();
var _changeNews=setInterval(change_news,2000);
$(".gdxw_prev").click(function(){
	clearInterval(_changeNews);
	activeG.fadeOut(1000);
	currentIndex-=1;
	if(currentIndex<0) currentIndex=tnum;
	activeG=gitem.find(".Gst-news-list-item").eq(currentIndex);
	activeG.fadeIn(1000);
	times=2;
	_changeNews=setInterval(change_news,2000);
})
$(".gdxw_next").click(function(){
	clearInterval(_changeNews);
	activeG.fadeOut(1000);
	currentIndex+=1;
	if(currentIndex==tnum) currentIndex=0;
	activeG=gitem.find(".Gst-news-list-item").eq(currentIndex);
	activeG.fadeIn(1000);
	times=2;
	_changeNews=setInterval(change_news,2000);
})

})


    /*ÏòÉÏ¹ö¶¯´úÂë*/
   /* var $scrollElem = $(".Gst-news-list-module-module");
    var gd = $scrollElem.children("table");
    gd.after(gd.clone());
    try {
        var marqueesHeight = 30;
        var stopscroll = false;
        var scrollElem = document.getElementById("scroll_up");
        with (scrollElem) {
            style.width = 730;
            style.height = marqueesHeight;
            style.overflow = 'hidden';
            noWrap = true;
        }
        
        scrollElem.onmouseover = new Function('stopscroll = true');
        scrollElem.onmouseout = new Function('stopscroll = false');
        
        var preTop = 0;
        var currentTop = 0;
        var stoptime = 0;
		var tt=0;
		var mt=0;
        init_srolltext();
    } 
    catch (e) {
    }
    
    function init_srolltext(){
        scrollElem.scrollTop = 0;
        setInterval(scrollUp, 20);
    }
    
    function scrollUp(){
        if (stopscroll) 
            return;
        currentTop += 1;
        if (currentTop == 31) {
            stoptime += 1;
            currentTop -= 1;
            if (stoptime == 90) {
                currentTop = 0;
                stoptime = 0;
            }
        }
        else {
            preTop = scrollElem.scrollTop;
            scrollElem.scrollTop += 1;
            if (preTop == scrollElem.scrollTop) {
                scrollElem.scrollTop = 0;
                scrollElem.scrollTop += 1;
            }
        }
    }
    $(".gdxw_prev").click(function(){
        scrollElem.scrollTop -= 30;
    })
    $(".gdxw_next").click(function(){
        scrollElem.scrollTop += 30;
    })
    $(".Gst-news-list-item").hover(function(){
        stopscroll = true;
    }, function(){
        stopscroll = false;
    })
*/
})

