// 功能：用于实现图片的切换，模仿Shakewake中的效果
//该脚本只适用于图片频道

var TimeSpanSwitch2=6000;//毫秒
var TotalNumSwitch2=8;

var switchURLSwitch2;
var switchImageSwitch2;
var switchTextSwitch2;
var URLArraySwitch2=new Array();
var ImageArraySwitch2=new Array();
var TextArraySwitch2=new Array();

URLArraySwitch2[0]="http://www.waterinfo.com.cn/dwxw/Document/56445/56445.html";
    ImageArraySwitch2[0]="Image/56445_20100819092720.jpg";
    TextArraySwitch2[0]="杨得瑞主任 李晶副主任为新职工讲...";
    URLArraySwitch2[1]="http://www.waterinfo.com.cn/dwxw/Document/56401/56401.html";
    ImageArraySwitch2[1]="Image/56401_20100817085753.jpg";
    TextArraySwitch2[1]="中心举行向舟曲灾区捐款仪式";
    URLArraySwitch2[2]="http://www.waterinfo.com.cn/dwxw/Document/56329/56329.html";
    ImageArraySwitch2[2]="Image/56329_20100809094826.jpg";
    TextArraySwitch2[2]="“源信杯”规计司—发展研究中心乒...";
    URLArraySwitch2[3]="http://www.waterinfo.com.cn/dwxw/Document/56268/56268.html";
    ImageArraySwitch2[3]="Image/56268_20100803150653.jpg";
    TextArraySwitch2[3]="水利部党组成员、办公厅主任陈小江...";
    URLArraySwitch2[4]="http://www.waterinfo.com.cn/dwxw/Document/56267/56267.html";
    ImageArraySwitch2[4]="Image/56267_20100803145633.jpg";
    TextArraySwitch2[4]="有关领导、专家出席中心成立十周年...";
    URLArraySwitch2[5]="http://www.waterinfo.com.cn/dwxw/Document/56266/56266.html";
    ImageArraySwitch2[5]="Image/56266_20100803145353.jpg";
    TextArraySwitch2[5]="杨得瑞主任在中心成立十周年座谈会...";
    URLArraySwitch2[6]="http://www.waterinfo.com.cn/dwxw/Document/56265/56265.html";
    ImageArraySwitch2[6]="Image/56265_20100803124438.jpg";
    TextArraySwitch2[6]="中心成立十周年座谈会在京举行";
    URLArraySwitch2[7]="http://www.waterinfo.com.cn/dwxw/Document/56232/56232.html";
    ImageArraySwitch2[7]="Image/56232_20100730171705.jpg";
    TextArraySwitch2[7]="中心举办成立十周年系列庆祝活动";
    


/*URLArray[0]="http://www.sina.com.cn";
URLArray[1]="http://www.google.com";
URLArray[2]="http://wwww.cnki.net";
URLArray[3]="http://www.sohu.com.cn";

ImageArray[0]="Image/罗纳尔多状态神勇.JPG";
ImageArray[1]="Image/卡卡：你又进球啦.jpg";
ImageArray[2]="Image/罗纳尔多晃过对方门将.jpg";
ImageArray[3]="Image/罗纳尔多晃过门将推空门.jpg";

TextArray[0]="罗纳尔多状态神勇";
TextArray[1]="卡卡：你又进球啦";
TextArray[2]="罗纳尔多晃过对方门将";
TextArray[3]="罗纳尔多晃过门将推空门";
*/
//document.onreadystatechange=WCCM_GetPicture;

var CurIndexSwitch2=0;
var bLoad=false;

function WCCM_GetPictureSwitch2()
{
    if(document.readyState=="complete")
//    if(!bLoad)
    {
        bLoad=true;
        switchURLSwitch2=document.getElementById("WCCM_Switch_URLSwitch2");
        switchImageSwitch2=document.getElementById("WCCM_Switch_ImageSwitch2");
        switchTextSwitch2=document.getElementById("WCCM_Switch_TextSwitch2");  
        if(switchImageSwitch2==undefined) //没有图片，直接返回	
	    {
		    return ;
	    }
        GetPictureSwitch2();      
    }    
}
function GetPictureSwitch2()
{
    if(TotalNumSwitch2<=0) return ;
    if(ImageArraySwitch2[CurIndexSwitch2]==undefined||URLArraySwitch2[CurIndexSwitch2]==undefined||TextArraySwitch2[CurIndexSwitch2]==undefined)	
    {
	    CurIndexSwitch2+=1;
    }
    
    if(CurIndexSwitch2>=TotalNumSwitch2)
        CurIndexSwitch2=0;   

    if(switchImageSwitch2.filters.length>0)  //具有过滤器
    {
	    switchImageSwitch2.filters.item(0).Apply();
    }    
    switchImageSwitch2.src= ImageArraySwitch2[CurIndexSwitch2];
    if(switchImageSwitch2.filters.length>0) //具有过滤器
    {
         switchImageSwitch2.filters.item(0).Play();
    }
    if(switchURLSwitch2!=undefined)	
    {
	    switchURLSwitch2.href= URLArraySwitch2[CurIndexSwitch2];
    }
    if(switchTextSwitch2!=undefined)	
    {
	    switchTextSwitch2.innerText= TextArraySwitch2[CurIndexSwitch2]; 
    }
    if(TimeSpanSwitch2>0) //等于0，不进行定时激发
    {
    	window.setTimeout("GetPictureSwitch2();", TimeSpanSwitch2);        
    	CurIndexSwitch2+=1;
    }
}