// 功能：用于实现图片的切换，模仿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/63101/63101.html";
    ImageArraySwitch2[0]="Image/63101_20120201154327.jpg";
    TextArraySwitch2[0]="杨得瑞主任代表中心在全国水利厅局...";
    URLArraySwitch2[1]="http://www.waterinfo.com.cn/dwxw/Document/62977/62977.html";
    ImageArraySwitch2[1]="Image/62977_20120117111755.jpg";
    TextArraySwitch2[1]="中心举办2011年度工作总结表彰...";
    URLArraySwitch2[2]="http://www.waterinfo.com.cn/dwxw/Document/63017/63017.html";
    ImageArraySwitch2[2]="Image/63017_20120120102237.jpg";
    TextArraySwitch2[2]="中心工会举办职工“拖拉机”扑克牌...";
    URLArraySwitch2[3]="http://www.waterinfo.com.cn/dwxw/Document/62947/62947.html";
    ImageArraySwitch2[3]="Image/62947_20120113161743.jpg";
    TextArraySwitch2[3]="中心第三届“源信杯”职工乒乓球赛...";
    URLArraySwitch2[4]="http://www.waterinfo.com.cn/dwxw/Document/62890/62890.html";
    ImageArraySwitch2[4]="Image/62890_20120109145118.jpg";
    TextArraySwitch2[4]="中心召开2011年度领导班子述职...";
    URLArraySwitch2[5]="http://www.waterinfo.com.cn/dwxw/Document/62829/62829.html";
    ImageArraySwitch2[5]="Image/62829_20120104165220.jpg";
    TextArraySwitch2[5]="中心第三届“源信杯”职工乒乓球赛...";
    URLArraySwitch2[6]="http://www.waterinfo.com.cn/dwxw/Document/62791/62791.html";
    ImageArraySwitch2[6]="Image/62791_20111229095441.jpg";
    TextArraySwitch2[6]="中心举行2011年先进集体申报陈...";
    URLArraySwitch2[7]="http://www.waterinfo.com.cn/dwxw/Document/62719/62719.html";
    ImageArraySwitch2[7]="Image/62719_20111220141255.jpg";
    TextArraySwitch2[7]="杨得瑞主任主持召开2011年中心...";
    


/*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;
    }
}
