window.onload = function(){
	setTargetBlank();
}

//--------------------------------------------------------------------------------------------------

//Browser Detection/Redirection
detect();
function detect(){
	var userAgent = navigator.userAgent;
	//KEEP OUT: IE 5.0, IE 5.5, NN 7.x
	if(userAgent.indexOf("MSIE 5.0") != -1 || userAgent.indexOf("MSIE 5.5") != -1 || userAgent.indexOf("Netscape/7") != -1 ){
		location.href = "upgrade";
	}
}

//--------------------------------------------------------------------------------------------------
			
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

//--------------------------------------------------------------------------------------------------

//standards-compliant target="_blank" functionality
function setTargetBlank() {
	if (document.getElementsByTagName){
		var arrAnchors = document.getElementsByTagName("a");
		for (var i=0; i<arrAnchors.length; i++) {
			var anchor = arrAnchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "blank"){
				anchor.target = "_blank";
			}
		}
	}
}

//--------------------------------------------------------------------------------------------------

//open centered popup
function openPopup(URL, ident, width, height, scrolling){
	var startX = ((screen.availWidth - width)/2);
	var startY = ((screen.availHeight - height)/2);		
	var options = "height=" + height + ",width=" + width + ",left=" + startX + ",top=" + startY + ",screenX=" + startX + ",screenY=" + startY + ",directories=no,location=no,menubar=no,resizable=no,noresize,scrollbars="+scrolling+",status=no,titlebar=no,toolbar=no";
	var objWindow = window.open(URL, ident, options);
	objWindow.focus();
}
