// 功能：用于实现图片的切换，模仿Shakewake中的效果
//该脚本只适用于图片频道

var TimeSpanSwitch1=6000;//毫秒
var TotalNumSwitch1=5;

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/63165/63165.html";
    ImageArraySwitch1[0]="Image/63165_20120206101831_0.jpg";
    TextArraySwitch1[0]="陈雷部长调研重庆水利工作";
    URLArraySwitch1[1]="http://www.waterinfo.com.cn/tpxw2/Document/63138/63138.html";
    ImageArraySwitch1[1]="Image/63138_20120203091709_1.jpg";
    TextArraySwitch1[1]="全国防汛抗旱工作会议在重庆召开";
    URLArraySwitch1[2]="http://www.waterinfo.com.cn/tpxw2/Document/63137/63137.html";
    ImageArraySwitch1[2]="Image/63137_20120203091611_0.jpg";
    TextArraySwitch1[2]="陈雷部长在全国防汛抗旱工作会议上...";
    URLArraySwitch1[3]="http://www.waterinfo.com.cn/tpxw2/Document/63096/63096.html";
    ImageArraySwitch1[3]="Image/63096_20120201092914_0.jpg";
    TextArraySwitch1[3]="全国水利厅局长会议圆满完成各项议...";
    URLArraySwitch1[4]="http://www.waterinfo.com.cn/tpxw2/Document/63075/63075.html";
    ImageArraySwitch1[4]="Image/63075_20120131091054_0.jpg";
    TextArraySwitch1[4]="陈雷部长在全国水利厅局长会议上的...";
    


/*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;
    }
}
