/* 
	Emergency Variables
		To make emergency message visible, line should read var emergency_disp = true;
		To hide emergency message visible, line should read var emergency_disp = false;
		Message displayed is in HTML format surrounded by single quotes.
			*** Entering a contraction will cause an error.
			***		example: can't will cause an error 
			***				 can\'t will correct the error (a backslash before the offending character)
*/
var emergency_disp = false;
var emergency_html = 'All buildings on the Roth Church Road Campus will be closed on Thursday, June 28 due to a planned power outage. This will also affect our web site.';

/* 
	Editor Variables for base directory assignment
		Uncommnet ONE of the following lines only
*/

var host = "http://www.sgasf.org/";
//var host = "http://www.sgasd.org/sgab/";						// For live release
//var host = "http://www.communityefc.com/Playground/sgab/";		// Chris' test site
//var host = "file:///W:/sgab/";										// Lisa's PC
//var host = "file:///W:/Playground/sgab/";										// Lisa's PC
//var host = "file:///C:/Documents%20and%20Settings/groft/My%20Documents/My%20Web%20Sites/sgasd.org/sgab/";	// Chris' laptop

/* 
	Header Variable
		bantxt is the message that scrolls across the header
*/

var bantxt = "Shaping the future... one student at a time.";
var ban_len = bantxt.length;
var ban_i = 0;
/* 
	Header Variable
		grovetxt is currently unused
*/
var grovetxt = "The Grove is Growing . . . Grow with Us !";
var grove_len = bantxt.length;
var grove_i = 0;

/* 
	Miscellaneous Variables
*/
var buffer = 0;

function setPathDepth() {
	var href = document.location.href;
	var host = document.location.host;
	var pathname = document.location.pathname;
	
	if (host.length > 0) {host = 'http://' + host;}
	var hreflen = href.length;
	var hostlen = host.length;
	var pathlen = pathname.length;

	pathname = pathname.substring(1,pathlen);
	pathlen--;
	var slash = pathname.lastIndexOf("/");
	pathname = pathname.substring(1,pathlen);
	
alert(slash + " " + pathname);
	var file = href.substring(hostlen,(hreflen - pathlen ));

var slashcnt = 0;
	for ( i=0; i<pathlen; i++) {
		var str = pathname.charAt(i);
		if ((str == "/") || (str == "\\")) {slashcnt++;}
	}
//	slashcnt--;
//	slashcnt--;
//	if (slashcnt == 0) {return 0;}
//	else {return -slashcnt;}
	return slashcnt;
}	
			
function setEmergency() {
		if (emergency_disp == true) {
			emergencytxt.innerHTML = emergency_html;
			emergency.style.visibility = 'visible';
			emergency.style.display = '';
		}
		else {
			emergencytxt.innerHTML = "&nbsp;";
			emergency.style.visibility = 'hidden';
			emergency.style.display = 'none';
		}
}

function setBanner() {
	banner.innerText += bantxt.charAt(ban_i)
	ban_i++;
		if (ban_i > ban_len) {
		ban_i = 0;
		setTimeout('banner.innerText = "";',5000);
		setTimeout('setBanner();',5000);
	}
	else {setTimeout('setBanner();',125);
	}
}

function initNormal(offset) {
	setHeader();
	BuildMenuLeft();
	setMenuLeft();
	setMainpage();
//	setEmergency();
//	setMenuRight();
//	setBanner();
	setFooter();
}

function initWide(offset) {
//	clearMenuRight();
	setHeader();
//	BuildMenuLeft();
	setMenuLeft();
	setMainpage();
//	setEmergency();
//	setBanner();
	setFooter();
	footer.style.width = 655;
}

function setHeader() {
	header.style.top = 0;
	header.style.left = 0;
	HeaderHeight = header.clientHeight;
}

function setMenuLeft() {
	menuleft.style.top = 0;
	menuleft.style.left = 0;
	MenuLeftHeight = menuleft.clientHeight;
	MenuLeftWidth = menuleft.clientWidth;
}

function setMainpage() {
	mainpage.style.top = HeaderHeight - 7;
	mainpage.style.left = MenuLeftWidth + 0;
	MainpageHeight = mainpage.clientHeight + buffer;
	MainpageWidth = mainpage.clientWidth;
}

function setMenuRight() {
	menuright.style.top = HeaderHeight - 7;
	menuright.style.left = MenuLeftWidth + MainpageWidth + 3;
	MenuRightHeight = menuright.clientHeight + buffer;
	MenuRightWidth = menuright.clientWidth;
	menuright.style.visibility = 'visible';
	menuright.style.display = '';
	}

function clearMenuRight() {
	menuright.style.visibility = 'hidden';
	menuright.style.display = 'none';
}

function setFooter() {
	footer.style.top = MainpageHeight + HeaderHeight;
	footer.style.left = MenuLeftWidth + 0;
	footer.style.visibility = 'visible';
	footer.style.display = '';
}

function pop(num,vis)  {
	if (vis == 1) { 
		eval("pop" + num + ".style.left=event.clientX+5;") 
		eval("pop" + num + ".style.top=event.clientY+5;") 
		eval("pop" + num + ".style.visibility='visible';") 
	}
	if (vis == 0) { eval("pop" + num + ".style.visibility='hidden';") }
}