/*
	Filename         :	people.1st.home.image.js
	Created by       :	Mark Thomas
	Last modified by :	Mark Thomas
	Created          :	16 March 2006 16:08:14
	Last Updated     :	16 March 2006 16:08:24
	Comments         :	
*/


mtLibAddEvent(function(){
	if(!document.getElementById("random")) return;
	oAnimation.start();
	
}, "load");

var oAnimation = {
	
	sCurrent : "",
	
	start : function(){
		if(oMTLib.xmlHTTP()){
			var oHold = document.createElement("div");
			oHold.id = "holding";
			oHold.style.display = "none";
			document.body.appendChild(oHold);
			var oImage = document.createElement("img");
			oHold.appendChild(oImage);
			oHold = oImage = null;
			this.oAnim = new oMTLib.animation("random");
			this.oAnim.dom.setOpacity(15);
			this.request();
			setInterval("oAnimation.request()", 5000);
		}else{
			document.getElementById("noajax").disabled = 0;
		};
	},
		
	request : function(){
		Ajax.request({
			uri			: "lib/people.1st.home.image.asp?sCurrent=" + this.sCurrent + "&n" + new Date().valueOf(),
			callback	: oAnimation._loaded,
			scope		: oAnimation
		});
	},
	
	_loaded : function(oXML){
		this.oAnim.fade(500, 0, 0);
		setTimeout("oAnimation._setContent()", 620);
		this.sCurrent = oXML.responseText;
		document.getElementById("holding").firstChild.src = this.sCurrent
	},
	
	_setContent : function(){
		this.oAnim.obj.innerHTML = document.getElementById("holding").innerHTML;
		this.oAnim.fade(500, 1);
	}
};

