var gallery = null;

function setOpacity(obj, opacity) {
  opacity = (opacity > 100) ? 100 : opacity;
	var percent = opacity/100;
  obj.style.filter = "alpha(opacity:"+opacity+")";
  obj.style.KHTMLOpacity = percent;
  obj.style.MozOpacity = percent;
  obj.style.opacity = percent;
}
        
function Gallery() {
    this.image = document.getElementById('content-header');
    this.speed = 100;
		this.step = 2;
    this.alpha = 0;
    setOpacity(this.image, 0);
		this.image.style.visibility = "visible";    
    function dochange() {
        gallery.fade();
    }
		
    this.change_cb = setTimeout(dochange, this.speed);

    this.fade = function () {
        if (this.alpha <= 100) {
          	this.alpha += this.step;
            setOpacity(this.image, this.alpha);
						this.step *= 2;
            this.change_cb = setTimeout(dochange, this.speed);
        }
    }
    return this;
}

function go() {
    gallery = new Gallery();
}
