function globalOnLoad() {
    // Assign link events
    for (var i = 0; i < document.links.length; i++) {
        if (document.links[i].className.match('External')) {
            document.links[i].onclick = function() { offsitePopup(this.href); return false; }
        }
        if (document.links[i].className.match('Enlargement')) {
            document.links[i].onclick = function() { enlargementPopup(this.href, this.title); return false; }
        }
    }

    // Run page onLoad function, if it exists
    if (typeof onLoad != 'undefined') {
        onLoad();
    }

	rotateTimer = setTimeout("rotateLogo();",5000);
}

function offsitePopup(url) {
    var popUp = window.open(url, 'offsiteWindow', 'width=750,height=500,scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes');
    if (typeof popUp == 'object') {
        popUp.focus();
    }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(globalOnLoad);

lastTable = "";
function showChart(trigger) {
//	if (lastTable > "") $(lastTable).style.display="none";
  	chart = trigger[trigger.selectedIndex].value;
    if (chart > "") {
		if (/\.[gif|jpg|png]/.test(chart)) {
			chart = '<p><img src="/lib/images/charts/' + chart + '" border="0" /></p>';
			lastTable = "";
			Element.update('Graph',chart);
		} else {
			$(chart).style.display="block";
			lastTable = chart;
			Element.update('Graph',"");
		}
	}
	window.location="#" + chart
}

function rotateLogo() {
	whichImg = ($('LogoImg').src.indexOf('zeonex.gif') > 0)?"zeonor":"zeonex";
	$('LogoImg').src = "/lib/images/badge_hdr_"+whichImg+".gif"
	if ($('HomeLogo')) $('HomeLogo').src = "/lib/images/top_home-"+whichImg+".jpg"
	rotateTimer = setTimeout("rotateLogo();",5000);
}
