var steps = 14;
var rs = 255;
var gs = 255;
var bs = 255;

var rt = 231;
var gt = 213;
var bt = 217;

/************************************************************************/

function gotopage(id,who)
{
  who.style.backgroundColor="#ffffff";
    
  var arrow = who.getElementsByTagName("div");
  arrow[0].style.visibility = "hidden";

  var form = document.createElement('form');
      form.action = "./main/";
      form.method = 'POST';

      var input   = document.createElement('input');
      input.type  = "hidden";
      input.name  = "def";
      input.value = id;
      form.appendChild(input);

      document.body.appendChild(form);
      form.submit();
}

/************************************************************************/

function animateon(who)
{
  if (who.direction == undefined || who.direction == -1)
  {
    var arrow = who.getElementsByTagName("div");
    arrow[0].style.visibility = "visible";

    if (who.direction == undefined)
      who.step = 0;

    who.direction = 1;

    setTimeout(function(){fadein(who);},40);
  }
}

/************************************************************************/

function animateoff(who)
{
  if (who.direction != undefined && who.direction == 1)
  {
    var arrow = who.getElementsByTagName("div");
    arrow[0].style.visibility = "hidden";
    who.direction = -1;

    setTimeout(function(){fadein(who);},40);
  }
}

/************************************************************************/

function fadein(who)
{
  if (who.direction == 1)
  {
    who.step++;

    var r = parseInt(rs + (rt-rs)*who.step/steps);
    var g = parseInt(gs + (gt-gs)*who.step/steps);
    var b = parseInt(bs + (bt-bs)*who.step/steps);

    who.style.backgroundColor="rgb("+r+","+g+","+b+")";

    if ( who.step < steps)
    {
      setTimeout(function(){fadein(who);},40);
    }
  }
  else
  if (who.direction == -1 && who.step != 0)
  {
    who.step--;

    var r = parseInt(rs + (rt-rs)*who.step/steps);
    var g = parseInt(gs + (gt-gs)*who.step/steps);
    var b = parseInt(bs + (bt-bs)*who.step/steps);

    who.style.backgroundColor="rgb("+r+","+g+","+b+")";

    if (who.step != 0)
    {
      setTimeout(function(){fadein(who);},40);  
    }
  }
 
}

/************************************************************************/

