﻿// JScript 文件
//<div id="div_objectPhotos" style="filter:progid:DXImageTransform.Microsoft.RandomDissolve(); width:240px;height:140px;">
//var oPhotos = new objectPhotos(document.getElementById("div_objectPhotos"));
//判断是否是IE
var agt=navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
function objectPhotos(object){
    this.object = object;
	this.nowDiv = null;
	this.object.style.position = "relative";
	this.id = 0;
	
	this.arrDiv = new Array();
	var allDiv = object.getElementsByTagName("div");
	for (var i=0; i<allDiv.length; i++){
		if (allDiv[i].className == "div_photos"){
			this.arrDiv.push(allDiv[i]);	
		}
	}
	
	for (var i=0; i<this.arrDiv.length; i++){
		this.arrDiv[i].style.position = "absolute";
		if (i == 0){
			this.nowDiv = this.arrDiv[0];
			this.nowDiv.style.visibility = "visible";
		}else{
			this.arrDiv[i].style.visibility = "hidden";
		}
	}
	var othis = this;
	setInterval (function (){
		with (othis.object) {
			if (ie) filters[0].Apply();
			othis.nowDiv.style.visibility = "hidden";
			othis.id++;
			othis.testID();
			othis.arrDiv[othis.id].style.visibility = "visible";
			othis.nowDiv = othis.arrDiv[othis.id];
			if (ie) filters[0].play();
		}
	},3000);
	objectPhotos.prototype.testID = function(){
		if (this.id >= this.arrDiv.length){
			this.id = 0;	
		}
	}
}