function showPopup(url, name, height, width, scroll, resizable, statusbar, screenpos) {
	var Xwin = width;
	var Ywin = height;
	var Xsize = screen.availWidth;
	var Ysize = screen.availHeight;
	var Xpos = 0;
	var Ypos = 0;
	switch(screenpos) {
		case "topleft":
			Xpos = 0;
			Ypos = 0;
			break;
		case "topright":
			Xpos = Xsize - width;
			Ypos = 0;
			break;
		case "bottomleft":
			Xpos = 0;
			Ypos = Ysize - height;
			break;
		case "bottomright":
			Xpos = Xsize - width;
			Ypos = Ysize - height;
			break;
		default:
			Xpos = (Xsize - width) / 2;
			Ypos = (Ysize - height) / 2;
			break;
	}
	var popwin;
	var opts = "status=" + statusbar + ",resizable=" + resizable + ",scrollbars=" + scroll + ",height=" + Ywin + ",width=" + Xwin + ",left=" + Xpos + ",top=" + Ypos;
	popwin = window.open(url, name, opts);
	popwin.focus();
}

function openFixedPopup(url, name) {
	showPopup(url, name, 450, 518, 1, 1, 1, 'default');
}

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

function checkforNetscape4() {
	if (navigator.appName == "Netscape" && (navigator.userAgent.indexOf("Mozilla/4.") != -1)) {
		location.href = "/upgrade.htm";
	}
}

/* added 13:19 05/05/2004 */

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function changeStyle(element, strClass) {
	element.className = strClass;
}

function toggleNode(strNode) {
	theNode = document.getElementById(strNode);
	theMark = document.getElementById("mark" + strNode);
	if (theNode.style.display == "none") {
		theNode.style.display = "block";
		changeImages("mark" + strNode, "/images/navMinus.gif");
	} else if (theNode.style.display == "block") {
		theNode.style.display = "none";
		changeImages("mark" + strNode, "/images/navPlus.gif");
	}
}

function collapseAll() {
	// collapse all switches
	NavAnchors = document.getElementsByTagName("img");
	for (i=0; i<NavAnchors.length; i++) {
		switchString = String(NavAnchors[i].id);
		if (switchString.indexOf("mark") != -1) {
			theNodeToBeSwitched = switchString.slice(switchString.indexOf("mark") + 4);
			if (doDebug) alert("collapsed: " + nodesToSwitch[i]);
			toggleNode("" + theNodeToBeSwitched);
		}
	}
}

function expandSelectedNodes() {
	// expand path to this page
	// nodesToSwitch is generated from navStrings output include
	if (nodesToSwitch != "") {
		if (nodesToSwitch.slice(nodesToSwitch.lastIndexOf("|||")) == "|||") {
			nodesToSwitch = nodesToSwitch.slice(0, nodesToSwitch.lastIndexOf("|||"));
		}
		nodesToSwitch = nodesToSwitch.split("|||");
		for (i=0; i<nodesToSwitch.length; i++) {
			theNode = document.getElementById(nodesToSwitch[i]);
			if (theNode != -1) {
				if (doDebug) alert("expanded: " + nodesToSwitch[i]);
				toggleNode("" + nodesToSwitch[i]);
			}
		}
	}
}

function showMenuStatus(theID) {
	theNode = document.getElementById(theID);
	if (theNode.style.display == "none") {
		strStatus = "Click to expand this menu";
	} else if (theNode.style.display == "block") {
		strStatus = "Click to contract this menu";
	}
	window.status = strStatus;
}

function clearMenuStatus() {
	window.status = '';
}

function initPage() {
	checkforNetscape4();
}


function sendEmailTo(theUser) {
	location.href = "mailto:" + theUser + "@stmarys-belfast.ac.uk";
}

function goToURL(formname,fieldname) {
getvalue=eval('document.'+formname+'.'+fieldname+'  .selectedIndex');
newWindow = 0
switch (getvalue)
{
case 0 :
newURL = ""
break;

case 1 :
newURL = "https://www.stmarys-belfast.ac.uk/admissions/application/status.asp"
break;

case 2 :
newURL = "http://www.stmarys-belfast.ac.uk/admissions/courseinfo.asp"
break;

case 3 :
newURL = "http://www.stmarys-belfast.ac.uk/library/default.asp"
break;

case 4 :
newURL = "http://www.stmarys-belfast.ac.uk/downloads/prospectus/prospectus10.pdf"
newWindow = 1
break;

case 5 :
newURL = "https://www.stmarys-belfast.ac.uk/academic/students/union.asp"
break;

case 6 :
newURL = "http://www.stmarys-belfast.ac.uk/general/termdates.asp";
break;

case 7 :
newURL =  "http://www.stmarys-belfast.ac.uk/downloads/news/entry%202010.pdf"
newWindow = 1
break;

case 8 :
newURL =  "http://www.stmarys-belfast.ac.uk/academic/education/pdot.asp"
break;

case 9 :
newURL =  "https://fe3.smucb.ac.uk/owa"
break;

case 10 :
newURL = "http://www.stmarys-belfast.ac.uk/general/help/default.asp"
break;

}
if (newURL != "")
 { 
   if (newWindow==0) {self.location=newURL;}
   else {window.open(newURL,"_blank","");}
 }
}
