
	/** ----------------------------- doAdminMenuChange --------------------------- **
		This routine merely hides or displays the various menus
		These menus are defined in adminutils.php
			menu_row = the id name of the <tr> tag containing the table we hide or show
			menu_img = the little graphic either on or off
			menu_status = a hidden field for storing the current state between pages
	**/
	
	function doAdminMenuChange(menu_row,menu_img,menu_status) 	{
		var f = self.document.form1;

		var obj = self.document.getElementById(menu_row);
		var img = self.document.getElementById(menu_img);
		var stat = self.document.getElementById(menu_status);
		var status = stat.value;
		
		var msievers = msieversion();		//-- from the microsoft site, supposedly compatible with all future versions, will be 0 if not an msie browser, in utils.js

		if (status == "off") {
			
			//obj.style.display = "table-row";		//-- changed 2/5/09 because 'table-row' would not work in IE 7.0
			//obj.style.display = "inline";			//-- changed 2/6/09 because it messed up camino & firefox
			//obj.style.display = "";				//-- this is a hack from the Internet, camino & firefox will restore to 'table-row', IE does whatever.
			
			if (msievers == 0)	{
				obj.style.display = "table-row";
			} else {
				obj.style.display = "inline";
			}
			
			img.src = "/grfs/onTiny.jpeg";
			stat.value = "on";
		} else {
			obj.style.display = "none";
			img.src = "/grfs/offTiny.jpeg";
			stat.value = "off";
		}	
		
	}	//-- doAdminMenuChange


	/** ----------------------------- admin_showHideTableRow --------------------------- **
		This routine merely hides or shows a table row identified by the following
			tr_rowid = the id name of the <tr> tag containing the table we hide or show
			tr_imgid = the little graphic either on or off
			tr_status = a hidden field for storing the current state between pages
	**/
	
	function admin_showHideTableRow(tr_rowid,tr_imgid,tr_status) 	{
		var f = self.document.form1;

		var obj = self.document.getElementById(tr_rowid);
		var img = self.document.getElementById(tr_imgid);
		var stat = self.document.getElementById(tr_status);
		var status = stat.value;
		
		var msievers = msieversion();		//-- from the microsoft site, supposedly compatible with all future versions, will be 0 if not an msie browser, in utils.js

		if (status == "off") {

			if (msievers == 0)	{
				obj.style.display = "table-row";
			} else {
				obj.style.display = "inline";
			}
			img.src = img.src.replace("off", "on");
			stat.value = "on";

		} else {
			obj.style.display = "none";
			img.src = img.src.replace("on", "off");
			stat.value = "off";
		}	
		
	}	//-- admin_showHideTableRow
	

	/** ----------------------------- goPage --------------------------- **
		This routine simply navigates to a page by calling a submit so we can have our post
		and have our various menu status variable go with us
	**/
	
	function goPage(dest, proc) 	{
		var f = self.document.form1;

		f.action = dest;
		f.proc.value = proc;
		return f.submit();
		
	}


	/** ----------------------------- stdDoDblClick --------------------------- **
		called when we detect a dblclick event handler and simply submits the form after calling
		a local routine named checkData().
	**/

	function stdDoDblClick()	{
		f = self.document.form1;
		$flag = checkData();
		if (!$flag) return false;
		f.submit();
	}
	
	

	/** ----------------------------- resetID --------------------------- **
		Called from an onChange handler, resets the value of the select object
		indicated by "fs" to
		match the current indices value (rather than the option)
	**/

	function resetID(fs, objid)	{
		obj = self.document.getElementById(objid);

		if (obj != null && fs.selectedIndex != -1)
			obj.value = fs.options[fs.selectedIndex].value;
			
	}
	
	
	/** ----------------------------- doReload --------------------------- **
		This routine simply reloads a page by calling a submit with the current path
		as the action.  IF you want to alter the proc, you'll have to fix the f.proc.value
		before calling this routine.
		
	**/

	function doReload()	{
	
		var obj1 = self.document.getElementById("rproc");
		var obj2 = self.document.getElementById("proc");
		if (obj1 != null && obj2 != null)	{
			obj1.value = obj2.value;
			obj2.value = "reload";
		}
	
		var f = self.document.form1;
		f.action = self.location.pathname;
		f.submit();
		return false;
		
	}



	/** ----------------------------- doDelete --------------------------- **
		Simply alerts the user & sends us back to "where" with a proc of "delete"
		
	**/

	function doDelete(where)	{
		var f = self.document.form1;
	
		var flag = confirm("Are you sure you want to delete this record?\r\rThis cannot be undone!");
		if (!flag) return false;

	
		f.action = where;
		f.proc.value = "delete"
		f.submit();
		return true;
		
	}
	
	




	/** ----------------------------- changeSort --------------------------- **
		Called from an onClick handler, refreshes the page with a
		different sortBy
		ASSUMES a hidden object named "sortby" loaded with the name of the sortby at load time.
	**/

	function changeSort(how)	{
		var f = self.document.form1;
		oldsort = f.sortby.value;

		if (oldsort != how)	{
			f.sortby.value = how;
			doReload();
		}
		return true;
	}

	/** ----------------------------- changeDest --------------------------- **
		Called from an onClick handler, refreshes the page with a
		different destination
		ASSUMES a hidden object named "dest" loaded with the name of the dest at load time.
	**/

	function changeDest(where)	{
		var obj = self.document.getElementById("dest");
		
		if (obj != null)	{
			if (obj.value != where)	{
				obj.value = where;
				//doReload();
			}
		} //-- if
		return true;
	}



	/** ----------------------------- doAdminCityChange --------------------------- **
		given the id of a select object, and the id of a hidden "other city" field,
		this routine will show or hide the "other city" field based on the current value of the select obj.
		
		Important!  You must have an option in the select with a value of 255 & text of "other" for this to work
		
		default_text	=	default text, if any to put in an empty "other city" field
			** Note that the following warning was included on all the original scripts...
				"Enter city here...";	//-- cannot change the text w/o changing code in waMacSchool.php & each select object below
	**/
	
	function doAdminCityChange(select_id, otherCity_id, default_text) 	{

		var obj1 = self.document.getElementById(select_id);
		var obj2 = self.document.getElementById(otherCity_id);

		if (obj1 != null && obj2 != null)	{

			if (obj1.options[obj1.selectedIndex].value == 255)	{
				obj2.style.visibility = 'visible';
				if (obj2.value == "" && default_text != null) {
					obj2.value = default_text;	//-- cannot change the text w/o changing code in waMacSchool.php & each select object below
				}
			}  else obj2.style.visibility='hidden';

		
		}
	}
	
	/** ----------------------------- adminChangeCheckbox --------------------------- **
		given the id of a checkbox object, this routine will fetch that object, see if the
		object is checked & set the associated field accordingly
	**/
	
	function adminChangeCheckbox(checkbox_id, fld_id) 	{

		var obj1 = self.document.getElementById(checkbox_id);
		var obj2 = self.document.getElementById(fld_id);

		if (obj1 != null && obj2 != null)	{
			obj2.value = (obj1.checked) ? '1' : '0';
		}
	}	



	
