
function exit(exitCampus, page){

	SetCookie("userID", null);
	SetCookie("password", null);

	if (exitCampus) 
	{
		document.location.href = "../logoff.asp?r=..";
	}
	else
	{
		if (page==null)
			document.location.href = "../logoff.asp?r=" + document.location.pathname;
		else
		{
			i = document.location.pathname.lastIndexOf("/");
			url = document.location.pathname.substring(0, i) + "/" + page;
			document.location.href = "../logoff.asp?r=" + url;
		}
	}
}
function OpenWinWH(page,w,h) {
	var oWin = window.open(page, "","dependent,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,titlebar=yes,screenX=150,screenY=150,top=150,left=150, width=" + w + ",height=" + h );
	oWin.focus();
}
function loginSubmit(){
	if (document.forms("login").LoginID.value==""){
		alert("Please enter a user name.");
		return;
	}
  document.forms("login").submit();
  return;
}
/*
==================================================================
LTrim(string) : Returns a copy of a string without leading spaces.
==================================================================
*/
function LTrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to LTrim
*/
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

/*
==================================================================
RTrim(string) : Returns a copy of a string without trailing spaces.
==================================================================
*/
function RTrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to RTrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}

function Trim(str)
{
   return RTrim(LTrim(str));
}

function applyIEPatch(doc){
	theObjects = doc.getElementsByTagName("object"); 
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML; 
	}
}

function insertFlashFile(file, width, height, oName, flVars){
	var nameAttr = null;
	if (oName==null || oName=="") {
		nameAttr = "";}
	else{
		nameAttr = "name=\"" + oName + "\" id=\"" + oName + "\"";
	}
	htm ='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH=' + width + ' HEIGHT=' + height + ' ' + nameAttr + '>';
	htm+='<PARAM NAME=movie VALUE="' + file + '">';
	htm+='<PARAM NAME=menu VALUE=false>';
	htm+='<PARAM NAME=quality VALUE=high>';
	htm+='<param name=allowScriptAccess value=sameDomain>';
	//htm+='<param name="wmode" value="transparent">';
	if (flVars!=null) htm+='<PARAM NAME=FlashVars VALUE=' + flVars + '>';
	htm+='<EMBED ' + nameAttr + ' src="' + file + '" FlashVars="' + flVars + '" swliveconnect="true" quality=high MENU=false WIDTH=' + width + ' HEIGHT=' + height + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>';
	htm+='</OBJECT>';
	document.write(htm);
}

function getFlashMovieObject(movieName){
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		var nList = window.document[movieName];
		for (var i = 0; i < nList.length; i++) {
			if (nList[i]=="[object HTMLEmbedElement]") return nList[i];
		}
	}
	else{
		return window.document[movieName];
	}
}