// allows for multiple functions to be called using the onload command
// EXAMPLE USAGE: addEvent(window, 'load', someFunctionToLoad);
function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

//These scripts enable windows to open and close in the parent and popup.
function win(fileName, iWidth, iHeight) {
     myFloater = window.open('','myWindow','toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no')
	 myFloater.location.href = fileName;
	 myFloater.resizeTo(iWidth, iHeight);
	 myFloater.moveTo(50, 50);
     myFloater.focus();
}
function win2(href) {
	 opener.location.href = href;
	 window.close();
}
function mainOpen(href) {
	main = window.opener;
	if (main == null || main.closed == true) {
		main = window.open('','main','');
	}
	main.location.href = href;
	main.focus();
}
// This is a script which prints the window!
function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}
// framebuster
function FrameBuster(){
	if (top.frames.length != 0) 
	{
		top.location = document.URL; 
	}
}
// these two functions keep the minimum width of our pages
function P7_limit(a,b){ //v1.1.2 by PVII-www.projectseven.com
	document.p7limit=a;
	document.p7min=b;
	if(document.getElementById&&navigator.appVersion.indexOf("MSIE")>-1&&!window.opera){
		if(window.attachEvent){
			window.attachEvent("onresize",P7_setMinWidth);
			window.attachEvent("onload",P7_setMinWidth);
		}else{
			onload=P7_setMinWidth;
			onresize=P7_setMinWidth;
		}
	}
}
function P7_setMinWidth(){ //v1.1.2 by PVII-www.projectseven.com
	var cw,w,pl,pr,ml,mr,br,bl,ad,theDiv=document.p7limit;
	var g=document.getElementById(theDiv);
	w=parseInt(document.p7min);
	if(g&&document.body&&document.body.clientWidth){
		gs=g.currentStyle;
		cw=parseInt(document.body.clientWidth);
		pl=parseInt(gs.paddingLeft);
		pr=parseInt(gs.paddingRight);
		ml=parseInt(gs.marginLeft);
		mr=parseInt(gs.marginRight);
		bl=parseInt(gs.borderLeftWidth);
		br=parseInt(gs.borderRightWidth);
		ml=ml?ml:0;
		mr=mr?mr:0;
		pl=pl?pl:0;
		pr=pr?pr:0;
		bl=bl?bl:0;
		br=br?br:0;
		ad=pl+pr+ml+mr+bl+br;
		if(cw<=w){
			w-=ad;
			g.style.width=w+"px";
		}else{
			g.style.width="auto";
		}
	}
}

// the following line is called in the
//P7_limit('wrapper',780);
//*****************************************************************
// the following are functions for the student accounts website
// this is a link to the FACTS e-Cashier system for the Fredericksburg campus
function startFACTS()
{
	var f_link = "https://www.factstuition.com/ecashier/Index?OpenForm&query=univofmarywash";
	var stats = 'toolbar=no,location=no,directories=no,status=yes,menubar=no,width=795,';
	stats += 'height=520,resizable=yes,scrollbars=yes,screenx=0,screeny=0,top=0,left=0';
	remoteWin = window.open(f_link,"remote",stats);
}
// this is a link to the FACTS e-Cashier system for the Stafford campus
function startFACTSCGPS()
{
	var f_link = "https://www.factstuition.com/ecashier/Index?OpenForm&query=univofmarywashgrad";
	var stats = 'toolbar=no,location=no,directories=no,status=yes,menubar=no,width=795,';
	stats += 'height=520,resizable=yes,scrollbars=yes,screenx=0,screeny=0,top=0,left=0';
	remoteWin = window.open(f_link,"remote",stats);
}
//*****************************************************************
// this function is for image rollovers in the virtual tour
function chgText(layerName)
{
	if (document.all) {
		document.all('bldg_name').innerHTML = layerName;
	}
	else if (document.getElementById) {
		document.getElementById('bldg_name').innerHTML = layerName;
	}
}
function chgTextOn(layerName){
//on mouse over
//	var bullet = "bullet_" + layerName;
	if (document.all) {
		document.all(layerName).style.color = "#000066";
//		document.all(bullet).style.color = "#000066";
//		document.all(layerName).style.borderRightColor = "#000066";
//		document.all(layerName).style.borderRightStyle = "solid";
//		document.all(layerName).style.borderRightWidth = "7px";
	}
	else if (document.getElementById) {
		document.getElementById(layerName).style.color = "#000066";
//		document.getElementById(bullet).style.color = "#000066";
//		document.getElementById(layerName).style.borderRightColor = "#000066";
//		document.getElementById(layerName).style.borderRightStyle = "solid";
//		document.getElementById(layerName).style.borderRightWidth = "7px";
	}
}

function chgTextOff(layerName){
//on mouse out
	var bullet = "bullet_" + layerName;
	if (document.all) {
		document.all(layerName).style.color = "#666666";
//		document.all(bullet).style.color = "#f7f7f7";
//		document.all(layerName).style.borderRightColor = "#f7f7f7";
//		document.all(layerName).style.borderRightStyle = "solid";
//		document.all(layerName).style.borderRightWidth = "0px";
	}
	else if (document.getElementById) {
		document.getElementById(layerName).style.color = "#666666";
//		document.getElementById(bullet).style.color = "#f7f7f7";
//		document.getElementById(layerName).style.borderRightColor = "#f7f7f7";
//		document.getElementById(layerName).style.borderRightStyle = "solid";
//		document.getElementById(layerName).style.borderRightWidth = "0px";
	}
}