/*	******************************* student filter routines *************************
	These routine manipulate the stufilter buttons.
	ASSUMES a few things
		1. the existence of a php variable named "stufiltertypes" which is a string representing the following:
			[0]		students by class
			[1]		students by grade
			[2]		students by schoolcode
			[3]		students by xgroup

		2. based on the state of stufiltertypes above, btns with the following ids:
			classbtn, gradebtn, schoolbtn, xgroupsbtn
		
		3. a select object corresponding with each btn named as follows:
			classes, grades, schools, xgroups
		
		4. as always, a form named form1
		
		5. the following hidden input fields for us to set:
			stufilter, filterby_class, filterby_grade, filterby_school, filterby_xgroup
	
	**Note this routine works equally well if the btns are radios btns (php $isAnd == false)
		or checkboxes (php $isAnd == true)
			
*/
	
	
	/** ----------------------------- changeStuFilter --------------------------- **
		This routine wil change the filter based on the state of the various filter checkboxes
	**/

	function changeStuFilter()	{
		//import fetchOneMultiSelect;		//-- declared in utils.js

		var a = new Array ("0","0","0","0");	
		var f = self.document.form1;

		var stufiltertypes = f.stufiltertypes.value;
		
		if (stufiltertypes.lenth < 4) {
			alert("Debugging Error:  Don't seem to have the php variable \"stufiltertypes\"");
			return;
		}
		
		if (stufiltertypes[0] && self.document.getElementById("classbtn").checked)	{
			a[0] = "1";
			if (!f.classes.options[0].selected)	{
				f.filterby_class.value = fetchOneMultiSelect(f.classes);
			} else {
				f.filterby_class.value = "0";
			}
		}

		if (stufiltertypes[1] && self.document.getElementById("gradebtn").checked)	{
			a[1] = "1";
			if (!f.grades.options[0].selected)	{
				f.filterby_grade.value = fetchOneMultiSelect(f.grades);
			} else {
				f.filterby_grade.value = "0";
			}
		}

		if (stufiltertypes[2] && self.document.getElementById("schoolbtn").checked)	{
			a[2] = "1";
			if (!f.schools.options[0].selected)	{
				f.filterby_school.value = fetchOneMultiSelect(f.schools);
			} else {
				f.filterby_school.value = "0";
			}
		}

		if (stufiltertypes[3] && self.document.getElementById("xgroupsbtn").checked)	{
			a[3] = "1";
			if (!f.xgroups.options[0].selected)	{
				f.filterby_xgroup.value = fetchOneMultiSelect(f.xgroups);
			} else {
				f.filterby_xgroup.value = "0";
			}
		}


		f.stufilter.value = a.join("");

		doReload();
	}		


	/** ----------------------------- changeStuFilterRadioBtns --------------------------- **
		The radio buttons that enable or disable the class, grade & school select boxes are linked.
		Each time the radio button is changed, this routine is called.
		We need to  handle enabling and disabling here only.  The rest is handled in the changeStuFilter routine
	**/

	function changeStuFilterRadioBtns()	{
		var f = self.document.form1;

		if (self.document.getElementById("classbtn").checked)	{
			f.classes.disabled = false;
			f.grades.disabled = true;
			f.schools.disabled = true;
			f.xgroups.disabled = true;
		} else if (self.document.getElementById("gradebtn").checked) {
			f.classes.disabled = true;
			f.grades.disabled = false;
			f.schools.disabled = true;
			f.xgroups.disabled = true;
		} else if (self.document.getElementById("schoolbtn").checked) {
			f.classes.disabled = true;
			f.grades.disabled = true;
			f.schools.disabled = false;
			f.xgroups.disabled = true;
		} else if (self.document.getElementById("xgroupsbtn").checked) {
			f.classes.disabled = true;
			f.grades.disabled = true;
			f.schools.disabled = true;
			f.xgroups.disabled = false;
		}

		changeStuFilter();

	}	//-- changeStuFilterRadioBtns	

	
	/** ----------------------------- changeStuUseFiltersBtns --------------------------- **
		This routine merely turns the global "showfilters" variable on or off to display or hide the filter table
		**Note this routine be used for any list page that has a showfilters hidden object
	**/

	function changeStuUseFiltersBtns(how)	{
		var f = self.document.form1;

		f.stu_showfilters.value = (how == 'on') ? '1' : '0';
		doReload();


	}	//-- changeStuUseFiltersBtns	




