addOnload(initAll);
addOnload(setupPopups);

function addOnload(newFunction) {
	var oldOnload = window.onload;

	if(typeof oldOnload == "function") {
		window.onload = function() {
			if(oldOnload) {
				oldOnload();
			}
			newFunction();
		}
	}
	else {
		window.onload = newFunction;
	}
}

function initAll() {
	var allLinks = document.getElementsByTagName("a");

	for (var i=0; i<allLinks.length; i++) {
		if (allLinks[i].className.indexOf("menuLink")> -1) {
			allLinks[i].onclick = function() {return false;}
			allLinks[i].onmouseover = toggleMenu;
		}
	}
}

function toggleMenu() {
	var startMenu = this.href.lastIndexOf("/")+1;
	var stopMenu = this.href.lastIndexOf(".");
	var thisMenuName = this.href.substring(startMenu,stopMenu);

	document.getElementById(thisMenuName).style.display = "block";

	this.parentNode.className = thisMenuName;
	this.parentNode.onmouseout = toggleDivOff;
	this.parentNode.onmouseover = toggleDivOn;

}

function toggleDivOn() {
	document.getElementById(this.className).style.display = "block";

}

function toggleDivOff() {
	document.getElementById(this.className).style.display = "none";

}


// <![CDATA[
    var properties = { width: 655,
                       height: 495,
                       scrollbars: 'no',
                       resizable: 'no' };
    function popup(){
      var link = this.getAttribute( 'href' );
      var prop_str = '';
      for( prop in properties ){
        prop_str = prop_str + prop + '=' + properties[prop] + ',';
      }
      prop_str = prop_str.substr( 0, prop_str.length - 1 );
      var newWindow = window.open( link, '_blank', prop_str );
      if( newWindow ){
        if( newWindow.focus ) newWindow.focus();
        return false;
      }
      return true;
    }
    function setupPopups(){
      var links = document.getElementsByTagName( 'a' );
      for( var i=0; i<links.length; i++ ){
        if( links[i].getAttribute( 'rel' ) &&
            links[i].getAttribute( 'rel' ) == 'popup' ) links[i].onclick = popup;
      }
    }
   
    // ]]>