window.onload = function(){
	if(document.getElementById("container").offsetHeight < document.documentElement.clientHeight){
		document.getElementById("container").className = "stretch";
	}
	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 ){
		//alert("Unsupported Browser: \n" + userAgent);
		location.href = "upgrade/index.php";
	}
}

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

//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){

	if(height > screen.availHeight){
		scrolling = "yes";
		width += 17;
	}

	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();
}



function openclose(val){
	if(document.getElementById(val.parentNode.id + "-text").style.display == "block"){
		document.getElementById(val.parentNode.id + "-text").style.display = "none";
		val.innerHTML = "more";
	}else{
		document.getElementById(val.parentNode.id + "-text").style.display = "block";
		val.innerHTML = "less";
	}
}