/*	******************************* family filter routines *************************
	These routine manipulate the fam_stdfilter buttons.
	ASSUMES a few things
		1. the existence of a php variable named "fam_stdfiltertypes" which is a string representing the following:
			[0]		families of students by class
			[1]		families of students by grade
			[2]		families of students by schoolcode
			[3]		families of students by xgroup

		2. based on the state of fam_stdfiltertypes above, btns with the following ids:
			classbtn, gradebtn, schoolbtn, xgroupsbtn
		
		3. a select object corresponding with each btn named as follows:
			classes, grades, schools, xgroups
		
		4. as always, a form named form1
		
		5. the following hidden input fields for us to set:
			fam_stdfilter, filterby_class, filterby_grade, filterby_school, filterby_xgroup
	
	**Note this routine works equally well if the btns are radios btns (php $isAnd == false)
		or checkboxes (php $isAnd == true)
			
*/
	



/*	******************************* class filter routines *************************
	These routine manipulate the stufilter buttons.
	ASSUMES a few things
		1. the existence of a php variable named "classfiltertypes" which is a string representing the following:
			[0]		classes by schoolcode
			[1]		classes by tcode
			[2]		classes by block

		2. based on the state of classfiltertypes above, btns with the following ids:
			schoolbtn, tcodebtn, blockbtn
		
		3. a select object corresponding with each btn named as follows:
			schools, tcodes, blocks
		
		4. as always, a form named form1
		
		5. the following hidden input fields for us to set:
			classfilter, filterby_school, filterby_tcode, filterby_block
	
	**Note this routine works equally well if the btns are radios btns (php $isAnd == false)
		or checkboxes (php $isAnd == true)
			
*/
	
	
	/** ----------------------------- changeClassFilter --------------------------- **
		This routine wil change the filter based on the state of the various filter checkboxes
	**/

	function changeClassFilter()	{


		var a = new Array ("0","0","0","0");	
		var f = self.document.form1;

		var classfiltertypes = f.classfiltertypes.value;
		
		if (classfiltertypes.length < 3) {
			alert("Debugging Error:  Don't seem to have the php variable \"classfiltertypes\"");
			return;
		}
		
		if (classfiltertypes[0] && self.document.getElementById("schoolbtn").checked)	{
			a[0] = "1";
			if (!f.schools.options[0].selected)	{
				f.filterby_school.value = fetchOneMultiSelect(f.schools);
			} else {
				f.filterby_school.value = "0";
			}
		}

		if (classfiltertypes[1] && self.document.getElementById("tcodebtn").checked)	{
			a[1] = "1";
			if (!f.tcodes.options[0].selected)	{
				f.filterby_tcode.value = fetchOneMultiSelect(f.tcodes);
			} else {
				f.filterby_tcode.value = "0";
			}
		}

		if (classfiltertypes[2] && self.document.getElementById("blockbtn").checked)	{
			a[2] = "1";
			if (!f.blocks.options[0].selected)	{
				f.filterby_block.value = fetchOneMultiSelect(f.blocks);
			} else {
				f.filterby_block.value = "0";
			}
		}


		f.classfilter.value = a.join("");

		doReload();
	}		



	/** ----------------------------- changeClassFilterRadioBtns --------------------------- **
		The radio buttons that enable or disable the school, tcode & block select boxes are linked.
		Each time the radio button is changed, this routine is called.
		We need to  handle enabling and disabling here only.  The rest is handled in the changeClassFilter routine
	**/

	function changeClassFilterRadioBtns()	{
		var f = self.document.form1;

		if (self.document.getElementById("schoolbtn").checked)	{
			f.schools.disabled = false;
			f.tcodes.disabled = true;
			f.blocks.disabled = true;
		} else if (self.document.getElementById("tcodebtn").checked) {
			f.schools.disabled = true;
			f.tcodes.disabled = false;
			f.blocks.disabled = true;
		} else if (self.document.getElementById("blockbtn").checked) {
			f.schools.disabled = true;
			f.tcodes.disabled = true;
			f.blocks.disabled = false;
			if (f.filterby_block.value == "") f.filterby_block.value = "0";
		}

		changeClassFilter();

	}	//-- changeClassFilterRadioBtns
	



	/** ----------------------------- changeClassUseFiltersBtns --------------------------- **
		This routine merely turns the global "showfilters" variable on or off to display or hide the filter table
		**Note this routine be used for any list page that has a showfilters hidden object
	**/

	function changeClassUseFiltersBtns(how)	{
		var f = self.document.form1;

		f.class_showfilters.value = (how == 'on') ? '1' : '0';
		doReload();


	}	//-- changeClassUseFiltersBtns
	

