﻿
 
 var E_strIFaderTransType = 'reveal'; // 'reveal' | 'blend'
var Filter_number = 23;       // 滤镜种数
var change_time = 3.000;    // 滤镜转换过程为3.0秒延迟
var wait_time    = 3000;     // 两种滤镜之间为5秒延迟

var obj_Timer;
var count_temp = 0; //记录当前是第几幅图片
var Img_arry = new Array(); //图片数组
var E_ie4 = document.all?true:false;
var E_nn4 = document.layers?true:false;

var i = 0;

 function add(waitPic,dd)
 {
 	Img_arry[i] =  new Img_obj(waitPic,dd,'\n','_self');
 	i++;
 }
 

function Filt_set() //设置滤镜
{

	if(E_ie4) {
		var theImg = document.getElementById('idImgFading');
		
		if(theImg == null) return;
		with(document.getElementById('idImgFading')) {
			style.filter = (E_strIFaderTransType == 'reveal')?'revealTrans':'blendTrans';
			style.filter.duration = change_time;
			style.filter.transition = Filter_number;
			
		}
	}
	obj_Timer = window.setInterval('use_Filter()',wait_time);
}

function use_Filter() //滤镜的启动
{
   if(!E_ie4 && !E_nn4) return;
  
	if(E_ie4) {

		with(document.getElementById('idImgFading')) {
			if(E_strIFaderTransType == 'reveal') {
				filters(0).transition = Filter_number;
			}
			if(count_temp == (Img_arry.length - 1)) {
				count_temp = -1;
			}
			count_temp++;
			title = Img_arry[count_temp].sAlt;
		
			filters(0).apply();
			src = Img_arry[count_temp].sImgUrl;
			
			name = Img_arry[count_temp].command;
			if(name!=null&&name!='#'){
	                 var dd = document.getElementById("dd");
 	                    dd.innerHTML = name;
 	        }
			filters(0).play();
		}
	}
	else if(E_nn4) {
		if(count_temp == (Img_arry.length - 1)) {
			count_temp = -1;
		}
		count_temp++;
		document.images['idImgFading'].src = Img_arry[count_temp].sImgUrl;
		
	}
}

function Img_obj(sImgUrl,command,sAlt,sTarget) 
{
	this.sImgUrl = (sImgUrl == null)?'':sImgUrl;
	this.command = (command == null || command == '')?'#':command;//默认为本页,也可以改为一个网址.
	this.sAlt = (sAlt == null)?'':sAlt;
	this.sTarget = (sTarget == null || sTarget == '')?'_self':sTarget;
}
function slide(n,name)
{
    if(name!=null&&name!=''){
        var dd = document.getElementById("dd");
 	dd.innerHTML = name;
       }
	window.clearInterval(obj_Timer);
	count_temp = n;
	use_Filter();
	obj_Timer = window.setInterval('use_Filter()',wait_time);
	
function obj_ClearTime() {
	window.clearInterval(obj_Timer);
}
window.onunload = obj_ClearTime;//取消计时器，释放系统资源
}


   function MM_openBrWindow(theURL,winName,features) { //v2.0
 
  window.open(theURL,winName,features);
}
