addLoadListener(init);


function init(){
    
    var url = this.location.href;
    var menu = document.getElementById('menu').getElementsByTagName("a");
	var temp;
    var active_nav = false;   
	
    for( var x = 0; x < menu.length ; x++ ){         
        if (menu[x].href == url) {
			temp =menu[x].className;
            menu[x].className = temp + ' active';
			active_nav = true;
        }		
      }
	  
	  if(active_nav == false){
	  	//alert('we are on the home page');
		temp =menu[0].className;
        menu[0].className = temp + ' active';
	  }
		  
}

 




function addLoadListener(fn)
{
  if (typeof window.addEventListener != 'undefined')
  {
    window.addEventListener('load', fn, false);
  }
  else if (typeof document.addEventListener != 'undefined')
  {
    document.addEventListener('load', fn, false);
  }
  else if (typeof window.attachEvent != 'undefined')
  {
    window.attachEvent('onload', fn);
  }
  else
  {
    var oldfn = window.onload;
    if (typeof window.onload != 'function')
    {
      window.onload = fn;
    }
    else
    {
      window.onload = function()
      {
        oldfn();
        fn();
      };
    }
  }
};
