// JavaScript Document
function BlendObject(object, art) {
    if (!object.Blend) {
        var blend = new Blend(object);
		if(arguments.length > 2)
			object.Blend.Opacity = arguments[2];
    }
    object.Blend.Start(art);
}

function Blend(obj) {
    this.Object = obj;
    this.ObjectId = obj.getAttribute("id");
    this.Opacity = 0;
    this.BlendInterval = null;
	
	if(this.ObjectId == null || this.ObjectId == ""){
		obj.setAttribute("id", "blendObject_" + (Math.floor(Math.random() * 100001)));
		this.ObjectId = obj.getAttribute("id");
	}

    obj.Blend = this;
}
Blend.prototype.Start = function(art) {
    if (this.BlendInterval != null) {
        window.clearInterval(this.BlendInterval);
        this.BlendInterval = null;
    }
    this.BlendInterval = window.setInterval("document.getElementById('" + this.ObjectId + "').Blend.SetOpacity(" + art + ");", 20);
}
Blend.prototype.SetOpacity = function(art) {
    this.Opacity += (art == 1) ? 5 : -5;

    if (_IE) // IE
        this.Object.filters.alpha.opacity = this.Opacity;
    else
        this.Object.style.opacity = (this.Opacity / 100);

    if (this.Opacity <= 0 || this.Opacity >= 100) {
        window.clearInterval(this.BlendInterval);
        this.BlendInterval = null;
    }
}
