/** Opacity Manager **/
function Opacity(object)
{
	this.opacity = 0;
	this.goal = 100;
	this.style = object.style;
	this.timer = null;
}
Opacity.prototype.setOpacity = function(value)
{
	if(value == 0) {
		this.style.display = 'none';
	} else {
		this.style.display = 'block';
	}
	this.style.opacity = (value / 100);
	this.style.MozOpacity = (value / 100);
	this.style.KhtmlOpacity = (value / 100);
	this.style.filter = "alpha(opacity=" + value + ")";
}
Opacity.prototype.Stop = function()
{
	clearInterval(this.timer);
	if(this.opacity> 0) {
		this.setOpacity(100);
	}
}
Opacity.prototype.FadeIn = function(v,s)
{
	var _this = this;
	this.goal = v;
	this.timer = window.setInterval(function() { _this.FadeInTimer(); }, s);
}
Opacity.prototype.FadeInTimer = function()
{
	if(this.opacity < this.goal) {
		this.opacity = this.opacity + 100;
		this.setOpacity(this.opacity);
		return false;
	} else {
		clearInterval(this.timer);
		return true;
	}
}
Opacity.prototype.FadeOut = function(v,s)
{
	var _this = this;
	this.goal = v;
	this.timer = window.setInterval(function() { _this.FadeOutTimer(); }, s);
}
Opacity.prototype.FadeOutTimer = function()
{
	if(this.opacity> this.goal) {
		this.opacity = this.opacity-100;
		this.setOpacity(this.opacity);
		return false;
	} else {
		clearInterval(this.timer);
		return true;
	}
}
