function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

addLoadEvent(do_onload);

sfHover = function() {
	if (document.getElementById && document.getElementsByTagName) {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent){
	window.attachEvent("onload",sfHover);
}

function menu() {
	if (document.getElementById) {
		var leftColumn = document.getElementById('leftColumn');
		var leftColumnContent = document.getElementById('leftColumnContent');
		var centerColumn = document.getElementById('centerColumn');
		var centerTools = document.getElementById('centerTools');
		var midColumn = document.getElementById('midColumn');
		var rightColumn = document.getElementById('rightColumn');
		var htmlCenter = centerTools.innerHTML;
		var htmlNavBar = document.getElementById('nav').innerHTML;
		if (leftColumn.style.display == 'block') {
			leftColumn.style.display = 'none';
			centerColumn.style.marginLeft = '0';
			centerColumn.style.marginRight = '500px';
			midColumn.style.marginRight = '0';
			rightColumn.style.marginRight = '0';
			centerTools.innerHTML = htmlCenter.replace('Hide','Show');
		} else {
			leftColumn.style.display = 'block';
			leftColumn.style.width = '140px';
			centerColumn.style.marginLeft = '140px';
			centerColumn.style.marginRight = '360px';
			midColumn.style.marginRight = '-140px';
			rightColumn.style.marginRight = '-140px';
			centerTools.innerHTML = htmlCenter.replace('Show','Hide');
			leftColumnContent.innerHTML = '<ul id="menu">' + htmlNavBar + '</ul>';
		}
	}
	adjustLayout();
}

function RSS() {
}

function print() {
}

function email() {
}

function bookmark() {
	if (document.all)
		window.external.AddFavorite(this.location.href, document.title);
	else if (window.sidebar)
		window.sidebar.addPanel(document.title, this.location.href, "")
}

function size(arg) {
	var center = document.getElementById('centerColumnContent');
	var mid = document.getElementById('midColumnContent');
	if (arg == 'minus') {
		center.style.fontSize = '0.6em';
		mid.style.fontSize = '0.6em';
	} else if (arg == 'reset') {
		center.style.fontSize = '0.8em';
		mid.style.fontSize = '0.8em';
	} else if (arg == 'plus') {
		center.style.fontSize = '1em';
		mid.style.fontSize = '1em';
	}
}

function redirect(arg) {
	url = arg.replace(/^http[^?]*?\?url=/,'');
//	alert(url);
	location = url;
}

addLoadEvent(function() {
	var excludedomains=["localhost", "127.0.0.1", "www.sciencedaily.com", "www.sciencedaily.net", "www.sciencedaily.org", "sciencedaily.com", "sciencedaily.net", "sciencedaily.org", "healthology.sciencedaily.com", "sciencedaily.healthology.com", "mediwire.sciencedaily.com", "sciencedaily.mediwire.com", "healthcare.careerbuilder.com", "sciencebiotech.careerbuilder.com", "engineering.careerbuilder.com", "informationtechnology.careerbuilder.com", "www.careerbuilder.com"];
	var excludedomains = excludedomains.join("|");
	rexcludedomains = new RegExp(excludedomains, "i");
	for (i=0; i<=(document.links.length-1); i++) {
		if (document.links[i].hostname.search(rexcludedomains)==-1 && document.links[i].href.indexOf("http:")!=-1) {
			document.links[i].target="_blank";
		}
		if (document.links[i].href.indexOf("/goto.php")!=-1) {
			document.links[i].onclick=new Function("redirect(this.href); return false;");
		}
	}
});

addLoadEvent(adjustLayout);

