/* 
  up and down fading of a div block with text
*/

var fade = {

text:null, shift:4, index:0, IE:null, fadeID:null, busy:false,

set:function()
{
  this.IE = navigator.appName == 'Microsoft Internet Explorer';

  this.fadeID = document.getElementById('fade1');

  this.text += '<br/><br/><a href="javascript:fade.down()">F e r m e z</a>';

  document.getElementById('fadetext').innerHTML = this.text;
},

up:function()
{
  this.shift = 4;

  this.fadeID.style.visibility = 'visible';

  if(this.busy) return;

  this.busy = true;
  
  setTimeout("fade.progress()",10);
},

down:function()
{
  this.shift = -4;

  if(this.busy) return;

  this.busy = true;

  setTimeout("fade.progress()",10);
},

progress:function()
{
  this.index = Math.min(Math.max(this.index + this.shift,0),100);

  if(this.IE)
    this.fadeID.filters.alpha.opacity = this.index;
  else
    this.fadeID.style.opacity = this.index / 100;

  if(this.index == 0)
    this.fadeID.style.visibility = 'hidden';

  if(this.index == 0 || this.index == 100)
    this.busy = false;
  else
    setTimeout("fade.progress()",10);  
}
}
