﻿// JavaScript Document

var t;
var numAD=0;
var spPic=document.getElementById("spPic");
var spUrl=document.getElementById("spUrl");


var imgAD = new Array();//存储图片的src地址为数组。



imgAD[0] = new Array("images/hd/01.jpg","http://dc.00100.cc/");
imgAD[1] = new Array("images/hd/02.jpg","http://survey.idea360.net/");
imgAD[2] = new Array("images/hd/03.jpg","http://survey.idea360.net/");
imgAD[3] = new Array("images/hd/04.jpg","http://survey.idea360.net/");


function setTransition(){
  if(document.all){    
    spPic.filters.revealTrans.Transition=Math.floor(Math.random()*23);	
    spPic.filters.revealTrans.apply();
  }
}

function playTransition(){
    if(document.all){
    spPic.filters.revealTrans.play();
  }
}

function nextAD(i){  
  
  setTransition(); 
  if(i!=-1)
  {
  	numAD=i;  
	clearTimeout(t);	
  }  

  
  spPic.src=imgAD[numAD][0];
  spUrl.href=imgAD[numAD][1];


  document.getElementById("spNo0").style.color="#FFFFFF";
  document.getElementById("spNo1").style.color="#FFFFFF";
  document.getElementById("spNo2").style.color="#FFFFFF";  
  document.getElementById("spNo3").style.color="#FFFFFF";
  //document.getElementById("spNo4").style.color="#FFFFFF"; 
  
  
  document.getElementById("spNo0").style.background="#000000";
  document.getElementById("spNo1").style.background="#000000";
  document.getElementById("spNo2").style.background="#000000";  
  document.getElementById("spNo3").style.background="#000000";
  //document.getElementById("spNo4").style.background="#000000";  
 
  
  document.getElementById("spNo" + numAD).style.color="#000000";
  document.getElementById("spNo" + numAD).style.background="#FFFFFF";
  
 
  playTransition();
  if(numAD >= imgAD.length-1){
    numAD=0;
  }else{
    numAD++;
  }  
  t=setTimeout("nextAD(-1)",6000);
  
}