// 功能：用于实现图片的切换，模仿Shakewake中的效果
//该脚本只适用于图片频道

var TimeSpanSwitch1=6000;//毫秒
var TotalNumSwitch1=6;

var switchURLSwitch1;
var switchImageSwitch1;
var switchTextSwitch1;
var URLArraySwitch1=new Array();
var ImageArraySwitch1=new Array();
var TextArraySwitch1=new Array();

URLArraySwitch1[0]="http://www.waterinfo.com.cn/tpxw2/Document/54800/54800.html";
    ImageArraySwitch1[0]="Image/54800_20100312084133_1.jpg";
    TextArraySwitch1[0]="陈雷主持召开国家防总抗旱紧急会商...";
    URLArraySwitch1[1]="http://www.waterinfo.com.cn/tpxw2/Document/54799/54799.html";
    ImageArraySwitch1[1]="Image/54799_20100312084042_1.jpg";
    TextArraySwitch1[1]="水利部召开第一次全国水利普查项目...";
    URLArraySwitch1[2]="http://www.waterinfo.com.cn/tpxw2/Document/54775/54775.html";
    ImageArraySwitch1[2]="Image/54775_20100310083618_1.jpg";
    TextArraySwitch1[2]="水利部挂职干部报告会在京举行 陈...";
    URLArraySwitch1[3]="http://www.waterinfo.com.cn/tpxw2/Document/54774/54774.html";
    ImageArraySwitch1[3]="Image/54774_20100310083530_1.jpg";
    TextArraySwitch1[3]="陈雷在水利部挂职干部报告会上的讲...";
    URLArraySwitch1[4]="http://www.waterinfo.com.cn/tpxw2/Document/54773/54773.html";
    ImageArraySwitch1[4]="Image/54773_20100310083424_1.jpg";
    TextArraySwitch1[4]="2010年度水利建设项目稽察工作...";
    URLArraySwitch1[5]="http://www.waterinfo.com.cn/tpxw2/Document/54769/54769.html";
    ImageArraySwitch1[5]="Image/54769_20100309135052_1.jpg";
    TextArraySwitch1[5]="发展研究中心召开2010年工作会...";
    


/*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 CurIndexSwitch1=0;
var bLoad=false;

function WCCM_GetPictureSwitch1()
{
    if(document.readyState=="complete")
//    if(!bLoad)
    {
        bLoad=true;
        switchURLSwitch1=document.getElementById("WCCM_Switch_URLSwitch1");
        switchImageSwitch1=document.getElementById("WCCM_Switch_ImageSwitch1");
        switchTextSwitch1=document.getElementById("WCCM_Switch_TextSwitch1");  
        if(switchImageSwitch1==undefined) //没有图片，直接返回	
	    {
		    return ;
	    }
        GetPictureSwitch1();      
    }    
}
function GetPictureSwitch1()
{
    if(TotalNumSwitch1<=0) return ;
    if(ImageArraySwitch1[CurIndexSwitch1]==undefined||URLArraySwitch1[CurIndexSwitch1]==undefined||TextArraySwitch1[CurIndexSwitch1]==undefined)	
    {
	    CurIndexSwitch1+=1;
    }
    
    if(CurIndexSwitch1>=TotalNumSwitch1)
        CurIndexSwitch1=0;   

    if(switchImageSwitch1.filters.length>0)  //具有过滤器
    {
	    switchImageSwitch1.filters.item(0).Apply();
    }    
    switchImageSwitch1.src= ImageArraySwitch1[CurIndexSwitch1];
    if(switchImageSwitch1.filters.length>0) //具有过滤器
    {
         switchImageSwitch1.filters.item(0).Play();
    }
    if(switchURLSwitch1!=undefined)	
    {
	    switchURLSwitch1.href= URLArraySwitch1[CurIndexSwitch1];
    }
    if(switchTextSwitch1!=undefined)	
    {
	    switchTextSwitch1.innerText= TextArraySwitch1[CurIndexSwitch1]; 
    }
    if(TimeSpanSwitch1>0) //等于0，不进行定时激发
    {
    	window.setTimeout("GetPictureSwitch1();", TimeSpanSwitch1);        
    	CurIndexSwitch1+=1;
    }
}