// 功能：用于实现图片的切换，模仿Shakewake中的效果
//该脚本只适用于图片频道

var TimeSpan=4000;//毫秒
var TotalNum=5;

var switchURL;
var switchImage;
var switchText;
var URLArray=new Array();
var ImageArray=new Array();
var TextArray=new Array();

URLArray[0]="http://www.wflib.com/gxgc/Document/221/221.html";
    ImageArray[0]="Image/221_20090505104745.jpg";
    TextArray[0]="5";
    URLArray[1]="http://www.wflib.com/gxgc/Document/220/220.html";
    ImageArray[1]="Image/220_20090505104713.jpg";
    TextArray[1]="4";
    URLArray[2]="http://www.wflib.com/gxgc/Document/219/219.html";
    ImageArray[2]="Image/219_20090505104644.jpg";
    TextArray[2]="3";
    URLArray[3]="http://www.wflib.com/gxgc/Document/218/218.html";
    ImageArray[3]="Image/218_20090505104557.jpg";
    TextArray[3]="2";
    URLArray[4]="http://www.wflib.com/gxgc/Document/217/217.html";
    ImageArray[4]="Image/217_20090505104455.jpg";
    TextArray[4]="t1";
    

/*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 CurIndex=0;

function WCCM_GetPicture()
{
    if(document.readyState=="complete")
    {
        switchURL=document.getElementById("WCCM_Switch_URL");
        switchImage=document.getElementById("WCCM_Switch_Image");
        switchText=document.getElementById("WCCM_Switch_Text");  
        
        GetPicture();      
    }    
}
function GetPicture()
{
    if(TotalNum<=0) return ;
    if(ImageArray[CurIndex]==undefined||URLArray[CurIndex]==undefined||TextArray[CurIndex]==undefined)	
    {
	    CurIndex+=1;
    }
    if(CurIndex>=TotalNum)
        CurIndex=0;        
    switchImage.filters.item(0).Apply();
    switchImage.src= ImageArray[CurIndex];
    switchImage.filters.item(0).Play();

    if(switchURL!=undefined)	
    {
	switchURL.href= URLArray[CurIndex];
    }
    if(switchText!=undefined)	
    {
	switchText.innerText= TextArray[CurIndex]; 
    }
    window.setTimeout("GetPicture();", TimeSpan);        
    CurIndex+=1;
}
function GetRightIndex()
{
    
}