var intHeight = 0;
var intTransTime = 40;
function moveCurtainContent(objElementID) {
	objAllContent = document.getElementById('allContent');
	objElement = document.getElementById(objElementID);
	moveCurtainDown(objAllContent, objElement, objElement.scrollHeight, true);
}

function moveCurtainDown(objAllContent,objElement,intMaxHeight,boolUp){
    if (boolUp == false) {
		intHeight = objElement.clientHeight;
		objElement.style.height = Math.min(Math.floor(intHeight * 2), intMaxHeight) + "px";
		if(intHeight < intMaxHeight)
			window.setTimeout('moveCurtainDown(objAllContent, objElement,' + intMaxHeight + ', false)', intTransTime);
	}
	else {
		intHeight = objAllContent.clientHeight;
		objAllContent.style.height = Math.floor(intHeight / 2) + "px";
		if(intHeight > 0)
			window.setTimeout('moveCurtainDown(objAllContent, objElement, 0, true)', intTransTime);
		else {
			if (document.getElementsByTagName) {
				var arrDivs = document.getElementsByTagName("div");
				if (objAllContent.id != objElement.id) {
					for (var i=0; i<arrDivs.length; i++) {
						if (arrDivs[i].className == "curtainContent")
							arrDivs[i].style.display = "none";	
					}
				}
				else {
					for (var i=0; i<arrDivs.length; i++) {
						if (arrDivs[i].className == "curtainContent") {
							arrDivs[i].style.height = "auto";
							arrDivs[i].style.display = "block";
						}
					}
				}
			}
			if (objAllContent.id != objElement.id) {
				objAllContent.style.display = "block";
				objAllContent.style.height = "auto";
			}
			objElement.style.display = "block";
			objElement.style.height = "1px";
			
			window.setTimeout('moveCurtainDown(objAllContent, objElement, objElement.scrollHeight, false)', intTransTime);	
		}
	}
}

function setContentPieces() {
	if (document.getElementsByTagName) {
		var arrDivs = document.getElementsByTagName("div");
		var objAllContent = document.getElementById('allContent');
		objAllContent.style.display = "block";
		objAllContent.style.overflow = "hidden";
		objAllContent.style.height = "auto";
		document.getElementById('showAllContentLink').style.display = 'block';
		for (var i=0; i<arrDivs.length; i++) {
			if (arrDivs[i].className == "curtainContent") {
				arrDivs[i].style.display = "block";	
				arrDivs[i].style.height = "auto";
				arrDivs[i].style.overflow = "hidden";
			}
		}
	}
}

function makeLinksNewWindows(objElement) {
	if (document.getElementsByTagName) {
		var arrLinks = 	document.getElementById(objElement).getElementsByTagName("a");
		for (var i=0; i<arrLinks.length; i++) {
			arrLinks[i].target = "_blank";	
		}
	}
 }
 
 function extOrPDFNewWindow() {
	if (document.getElementsByTagName) {
		var arrLinks = 	document.getElementsByTagName("a");
		for (var i=0; i<arrLinks.length; i++) {
			if (arrLinks[i].getAttribute("rel") == "extorpdf") {
				arrLinks[i].target = "_blank";	
			}
		}
	}
 }

 function sysFAQ(objElement) {
	var win;
	win=window.open('https://apply.wisconsin.edu/','syswin','height=500,width=800,top=350px,location=yes,resizable=yes,menubar=yes,scrollbars=yes,toolbar=yes,status=yes');
	objElement.href='asksearch/index.php?cat=55002&q=application';
}

function popup(file){
	mypopup = window.open(file,"x","location=yes,toolbar=yes,status=yes,titlebar=yes,menubar=yes,width=930,scrollbars=yes,resizable=yes");
	mypopup.focus();
}

function popupProfile(file){
	mypopup = window.open(file,"x","location=yes,toolbar=yes,status=yes,titlebar=yes,menubar=yes,width=2000,scrollbars=yes,resizable=yes");
	mypopup.focus();
}