	var sbSchool;
	var gIsCookie;
	var gSchoolDeptList;
	function setSBSchool(iID)
	{
		sbSchool = iID;
		if (checkIsCookie())
			createCookie('sbSchool',iID, 180);
	}
	function getSBSchool()
	{
		if (checkIsCookie())
		{
			var lCookieValue = readCookie('sbSchool');
			if (lCookieValue != null)
				return lCookieValue;
		}
		return 0;
	}
	function createCookie(name,value,days) 
	{
		if (days) 
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+escape(value)+expires+"; path=/";
	}
	function readCookie(name) 
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) 
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
		}
		return null;
	}

	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	function checkIsCookie()
	{
		gIsCookie=(navigator.cookieEnabled)? true : false;
		if (typeof navigator.cookieEnabled=="undefined" && !gIsCookie)
		{ 
			document.cookie="testcookie";
			gIsCookie=(document.cookie.indexOf("testcookie")!=-1)? true : false;
		}
		return gIsCookie;
	}
	// This function returns whether a valid email has been submitted
	function isValidEmail(iEmail)
	{
		if (iEmail==""){return false;}
		//var myRegExp = new RegExp("^[a-zA-Z0-9]+@[a-zA-Z0-9]+.[a-zA-Z0-9]{2,3}$");
		var myRegExp = /^((([a-zA-Z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-zA-Z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-zA-Z]|[0-9])([a-zA-Z]|[0-9]|\-){0,61}([a-zA-Z]|[0-9])\.))*([a-zA-Z]|[0-9])([a-zA-Z]|[0-9]|\-){0,61}([a-zA-Z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/;
		return myRegExp.test(iEmail);
	}
	// This function gets the selected value
	function getSelectedValue(iID)
	{
		var lSelObj = document.getElementById(iID);
		if (lSelObj.selectedIndex >= 0)
			return lSelObj.options[lSelObj.selectedIndex].value;
		else
			return -1;
	}
	// This function handles the result
	// Return 0 - Not Done, -1 - System Error, String - Result
	function checkResult(iHttp)
	{
		var lError = true;
		if (iHttp.readyState == 4 ) 
		{
			if (iHttp.status == 200)
			{
				if (iHttp.responseText.length > 0)
					return iHttp.responseText;
				else
					return -1;
			}
			else
				return -1;
		}
		return 0;
	}
	function getxmlhttp()
	{
		if (window.XMLHttpRequest) // Mozilla, Safari,...
		{
       gReqHttp = new XMLHttpRequest();
    } 
    else if (window.ActiveXObject)  // IE
    {
			try {gReqHttp = new ActiveXObject("Msxml2.gSampleHttp");}
      catch (e) 
      {
        try {gReqHttp = new ActiveXObject("Microsoft.gSampleHttp");}
        catch (e) {}
			}
    }   
    if (!gReqHttp)
       return 0;
		return gReqHttp;
	}
	// This function changes a value in the CSS
	function changecss(iClass, iElement, iValue) 
	{
	 	var lRules;
		for (var i=0; i<document.styleSheets.length; i++)
		{
			var lCurStyleSheet = document.styleSheets[i];
			if (lCurStyleSheet['rules'])
		  	lRules = 'rules';
			else if (lCurStyleSheet['cssRules'])
		  	lRules = 'cssRules';
			for (var j=0; j<lCurStyleSheet[lRules].length; j++)
				if (lCurStyleSheet[lRules][j].selectorText == iClass)
					if (iElement in lCurStyleSheet[lRules][j].style)
						lCurStyleSheet[lRules][j].style[iElement] = iValue;
		}
	}
	function showHide(iShow, iHide)
	{
		// Show Items
		if (iShow)
		{
			var lShowList = iShow.split(',');
			for (var i=0; i<lShowList.length; i++)
				if (document.getElementById(lShowList[i]))
					document.getElementById(lShowList[i]).style.display = '';
		}
		// Hide Items
		if (iHide)
		{
			var lHideList = iHide.split(',');
			for (var i=0; i<lHideList.length; i++)
				if (document.getElementById(lHideList[i]))
					document.getElementById(lHideList[i]).style.display = 'none';
		}
	}
	// This function sets the options in a list
	function setSelectList(iName, iList, iCur)
	{
		var lSelectObj = document.getElementById(iName);
		if (!iCur && lSelectObj.selectedIndex > -1)
			iCur = lSelectObj.options[lSelectObj.selectedIndex].value;
		lSelectObj.options.length = 0;
		for (var i=0; i<iList.length; i++)
		{
			var lValue = iList[i][0];
			lSelectObj.options[lSelectObj.length] = new Option(iList[i][1], lValue);
			if (lValue == iCur)
				lSelectObj.selectedIndex = i;
		}
	}
	// This function sets the value
	function setSelectedValue(iID, iValue)
	{
		var lSelObj = document.getElementById(iID);
		if (lSelObj)
    	for ( var i = 0; i < lSelObj.options.length; i++ )
        if ( lSelObj.options[i].value == iValue )
        {
            //lSelObj.options[i].selectedIndex = i;
            lSelObj.selectedIndex = i;
            return;
        }
	}
	// This function adds a horizontal rule
	function addSelectHRule(iSelName)
	{
		var lSelectObj = document.getElementById(iSelName);
		var lOption = new Option('---------', '9999');
		lOption.disabled = true;
		lSelectObj.options[lSelectObj.length] = lOption;
	}
	// This function adds a select option wiht a class
	function addSelectOptClass(iSelName, iValue, iLabel, iClass, iCurValue)
	{
		var lSelectObj = document.getElementById(iSelName);
		var lOption = new Option(iLabel, iValue);
		lOption.className = iClass;
		lSelectObj.options[lSelectObj.length] = lOption;
		if (iCurValue == iValue)
			lSelectObj.selectedIndex = lSelectObj.length-1;
	}
	function showCenterDiv(iDivName, iDefaultWidth, iDefaultHeight)
	{
		// Account for root
		//var lLeftFudge = (document.getElementById('root')) ? document.getElementById('root').offsetLeft : 0;
		//var lTopFudge = (document.getElementById('content')) ? document.getElementById('content').offsetTop : 0;
		if (!iDefaultWidth)
			iDefaultWidth = 500;
		if (!iDefaultHeight)
			iDefaultHeight = 500;
		var lDiv = document.getElementById(iDivName);
		lDiv.style.display = '';
		var lDivWidth = getDivWidth(lDiv, iDefaultWidth);
		var lDivHeight = getDivHeight(lDiv, iDefaultHeight);
		var lPageWidth = getPageWidth();
		var lPageHeight = getPageHeight();
		var lScrollTop = f_scrollTop();
		var lPosnLeft = (lPageWidth - lDivWidth)/2 ; // - lLeftFudge
		var lPosnTop = (lPageHeight - lDivHeight)/2 + lScrollTop; // - lTopFudge
		if (lPosnTop < (10 + lScrollTop))
			lPosnTop = (10 + lScrollTop);
		lDiv.style.left = lPosnLeft + "px";
		lDiv.style.top = lPosnTop + "px";
		//alert("showCenterDiv:: lPosnLeft:"+lPosnLeft+", lPosnTop:"+lPosnTop);
	}
	function getPageWidth()
	{
	  return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
	}
	function getPageHeight()
	{
	  return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
	}
	function getDivWidth(iDiv, iDefaultWidth)
	{
		if (iDiv.style.width > 0)
			return parseInt(iDiv.style.width);
		else if (iDiv.offsetWidth > 0)
			return parseInt(iDiv.offsetWidth);
		else if (iDiv.clintWidth > 0)
			return parseInt(iDiv.clintWidth);
		return iDefaultWidth;
	}
	function getDivHeight(iDiv, iDefaultHeight)
	{
		return (iDiv.style.height > 0) ? parseInt(iDiv.style.height) : ((iDiv.offsetHeight > 0) ? parseInt(iDiv.offsetHeight) : ((iDiv.clintHeight > 0) ? parseInt(iDiv.clintHeight) : iDefaultHeight));
	}
	function f_scrollTop()
	{
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0);
	}
	function f_filterResults(n_win, n_docel, n_body)
	{
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}
	// This function toggles checkboxes
	function toggleCheckboxes(iForm, iCheckboxName, iChecked)
	{
		lCheckGrp = iForm[iCheckboxName];
		if (lCheckGrp)
		{
			if (lCheckGrp.length)
			{
				for (i=0; i<lCheckGrp.length; i++)
					lCheckGrp[i].checked = iChecked;
			}
			else
				lCheckGrp.checked = iChecked;
		}
	}