/*	******************************* teacher filter routines *************************
	These routine manipulate the teachfilter buttons.
	ASSUMES a few things
		1. the existence of a php variable named "teachfiltertypes" which is a string representing the following:
			[0]		teachers by schoolcode
			[1]		teachers by class

		2. based on the state of teachfiltertypes above, btns with the following ids:
			schoolbtn, tcodebtn, blockbtn
		
		3. a select object corresponding with each btn named as follows:
			schools, tcodes, blocks
		
		4. as always, a form named form1
		
		5. the following hidden input fields for us to set:
			teachfilter, filterby_school, filterby_class
	
	**Note this routine works equally well if the btns are radios btns (php $isAnd == false)
		or checkboxes (php $isAnd == true)
			
*/
	
	
	/** ----------------------------- changeTeachFilter --------------------------- **
		This routine wil change the filter based on the state of the various filter checkboxes
	**/

	function changeTeachFilter()	{


		var a = new Array ("0","0","0","0");	
		var f = self.document.form1;

		var teachfiltertypes = f.teachfiltertypes.value;
		
		if (teachfiltertypes.lenth < 3) {
			alert("Debugging Error:  Don't seem to have the php variable \"teachfiltertypes\"");
			return;
		}
		
		if (teachfiltertypes[0] && self.document.getElementById("schoolbtn").checked)	{
			a[0] = "1";
			if (!f.schools.options[0].selected)	{
				f.filterby_school.value = fetchOneMultiSelect(f.schools);
			} else {
				f.filterby_school.value = "0";
			}
		}

		if (teachfiltertypes[1] && self.document.getElementById("classbtn").checked)	{
			a[1] = "1";
			if (!f.classes.options[0].selected)	{
				f.filterby_class.value = fetchOneMultiSelect(f.classes);
			} else {
				f.filterby_class.value = "0";
			}
		}




		f.teachfilter.value = a.join("");

		doReload();
	}		



	/** ----------------------------- changeTeachFilterRadioBtns --------------------------- **
		The radio buttons that enable or disable the school, tcode & block select boxes are linked.
		Each time the radio button is changed, this routine is called.
		We need to  handle enabling and disabling here only.  The rest is handled in the changeTeachFilter routine
	**/

	function changeTeachFilterRadioBtns()	{
		var f = self.document.form1;

		if (self.document.getElementById("schoolbtn").checked)	{
			f.schools.disabled = false;
			f.classes.disabled = true;
		} else if (self.document.getElementById("classbtn").checked) {
			f.schools.disabled = true;
			f.classes.disabled = false;
		}

		changeTeachFilter();

	}	//-- changeTeachFilterRadioBtns
	



	/** ----------------------------- changeTeachUseFiltersBtns --------------------------- **
		This routine merely turns the global "showfilters" variable on or off to display or hide the filter table
		**Note this routine be used for any list page that has a showfilters hidden object
	**/

	function changeTeachUseFiltersBtns(how)	{
		var f = self.document.form1;

		f.teach_showfilters.value = (how == 'on') ? '1' : '0';
		doReload();


	}	//-- changeTeachUseFiltersBtns




	/** ----------------------------- admin_makeGoBackCookieStr --------------------------- **
		makes a goback string.
		The format is [title]path
	**/

	function admin_makeGoBackCookieStr(title, path)  {
		return ("[" + title + "]" +  path);
	}

	/** ----------------------------- admin_getGoBackCookieStrArray --------------------------- **
		given a goback cookie string, parses it's parts * returns them as an array object
			[0]-> title
			[1]-> path
	**/

	function admin_getGoBackCookieStrArray(str)  {
		var a = new Array("","");	//-- default to an empty array
		var start = 0;
		var end = 0;
		
		if (str != null && str.length > 0)	{
			start = str.indexOf("[");
			if ((start != -1) && (start++ < str.length))	{
				end = str.indexOf("]");
				if (end != -1)	{
					a[0] = str.substring(start,end);
					start = end + 1;
					if (start < str.length) a[1] = str.substring(start,str.length);
				}
			}
		}
		return a;
	}


	/** ----------------------------- admin_makeGoBackCookie --------------------------- **
		makes our "goback" cookie for leaving a crumb trail of the user's activity.
		The format is [title]path,[title]path, etc.
	**/

	function admin_makeGoBackCookie()  {
		makeCookie("goback", "[Home]/admin/pages/home.php", 12, "/", "wacad.edu", false);
	}


	/** ----------------------------- admin_setGoBackCookie --------------------------- **
		sets our "goback" cookie to the supplied [title]path string
		erases whatever might have been the value prior to the call.
		The format is [title]path,

	**/

	function admin_setGoBackCookie(title, path)  {
		var str = admin_makeGoBackCookieStr(title, path);
		setCookie("goback", str, "/", "wacad.edu");
	}
	

	/** ----------------------------- admin_getGoBackCookieStr --------------------------- **
		gets the entire content of our "goback" cookie as a string
		The format is [title]path,[title]path, etc.

	**/

	function admin_getGoBackCookieStr()  {
		return getCookie("goback");
	}	
	
	/** ----------------------------- admin_getGoBackCookieArray --------------------------- **
		gets the entire content of our "goback" cookie as a javascript array object
	**/

	function admin_getGoBackCookieArray()  {
		return getCookieArray("goback");
	}	

	/** ----------------------------- admin_pushGoBackCookie --------------------------- **
		adds an indice onto the end of the goback cookie
	**/

	function admin_pushGoBackCookie(title, path)  {
		var str = admin_makeGoBackCookieStr(title, path);
		pushCookie("goback", str, "/", "wacad.edu");
	}	

	/** ----------------------------- admin_pushGoBackCookieQuery --------------------------- **
		adds an indice onto the end of the goback cookie with a query attached.  Don't supply the '?'
	**/

	function admin_pushGoBackCookieQuery(title, path, query)  {
		var str = admin_makeGoBackCookieStr(title, path + "?" + query);
		pushCookie("goback", str, "/", "wacad.edu");
	}	


	/** ----------------------------- admin_popGoBackCookie --------------------------- **
		pops the last indice off of the goback cookie & returns it as an array
	**/

	function admin_popGoBackCookie()  {
		var str = popCookie("goback", "/", "wacad.edu");
		return admin_getGoBackCookieStrArray(str);
	}	
	

	/** ----------------------------- admin_goback --------------------------- **
		This routine merely turns the global "showfilters" variable on or off to display or hide the filter table
	**/

	function admin_goback()	{
		var a = admin_popGoBackCookie();
		if (a[1].length > 0)	{
			self.document.location=a[1];
		} else self.document.location=history.back();
	}

	/** ----------------------------- admin_get_gobackTitle --------------------------- **
		This routine will fetch the title of the last page visited without actually popping the indice off the cookie
	**/

	function admin_get_gobackTitle()	{
		var a = admin_getGoBackCookieArray();
		var str = "Go Back";
		
		if (a.length > 0)	{
			var x = a.length-1;
			var b = admin_getGoBackCookieStrArray(a[x]);
			str = b[0];
		}
		
		return str;
	}

	/** ----------------------------- admin_goback_page --------------------------- **
		This routine will go to a particular page in the goback trail.
		EXPECTS "i" to be the zero-based indice of the goback cookie array to go back to
		All cookies after that indice will be eliminated from the array
	**/

	function admin_goback_page(i)	{
		var a = admin_getGoBackCookieArray();
		
		
		if (a.length > 0 && i < a.length)	{
			var top = i + 1;		//-- slice will start slicing from the next indice up, so add one to our indice we want to preserve 
			if (top > a.length) top=a.length;		
			a = a.slice(0,top);
			var str = "";

			for (x=0; x< a.length; x++)	{
				str += a[x];
				if (x != (a.length-1)) str += ","
			}//-- for

				//-- reset the cookie with the page we want on top
			setCookie("goback", str, "/", "wacad.edu");

				//-- and pop our page & return to it
			admin_goback();
			
		}
		
	}

	/** ----------------------------- admin_verify_goback_cookie --------------------------- **
		This routine will index through the goback array & look for the page that we're currently on.
		If it finds it, it will trim that page and everything after it from the goback cookie.
		
		This is necessary to verify our list against the current page.  This can happen if the user uses the "back" button
		OR the history to navigate rather than our list.  Basically this routine will find the current page in the list.  If it is there
		it pops everthing from that indice (including the current page) from the list and resets the cookie
	**/

	function admin_verify_goback_cookie()	{
		var a = admin_getGoBackCookieArray();
		
		for (x in a)	{
			var b = admin_getGoBackCookieStrArray(a[x]);
			if(b[1] == self.location.pathname)	{
				a = a.slice(0,x);		//-- x will refer to us which means 'slice' will take us & everything behind us off the top and leave the rest
				break;		//-- break the for loop
			}	//-- if
		}	//-- for

		var str = "";
		for (i=0; i< a.length; i++)	{
			str += a[i];
			if (i != (a.length-1)) str += ",";
		}//-- for
		setCookie("goback", str, "/", "wacad.edu");

		
	}

	/** ----------------------------- admin_get_gobackTrailHTML --------------------------- **
		This routine will return a string of text suitable for printing into the local document representing
		a "goback" trail, a collection of <a> tags of the various pages in the current goback cookie
	**/

	function admin_get_gobackTrailHTML()	{
		var a = admin_getGoBackCookieArray();
		var str;
		var s = "";
		
		if (a.length > 0)	{
			var first = true;
			for (x in a)	{
				var b = admin_getGoBackCookieStrArray(a[x]);
				if (!first) s += " | ";
				s += "<a class=goback href=\"javascript:admin_goback_page(" + x + ")\">" + b[0] + "</a>";
				first = false;
			}

		}
		return s;
	}


	/** ----------------------------- admin_get_gobackHTML --------------------------- **
		This routine will return a string of text suitable for printing into the local document representing
		a "goback" trail, a collection of <a> tags of the various pages in the current goback cookie
	**/

	function admin_get_gobackHTML(ggrfs, color)	{
		
		admin_verify_goback_cookie();		//-- make sure that our list is pristine (see notes at the function)
		
		var str;
		var a = admin_getGoBackCookieArray();		
		if (a.length > 0)	{
			if (color == 'blue')	{
				var up = 'backUpBlue.jpeg';
				var dwn = 'backDwnBlue.jpeg';
			} else if (color == 'grey')	{
				var up = 'backUpGrey.jpeg';
				var dwn = 'backDwnGrey.jpeg';
			} else if (color == 'none')	{
				var up = 'backUp.gif';
				var dwn = 'backDwn.gif';
			} else if (color == 'gold')	{
				var up = 'images/breadcrumbArrowUpGold.gif';
				var dwn = 'images/breadcrumbArrowDwnGold.gif';
			} 
			
			if (color == 'gold')	{
				str = "<table class=\"goback\" border=\"0\"><tr><td id=\"breadcrumb\" class=\"tright tmid\">";
				str += admin_get_gobackTrailHTML();
				str += "</td><td class=\"tleft tmid\" width=\"36px\">";
				str += "<img class=\"breadcrumb\" src=\"" + ggrfs + up + "\" border=0 onMouseOver=\"swapImage('" + ggrfs + "', this, '" + dwn + "');\"  onMouseOut=\"swapImage('" + ggrfs + "', this, '" + up + "');\" onClick=\"javascript:admin_goback();\" >";
				str += "</td></tr></table>";
			} else {
				str = "<table class=goback border=0><tr><td class=\"tright tmid\">";
				str += admin_get_gobackTrailHTML();
				str += "</td><td class=\"tleft tmid\">";
				str += "<img  class=goback src=\"" + ggrfs + up + "\" border=0 onMouseDown=\"swapImage('" + ggrfs + "', this, '" + dwn + "');\"  onMouseUp=\"swapImage('" + ggrfs + "', this, '" + up + "');\" onClick=\"javascript:admin_goback();\" >";
				str += "</td></tr></table>";
			}
			
			
		} else {
			str = "&nbsp;";
		}
		return str;
	}
	
		

	/** ----------------------------- admin_check_menuclick --------------------------- **
		This routine checks the referrer of the current document to see if it is /admin/pages/menu.php
		If it is, it will reset the goback trail to empty.
		**Note that we actually CALL this below, which means it will be set anytime a routine that calls
		admin.js is loaded
	**/

	function admin_check_menuclick()	{

		var str = document.referrer;
		if (str.length > 0)	{
			off = str.indexOf("/admin/pages/menu.php");
			if (off != -1)	{
				setCookie("goback", "", "/", "wacad.edu");
			}
		}
	}
	
	admin_check_menuclick();



	/** ----------------------------- admin_get_popmsgHTML --------------------------- **
		This routine will return the html code necessary to include a popMsg image.
		**Note you will also have to declare a popMsg div in your html code with the text & give it the id sent in here
	**/

	function admin_get_popmsgHTML(ggrfs, popid)	{

		var obj = self.document.getElementById(popid);	//-- get the div object
		if (obj != null) {
			var str = "<img class='popImg' id = " + popid + "_img src=\"" + ggrfs + "transparent.gif\"  onMouseOver = \"showHiddenPopMsg('" + popid + "', event, 'topleft');\" onMouseOut = \"hideHidden('" + popid + "');\"\>";
		} else var str = "";		
		return str;
	}

	/** ----------------------------- admin_get_popmsgHTML_marginleft --------------------------- **
		Exactly the same as admin_get_popmsgHTML, but allows you to set a left margin
	**/

	function admin_get_popmsgHTML_marginleft(ggrfs, popid, margin)	{

		var obj = self.document.getElementById(popid);	//-- get the div object
		if (obj != null) {
			var str = "<img style=\"margin-left:" + margin + ";\" class='popImg' id = " + popid + "_img src=\"" + ggrfs + "transparent.gif\"  onMouseOver = \"showHiddenPopMsg('" + popid + "', event, 'topleft');\" onMouseOut = \"hideHidden('" + popid + "');\"\>";
		} else var str = "";		
		return str;
	}

	/** ----------------------------- admin_get_popmsgHTML_auto --------------------------- **
		Exactly the same as admin_get_popmsgHTML_marginleft, but calls showHiddenPopMsg with the "auto" 'how' param
	**/

	function admin_get_popmsgHTML_auto(ggrfs, popid, margin_left)	{

		var obj = self.document.getElementById(popid);	//-- get the div object
		if (obj != null) {
			var str = "<img style=\"margin-left:" + margin_left + ";\" class='popImg' id = " + popid + "_img src=\"" + ggrfs + "transparent.gif\"  onMouseOver = \"showHiddenPopMsg('" + popid + "', event, 'auto');\" onMouseOut = \"hideHidden('" + popid + "');\"\>";
		} else var str = "";		
		return str;
	}
	
	/** ----------------------------- showHiddenPopMsg --------------------------- **
		show a popMsg div and set the position based on the current position of th emouse and the 'how' param
		
			'how' 		should be topleft, topright, botleft or botright depending on where you want the popMsg shown
			'event' 	will be the mouseOver event, and you just use 'event' in your param when you send it from the mouseOver handler
			'whichID' 	should be the id of the popMsg div
			
			To make this work, you must declare a style attribute in your DIV tag and hardwire the width & height there in pixels.
			
	*/
	function showHiddenPopMsg(whichID, event, how)	{
	
		var topleft_buf = 30;		//-- buffer for subtracting seems to need to be larger than buffer for adding pixels
		var buf=18;
		
		var obj = self.document.getElementById(whichID);	//-- get the div object
		x = event.clientX;			//-- get the mouse.horizontal
		y = event.clientY;			//-- get the mouse.verticle

		ww = obj.style.width;		//-- get the width of the div (must be declared inline in the HTML tag)
		hh = obj.style.height;		//-- get the height of the div (must be declared inline in the HTML tag)
	
			//-- now strip the 'px' on the end of the style width & height
		off = ww.indexOf('px');
		if (off != -1) ww = ww.substring(0,off);
		off = hh.indexOf('px');
		if (off != -1) hh = hh.substring(0,off);

			//-- turn the strings into numbers
		nw = new Number(ww);
		nh = new Number(hh);

		var sw = document.body.scrollLeft;
		var sh = document.body.scrollTop;

		var ow = window.innerWidth;
		var oh = window.innerHeight;

		if (how == 'auto') 	{
			var hfactor = 'left';	//-- default
			var vfactor = 'top';
			
			if (nw > x)	{
				if ((ow-x) > nw) hfactor = 'right';
			}
		
			if (nh > y)	{		
				if ((oh-y) > nh) vfactor = 'bot';
			}
			how = vfactor + hfactor;
		
		} else if (how == 'topleft' || how == 'botleft') {
			if (nw > x && ((ow-x) > nw)) {
				how = (how=='topleft') ? 'topright' : 'botright';
			}
		} else if (how == 'topright' || how == 'botright')	{
			if (((ow-x) < nw && nw < x)) {
				how = (how=='topright') ? 'topleft' : 'botleft';
			}
		
		}

			//-- calculate the left & right of our object based on the supplied 'how' param		
		if (how == 'topleft')	{
			offx = x - (nw + topleft_buf);
			offy = y - (nh + topleft_buf);
		} else if (how == 'botleft')	{
			offx = x - (nw + topleft_buf);
			offy = y + buf;
		} else if (how == 'topright')	{
			offx = x + buf;
			offy = y - (nh + topleft_buf);
		} else if (how == 'botright')	{
			offx = x + buf;
			offy = y + buf;
		}

offx += document.body.scrollLeft;
offy += document.body.scrollTop;


			//-- finally set the left & top attributes of the object		
		obj.style.left = offx;
		obj.style.top = offy;
		
		obj.style.visibility = "visible";

	}

	/** ----------------------------- admin_showhints --------------------------- **
		simply reloads the page with the proc set to "showhints"
	**/

	function admin_showhints ()	{
		var obj = self.document.getElementById("showhints");			//-- get hidden object
		var objcheck = self.document.getElementById("showhints_box");	//-- get the checkbox object

		obj.value = (objcheck.checked) ? '1' : '0';
		doReload();
	}


	
	
