// 功能：用于实现图片的切换，模仿Shakewake中的效果
//该脚本只适用于图片频道

var TimeSpanSwitch1=6000;//毫秒
var TotalNumSwitch1=2;

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/56623/56623.html";
    ImageArraySwitch1[0]="Image/56623_20100906091531_1.jpg";
    TextArraySwitch1[0]="2010年水利审计骨干培训班在苏...";
    URLArraySwitch1[1]="http://www.waterinfo.com.cn/tpxw2/Document/56614/56614.html";
    ImageArraySwitch1[1]="Image/56614_20100903124646_1.jpg";
    TextArraySwitch1[1]="水保中心贯彻落实水利援藏会议精神...";
    


/*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;
    }
}