// JavaScript Document

function jumpto(anchor,activator)
{
  
  for(counter=0; counter<activator.parentNode.parentNode.childNodes.length; counter++)
    activator.parentNode.parentNode.childNodes[counter].className='';

  activator.parentNode.className='current';

  scrollto(document.getElementById(anchor).offsetTop,0);
  return false;
}

function scrollto(pixel,lastamount)
{
  windowScroll = (document.all ? document.body.scrollTop : window.pageYOffset);
  
  amount = Math.ceil((pixel-windowScroll)/4);
  if(amount!=0 && amount!=lastamount)
  {
    // alert(amount+" "+lastamount);
    window.scrollBy(0, amount);
    window.setTimeout("scrollto("+pixel+","+amount+")",10);
  }
  else
    window.scrollTo(0,pixel);
}

function truebody()	{
  // right syntax for any browser (needed in "moveImage")
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function fadein() {
  if(typeof(document.getElementById('fadein')) != 'undefined')
    window.setTimeout("opacity('fadein', 100, 0, 1000)",1000);
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
    if(opacity<=0)
      object.display='none';
} 