
function fade(eID, startOpacity, stopOpacity) 
{
	duration = 1000;
  var speed = Math.round(duration / 100);

  var timer = 0;

  if (startOpacity < stopOpacity){ // fade in

	  for (var i=startOpacity; i<=stopOpacity; i++) {

		  setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);

		  timer++;

	  } return;

  }

  for (var i=startOpacity; i>=stopOpacity; i--) { // fade out

	  setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);

	  timer++;


}
}


function setOpacity(eID, opacityLevel) 
{
	var eStyle = document.getElementById(eID).style;
	eStyle.opacity = opacityLevel / 100;
	eStyle.filter = 'alpha(opacity='+opacityLevel+')';
}


function fadeIn(eID) {
    setOpacity(eID, 55); 
    //show(eID); 
    var timer = 0;
    for (var i=55; i<=100; i++) 
    {
        setTimeout("setOpacity('"+eID+"',"+i+")", timer * 5);
        timer++;
    }
}


function fadeOut(eID) {
    var timer = 0;
    for (var i=100; i>=55; i--) {
        setTimeout("setOpacity('"+eID+"',"+i+")", timer * 3);
        timer++;
    }

    //setTimeout("hide('"+eID+"')", 310);
}


function show(eID) {

    getElm(eID).style.display='block';

}


function hide(eID) {

    getElm(eID).style.display='none';

}


function getElm(eID) {

    return document.getElementById(eID);

}

