var intMin = 0; 

function cImageAnimation() {
	var _self = this;
	this.speedIn = 10; //6;
	this.speedOut = 10; // 6;
	
	this.setOpacity = function(obj, opacity) {
		opacity = (opacity == 100) ? 99.999 : opacity;
		
		// IE/Win
		obj.style.filter = "alpha(opacity:" + opacity + ")";
	  
		// Safari<1.2, Konqueror
		obj.style.KHTMLOpacity = opacity / 100;
	  
		// Older Mozilla and Firefox
		obj.style.MozOpacity = opacity / 100;
	  
		// Safari 1.2, newer Firefox and Mozilla, CSS3
		obj.style.opacity = opacity / 100;
	}
	
	this.fadeIn = function(objID, opacity) {
		var obj = document.getElementById(objID);

		if (!obj) {
			alert(objID + " not found");
			return;
		}
		
		if (opacity <= 100) {		
			_self.setOpacity(obj, opacity);
			opacity += _self.speedIn;
			setTimeout("objImageAnimation.fadeIn('" + objID + "'," + opacity+")", 20);
		}
		else
			_self.setOpacity(obj, 99.999);
	}
	
	this.fadeOut = function(objID, opacity) {
		var obj = document.getElementById(objID);
		
		if (opacity >= intMin) {
			_self.setOpacity(obj, opacity);
			opacity -= _self.speedOut;
			setTimeout("objImageAnimation.fadeOut('" + objID + "'," + opacity + ")", 20);
		}
		else {
			_self.setOpacity(obj, intMin);
			obj.style.display = "none";
		}
	}
}

var objImageAnimation = new cImageAnimation();