﻿// JScript 文件


function change(i){  
  window.clearInterval(theTimer); 
 
  switch(browser){
  //ie6 以上版本
   case 1 :
      adNum = i; nextAd_1();
	  break;
  //其他浏览器
   case 2 :
      adNum = i-1; nextAd_2();
      break;
   //ie4.0 - ie5.5 
   case 3 :
      adNum = i; nextAd_3();
	  break;
  }
 
}

/*   nextAd_1   */
function nextAd_1() {	
	if(bStart == 0)
	{	    
		bStart = 1;		
		theTimer=setTimeout('nextAd_1()', TimeOut);
		return;
	}
	else
	{       
	    oTransContainer.filters[0].Apply();	
		for (var i=1;i<=count;i++){
    	document.getElementById('b'+i).className = button_off;
		document.images['oDIV'+i].style.display = "none";
	    }
     	document.getElementById('b'+adNum).className = button_on;
		document.images['oDIV'+adNum].style.display = "block";		
		//document.getElementById('focustext').innerHTML=imgtext[adNum];
		oTransContainer.filters[0].Play(duration=2);
		if(adNum+1 > count) 
			adNum = 1;
		else
			adNum++;
	}	
	theTimer=setTimeout("nextAd_1()", TimeOut);
}
/*   nextAd_2   */
function nextAd_2(){
   if(adNum < count) adNum++;
	else adNum = 1;
	document.images.imgInit.src=imgUrl[adNum];
	document.images.imgInit.alt=imgAlt[adNum];	
	for (var i=1;i<=count;i++){
    	document.getElementById('b'+i).className = button_off;
	}	
	document.getElementById('b'+adNum).className = button_on;
    document.getElementById('focustext').innerHTML=imgtext[adNum];	
	document.getElementById('imgLink').href=imgLink[adNum];	
	theTimer=setTimeout("nextAd_2()", TimeOut);
}
/*   show_1   */
function show_1(){
   document.write('<div id="focuse">');   
   document.write('<DIV id="oTransContainer" style="FILTER: progid:DXImageTransform.Microsoft.Wipe(GradientSize=1.0, wipeStyle=0, motion=reverse); WIDTH: '+imgWidth+'; HEIGHT: '+imgHeight+';">');
   //图片
   document.write('<a href="'+imgLink[1]+'" target="_blank" onFocus="this.blur();"><img id="oDIV1" src="'+imgUrl[1]+'" width='+imgWidth+' height='+imgHeight+' border=0 align="absmiddle" style='+imgStyle+'></a>');
  for(var i=2;i<=count;i++){
      document.write('<a href="'+imgLink[i]+'" target="_blank" onFocus="this.blur();"><img id="oDIV'+i+'" src="'+imgUrl[i]+'" width='+imgWidth+' height='+imgHeight+' border=0 style="DISPLAY: none" style='+imgStyle+'></a>');
  }
  
   document.write('</div>');   
    //document.write('<div id="focustext" style="'+focustextStyle+'">'+imgtext[1]+'</div>');
   document.write('</div>');
   nextAd_1();
}
/*   show_2   */
function show_2(){
   document.write('<div id="focuse">');   
   document.write('<a id="imgLink" href="'+imgLink[1]+'" target=_blank><img src="'+imgUrl[1]+'" name="imgInit" width='+imgWidth+' height='+imgHeight+' border=0 alt="'+imgAlt[1]+'" style='+imgStyle+'></a>');
   document.write('<div id="focustext" style="'+focustextStyle+'">'+imgtext[1]+'</div>');
   document.write('</div>');
   nextAd_2();   
}
/*  goUrl()  */
function goUrl(){
window.open(imgLink[adNum],'_blank');
}
/*  playTran()  */
function plyTran(){
	if (document.all)
		imgInit.filters.revealTrans.play();		
}
/*   nextAd_3   */
function nextAd_3(){
	if(adNum<count)adNum++ ;
		else adNum=1;	
	if( key==0 ){
		key=1;
	} else if (document.all){
		imgInit.filters.revealTrans.Transition=6;
		imgInit.filters.revealTrans.apply();
        playTran();
    }
	document.images.imgInit.src=imgUrl[adNum];
	document.images.imgInit.alt=imgAlt[adNum];	
	for (var i=1;i<=count;i++){
    	document.getElementById('b'+i).className = button_off;
	}
	document.getElementById('b'+adNum).className = button_on;
	focustext.innerHTML=imgtext[adNum];
	theTimer=setTimeout("nextAd_3()", TimeOut);
}
/*  show_3 */
function show_3(){
    document.write('<div id="focuse">');   
    document.write('<a target=_self href="javascript:goUrl()"><img style="FILTER: revealTrans(duration=1,transition=5);" src="javascript:nextAd_3()" width='+imgWidth+' height='+imgHeight+' border=0 name="imgInit" style="'+imgStyle+'"></a><br>');
    document.write('<div id="focustext" style="'+focustextStyle+'"></div>');
	document.write('</div>');



}

//预推浏览器 (兼容未来浏览器）

 try{  //ie6 以上版本
      new ActiveXObject("DXImageTransform.Microsoft.Wipe"); 
	  test.filters[0].Apply();
      var adNum = 1;     
      var bStart = 0; 
	  var browser = 1;    
	  show_1(); 
	  }
 catch (e){   
    try{  //ie4.0 - ie5.5 
         new ActiveXObject("DXImageTransform.Microsoft.Alpha");
         test.filters.revealTrans.Transition=6;
         var key=0;
    	 var browser = 3;
		 show_3();         
    }
    catch(e){ //其他浏览器
    	 var browser = 2;
         show_2();
    }
 }
        
