/* DOM check v1.0
 * Confirms that the browser is capable of utilizing most SI_functions
 * and hides unnecessary elements from these browsers. Apply the .non-dom class
 * to any element that is made redundant due to scripting. 
 * ie. go buttons next to select menus with onchange event handlers
 */
if (SI_dom()) { document.write('<style type="text/css">.non-dom { position: absolute !important; top: 0 !important; left: -3000px !important; }<'+'/style>\n'); }

/* SI_dom() v1.0
 * Confirms that the browser is capable of 
 * getElementById and getElementsByTagName
 */
function SI_dom() { return new Boolean(document.getElementById && document.getElementsByTagName); };

/* SI_submitForm() v1.1 */
function SI_submitForm(f) {
	if (!SI_dom()) return true;
	f.submit();
	}

/* SI_windowOpen() v1.0
 * Accessible pop-up windows that load the href in the current window
 * if JavaScript is disabled. 
 */
var SI_openWindow = new Object();
function SI_windowOpen(elem,center,w,h,opt) {
	if (!SI_dom()) return true;
	
	var src	= elem.href;
	var wnm	= (elem.target=='')?'SI_schoolSuite':((elem.target.indexOf('_')==0)?'SI'+elem.target:elem.target);
	var opt = (opt=='')?',scrollbars=yes,resizable=yes':((opt.indexOf(',')!=0)?','+opt:opt);
	var ctr	= (center)?',left='+((screen.availWidth-w)/2)+',top='+((screen.availHeight-h)/2):'';
	
	// A window has already been opened
	if (!SI_openWindow.closed && SI_openWindow.name==wnm && SI_openWindow.location) {
		SI_openWindow.location = src;
		}
	else {
		SI_openWindow = window.open(src,wnm,'width='+w+',height='+h+ctr+opt);
		if (!SI_openWindow.opener) SI_openWindow.opener = self;
		}
	if (window.focus) SI_openWindow.focus();
	return false;
	};

/* SI_clearFooter() v1.4
 * Use this function when absolutely positioning section navigation, 
 * primarary and secondary content and the footer falls below any one
 * of them. Absolute positioning avoids the unwanted wrapping that
 * sometimes occurs in IE PC when floats are used for layout.
 * 
 * - v1.4	: Adds ability to stack inline content before the absolutley positioned content
 */
var SI_footer=new Object();
/* Configuration Defaults */
SI_footer.clear			= false;
SI_footer.container		= 'content';	// id of the inner container div
SI_footer.ignore		= 'xxx';	// id of the inline contents of the inner container div
SI_footer.minHeight		= 410;	// Minimum page height in pixels
SI_footer.extendShallow = true;	// Extends shallow children so that repeating backgrounds 
								// will repeat all the way to the footer
SI_footer.bottomOut		= true;	// Whether the footer should just clear the contents of the 
								// inner-container div or snap to the bottom of the window 
								// when content is too short
function SI_clearFooter() {
	var d = document,w=window,dE=d.documentElement,dB=d.body,h;
	if (!SI_footer.clear || !d.getElementById || !dB.offsetHeight) return;
	
	var ic = d.getElementById(SI_footer.container); // The inner container div
	if (!ic) return; // Added 4.08.23
	ic.style.height = '0';		// Resets the height
	var oh = [];		// Holds the offset heights of each child div
	var icTop = ic.offsetTop;
	var winHeight	= (typeof(w.innerHeight)=='number')?w.innerHeight:(dE&&dE.clientHeight)?dE.clientHeight:(dB&&dB.clientHeight)?dB.clientHeight:0;
	var footHeight	= d.getElementById('footer').offsetHeight;
	oh[0] = SI_footer.minHeight-icTop-footHeight;	// Minimum height of the inner-container div

	// Make an array of the rendered heights of the contained elements
	for (var i=0;i<ic.childNodes.length;i++) {
		c = ic.childNodes[i];
		if (c.nodeName=='DIV') {
			if (c.id=='inner-content') {
				c.style.height = SI_getContainedHeight(c)+'px';
				oh[oh.length] = c.offsetHeight+c.offsetTop;
				}
			else if (c.id==SI_footer.ignore) { continue; }
			else {
				c.style.height = 'auto';
				oh[oh.length] = c.offsetHeight+c.offsetTop;
				}
			}
		}
	// Determine the max height
	h = 0; for (var k=0;k<oh.length;k++) { h = (oh[k]>h)?oh[k]:h;}
	// Force footer to the bottom of the window 
	if (SI_footer.bottomOut) { h = ((icTop+h+footHeight) < winHeight)?winHeight-footHeight-icTop:h; }
	// Extend shorter elements
	if (SI_footer.extendShallow) { 
		for (var i=0;i<ic.childNodes.length;i++) { 
			var c = ic.childNodes[i]; 
			if (c.nodeName=='DIV' && c.id!=SI_footer.ignore) { 
				c.style.height = (h-c.offsetTop)+'px'; 
				}
			}
		}
	ic.style.height = h+'px';
	};

function SI_getContainedHeight(e) {
	var oh = [];
	for (var i=0;i<e.childNodes.length;i++) { var c = e.childNodes[i]; if (c.nodeName=='DIV') { c.style.height = 'auto'; oh[oh.length] = c.offsetHeight+c.offsetTop; }}
	// Determine the max height
	var h = 0; for (var k=0;k<oh.length;k++) { h = (oh[k]>h)?oh[k]:h; }
	// alert(h);
	return h;
	}

/* SI_menu() v2.0
 * 
 * Holds IE's hand through what can be accomplished using only
 * CSS in other modern browsers. That's right, I said "modern."
 * In a medium that moves as fast the internet you didn't really
 * consider a 4 year old browser like IE modern did you? :P
 * 
 * Includes nodeName clarification which corrects
 * potential problems in IE 5.x (both platforms)
 * 
 * Now correctly applies the hover className to the li and not the link.
 * Removed RegExp from onmouseout by precaching the class names which speeds 
 * up the script phenomenally.
 */
function SI_menu() {
	var d = document;
	var isSafari 	= (navigator.userAgent.indexOf('Safari') != -1);
	var isIE 		= (navigator.appName == "Microsoft Internet Explorer");
	var isWinIE		= (isIE && window.print);
	
	/* Safari doesn't need any help...
	 * Gecko needs a little help remembering which parent elements are currently :hover
	 * I have no idea what to do with Opera...
	 * IE needs the most help...
	 */
	if (!SI_dom() || window.opera || isSafari || !d.getElementById) return;
	
	var m=SI_menu.arguments;

	for(i=0; i<m.length; i++) {
		if (!d.getElementById(m[i])) continue; // Added 4.08.23
		for (var l=0; (lnk=d.getElementById(m[i]).getElementsByTagName("a")[l]); l++) {
			// If there are any nested menus...
			if (lnk.parentNode.childNodes.length > 1) {
				li = lnk.parentNode; // The containing <li>
				for (var n=0; n < li.childNodes.length; n++) {
					node = li.childNodes[n];
					if (node.nodeName=="UL") {
						li.ul = node; // The sibling <ul> (submenu)
						delete node;
						
						li.classDefault		= li.className;
						li.classHover		= li.className+((li.className=='')?'hover':' hover');
						
						li.isIE				= isIE;
						li.isWinIE			= isWinIE;
						li.onmouseover		= SI_showMenu;
						li.onmouseout		= SI_hideMenu;
						}
					}
				}
			}
		}
	}
function SI_showMenu() {
	// SI_debug();
	this.className = this.classHover;
	if (this.isIE) {
		this.style.zIndex = 100;
		if (this.isWinIE) SI_toggleSelects('hidden'); 
		}
	}
function SI_hideMenu() {
	this.className = this.classDefault;
	if (this.isIE) {
		this.style.zIndex = 1;
		if (this.isWinIE) SI_toggleSelects('visible'); 
		}
	}
function SI_toggleSelects(state) {
	var d = document;
	for (var i=0; (sel=d.getElementsByTagName('select')[i]); i++) {
		sel.style.visibility = state;
		}
	}
/* SI_debug() v2.0
 * Sets the onmouseover event for all elements to display the 
 * current element's ancestor tree in the window status bar.
 */
function SI_debug() {
	var d = document;
	if (!d.getElementsByTagName) return;
	
	var all = (d.all)?d.all:d.getElementsByTagName('*');
	for (i=0; i<all.length;i++) {
		//var oldmouseover = (all[i].onmouseover)?all[i].onmouseover:function(){};
		all[i].onmouseover = function(e) {
			//oldmouseover();
			if (!e) var e = window.event;
			var status = '';
			var done = false;
			var ths = this;
			while (!done) {
				status = ths.nodeName.toLowerCase()+((ths.className!='')?'.'+ths.className.replace(/ /g,'.'):'')+((ths.id!='')?'#'+ths.id:'')+((status!='')?' > ':'')+status;
				done = (ths.nodeName=='HTML')?true:false;
				if (!done) ths=ths.parentNode;
				}
			
			this.status = status;
			window.status = ((this.status.length>128)?'...':'')+this.status.substr(this.status.length-124);
			e.cancelBubble = true;
			e.returnValue = false;
			if (e.stopPropagation) e.stopPropagation();
			return true;
			}
		}
	}

/* SI_initializeTabs()/SI_activateTab() v1.0
 * Accessible content tabbing that requires only one hit to the server
 * and degrades to simple HTML anchors when JavaScript is disabled.
 * Need to add: Support for multiple classes on ul.tabs li
 *
 * Changing `className` instead of `style.display` would allow for more 
 * control when dealing with print stylesheets.
 *
 * Added first/last child logic - Corbin_060208
 */
var SI_tabs=new Object();
function SI_initializeTabs() {
	for (var tab in SI_tabs) { 
		SI_activateTab(tab,SI_tabs[tab].active);
		}
	}
function SI_activateTab(tabGroup,activeTab) {
	var d = document;
	if (!d.getElementById) return;
	
	for (i=0; i<SI_tabs[tabGroup].tabs.length; i++) {
		//alert('tab-'+tabGroup+'-'+SI_tabs[tabGroup].tabs[i])
		tab = 'tab-'+tabGroup+'-'+SI_tabs[tabGroup].tabs[i];
		d.getElementById(tab).className = '';
		d.getElementById(tabGroup+'-'+SI_tabs[tabGroup].tabs[i]).style.display = 'none';
		}
	d.getElementById(tabGroup+'-'+activeTab).style.display = 'block';
	d.getElementById('tab-'+tabGroup+'-'+activeTab).className = 'active';
	
	// Redraw the footer...
	SI_clearFooter();
	};

/* SI_initializeGroups()/SI_toggleGroups() v1.0
 * 
 */
var SI_groups=new Object();
function SI_initializeGroups() {
	var d = document;
	if (!d.getElementById) return;
	for (var group in SI_groups) {
		d.getElementById(group+'-toggle').style.display = 'inline';
		for (i=0; i<SI_groups[group].items.length; i++) {
			anItem = SI_groups[group].items[i];
			d.getElementById(anItem+'-toggle').style.display = 'inline';
			}
		SI_groups[group].expanded = SI_groups[group].items.length;
		SI_toggleGroups(group,'',d.getElementById(group+'-toggle'));
		}
	};
function SI_toggleGroups(group,item,toggle) {
	var d = document;
	if (!d.getElementById) return;
	
	var state = (toggle.innerHTML.toLowerCase().indexOf('hide ')!=-1);
	var display = (state)?'none':'block';
	var action = (state)?'Read ':'Hide ';
	if (item!='') {
		d.getElementById(item).style.display = display;
		toggle.innerHTML = (state)?action+SI_groups[group].label:action;
		SI_groups[group].expanded = (state)?SI_groups[group].expanded-1:SI_groups[group].expanded+1;
		d.getElementById(group+'-toggle').innerHTML = (SI_groups[group].expanded == SI_groups[group].items.length)?'Hide All':'Read All';
		}
	else {
		for (i=0; i<SI_groups[group].items.length; i++) {
			item = SI_groups[group].items[i];
			d.getElementById(item+'-toggle').innerHTML = ((state)?'Read ':'Hide ')+SI_groups[group].label;
			d.getElementById(item).style.display = display;
			SI_groups[group].expanded = (state)?0:SI_groups[group].items.length;
			}
		toggle.innerHTML = action+'All';
		}
	
	// Redraw the footer...
	SI_clearFooter();
	};


/* SI_galleryRedraw() and related v1.5
 * Client-side image gallery. An array of images and a configuration
 * object need to be defined in the HTML.
 *
 * 1.4	: Moves "x 0f y" to its own unique container
 * 1.5	: Now accounts for files within an image gallery (from Altamont)
 */
var SI_gallery=new Object(); var SI_imgs=new Array(); SI_imgs[0]=null;
function SI_galleryRedraw() {
	if (!SI_dom()) return false;
	var d = document;
	var g = SI_gallery;
	
	var a = d.getElementById('SI_galleryLink');
	
	// looks like an image
	if (SI_imgs[g.imgActive][0].match(/\.(jpg|jpeg|gif|png|bmp)$/i)) {
		imgSrc  = SI_imgs[g.imgActive][1]+'thumb/'+g.imgPrefix+SI_imgs[g.imgActive][0];
		imgLnk  = '/gallery/zoom.asp?myurl='+SI_imgs[g.imgActive][1]+SI_imgs[g.imgActive][0];
		imgLnk += '&Title='+escape(SI_imgs[g.imgActive][2]);
		imgLnk += '&Content='+escape(SI_imgs[g.imgActive][3]);
		
		a.href=imgLnk;
		a.className = '';
		a.onclick=function() {
			SI_windowOpen(this,true,SI_imgs[g.imgActive][4],SI_imgs[g.imgActive][5],'scrollbars=yes,resizable=yes'); return false;
			}
		a.innerHTML = '<img src="'+imgSrc+'" id="SI_galleryImg" onload="SI_clearFooter();" alt="" />';
		}
	// must be a file
	else {
		a.href = SI_imgs[g.imgActive][1] + SI_imgs[g.imgActive][0];
		a.className = 'file '+SI_imgs[g.imgActive][0].slice(SI_imgs[g.imgActive][0].lastIndexOf('.')+1);
		a.onclick = function() { return; };
		a.innerHTML = 'Download '+SI_imgs[g.imgActive][2];
		SI_clearFooter();
		}
		
	// Update the caption, count and description
	d.getElementById('SI_galleryImgTitle').innerHTML=SI_imgs[g.imgActive][2]; //+' <span><em>'+g.imgActive+'<'+'/em> of '+g.imgTotal+'<'+'/span>';
	d.getElementById('SI_galleryImgNumOf').innerHTML='<strong>'+g.imgActive+'<'+'/strong> of '+g.imgTotal;
	// Should already be contained by a `<p>`
	d.getElementById('SI_galleryImgDesc').innerHTML=SI_imgs[g.imgActive][3];
		
	// Hide or show the previous/next buttons as appropriate
	d.getElementById('SI_galleryImgPrev').innerHTML=(g.imgActive==1)?'<em>Previous</em>':'<a href="#Previous Image" onclick="SI_galleryImgPrev(); return false;">Previous</a>';
	d.getElementById('SI_galleryImgNext').innerHTML=(g.imgActive==g.imgTotal)?'<em>Next</em>':'<a href="#Next Image" onclick="SI_galleryImgNext(); return false;">Next</a>';
	
	// Redraw with the current sets thumbnails 
	var t = d.getElementById('SI_galleryThumbs');
	t = '';
	for (i=g.setImg; i<g.setImg+g.thumbTotal;i++) {
		if (i<=g.imgTotal) {
			var html;
			// looks like an image	
			if (SI_imgs[i][0].match(/\.(jpg|jpeg|gif|png|bmp)$/i)) {
				html = '<a href="#image'+i+'" onclick="SI_galleryImgSelect('+i+'); return false;" title="'+SI_imgs[i][2]+'"><img src="'+SI_imgs[i][1]+'thumb/'+g.thumbPrefix+SI_imgs[i][0]+'" alt="'+SI_imgs[i][2]+'" border="0" /><'+'/a>';
				}
			// must be a file
			else {
				
				html = '<a href="#image'+i+'" onclick="SI_galleryImgSelect('+i+'); return false;" title="'+SI_imgs[i][2]+'" class="file '+SI_imgs[i][1]+'">'+SI_imgs[i][2]+'</a>';
				}
			
			var className = (i==g.setImg)?'first-child':((i==g.setImg+g.thumbTotal)?'last-child':'');
			if (i==g.imgActive) { className += (className=='')?'active':' active'; }
			className = (className!='')?' class="'+className+'"':'';
			
			t += '<li'+className+'>'+html+'<'+'/li>\n';
			}
		}
	d.getElementById('SI_galleryThumbs').innerHTML = t;
	
	var sets = g.setLabel; //'<strong>Set:</strong> ';
	for (i=1; i<=g.setTotal; i++) {
		if (i==g.setActive) {
			sets += '<span>'+i+'</span> ';
			}
		else {
			sets += '<a href="#Load Set '+i+'" onclick="SI_gallerySetSelect('+i+'); return false;">'+i+'<'+'/a> ';
			}
		if (i!=g.setTotal) sets += g.setDivider;
		}
	d.getElementById('SI_gallerySets').innerHTML = sets;
	}
// Displays the selected image
function SI_galleryImgSelect(imgNo) {
	if (SI_gallery.imgActive == imgNo) return;
	SI_gallery.imgActive = imgNo;
	SI_galleryRedraw();
	}
// Displays the next image
function SI_galleryImgNext() {
	var g = SI_gallery;
	if (g.imgActive<g.imgTotal) {
		g.imgActive++;
		if (g.imgActive >= g.setImg+g.thumbTotal) {
			g.setImg = g.imgActive;
			g.setActive++;
			}
		SI_galleryRedraw();
		}
	}
// Displays the previous image
function SI_galleryImgPrev() {
	var g = SI_gallery;
	if (g.imgActive>1) {
		g.imgActive--;
		if (g.imgActive < g.setImg) {
			g.setActive--;
			g.setImg = (g.setActive*g.thumbTotal)-(g.thumbTotal-1);
			}
		SI_galleryRedraw();
		}
	}
// Displays the selected set of images
function SI_gallerySetSelect(setNo) {
	var g = SI_gallery;
	g.setActive = setNo;
	g.setImg = (g.setActive*g.thumbTotal)-(g.thumbTotal-1);
	g.imgActive = g.setImg;
	SI_galleryRedraw();
	}
// Displays the previous set of images
function SI_gallerySetPrev() {
	var g = SI_gallery;
	if (g.setActive!=1) {
		g.setActive--;
		g.setImg = (g.setActive*g.thumbTotal)-(g.thumbTotal-1);
		g.imgActive = g.setImg;
		SI_galleryRedraw();
		}
	}
// Displays the next set of images
function SI_gallerySetNext() {
	var g = SI_gallery;
	if (g.setActive<g.setTotal) {
		g.setActive++;
		g.setImg = (g.setActive*g.thumbTotal)-(g.thumbTotal-1);
		g.imgActive = g.setImg;
		SI_galleryRedraw();
		}
	}

/* Gallery() Object v1.0
 * A new mini gallery object. Still finicky in IE Mac...
 */
function Gallery(imgId,titleId,captionId,prevId,nextId,imgs,loop) {
	var d = document;
	this.compatible = true;
	if (!d.getElementById || (d.all&&!window.print)) {
		this.compatible = false;
		return
		}
	this.aImg = 0;
	this.tImg = imgs.length;
	this.img = d.getElementById(imgId);
	this.title = d.getElementById(titleId);
	this.caption = d.getElementById(captionId);
	this.prevBtn = d.getElementById(prevId);
	this.nextBtn = d.getElementById(nextId);
	this.imgs = imgs;
	this.loop = loop;
	
	this.prevBtn.gallery = this;
	this.prevBtn.onclick = function () { this.gallery.prevImage(); return false; }
	this.nextBtn.gallery = this;
	this.nextBtn.onclick = function () { this.gallery.nextImage(); return false; }
	
	this.loadImage(null);
	}
Gallery.prototype.loadImage = function(i) {
	if (!this.compatible) return;
	if (i!=null) this.aImg = i-1;
	
	if (!this.loop) {
		this.prevBtn.style.display =  (this.aImg<=0)?'none':'block';
		this.nextBtn.style.display =  (this.aImg>=this.tImg-1)?'none':'block';
		}
	
	this.img.src = this.imgs[this.aImg][0];
	this.img.onload = SI_clearFooter;
	
	if (this.imgs[this.aImg][1]!= null) {
		this.title.style.display='block';
		this.title.innerHTML = this.imgs[this.aImg][1];
		}
	else { this.title.style.display='none'; }
	
	if (this.imgs[this.aImg][2]!= null) {
		this.caption.style.display='block';
		this.caption.innerHTML = this.imgs[this.aImg][2];
		}
	else { this.caption.style.display='none'; }
	
	if (this.imgs[this.aImg][3]!= null && this.img.parentNode.nodeName=="A") {
		this.img.parentNode.className = 'si-active-link';
		this.img.parentNode.onclick=this.imgs[this.aImg][3];
		}
	else {
		this.img.parentNode.className = 'si-inactive-link';
		this.img.parentNode.onclick=function() { return false; };
		}
	}
Gallery.prototype.prevImage = function() {
	if (!this.compatible) return;
	this.aImg--;
	this.aImg = (this.aImg<0)?this.tImg-1:this.aImg;
	this.loadImage(null);
	}
Gallery.prototype.nextImage = function() {
	if (!this.compatible) return;
	this.aImg++;
	this.aImg = (this.aImg>=this.tImg)?0:this.aImg;
	this.loadImage(null);
	}

// v1.2
function SI_initializeSwapImg() {
	var d = document;
	var SI_preloadImgs = new Array();
	for (i=0;img=d.images[i];i++) {	
		if (img.src.indexOf('over=')!=-1) {
			img.defaultsrc	= img.src;
			img.oversrc		= img.src.replace(/^(.+)over=/i,'');
			img.onmouseover	= function () { this.src = this.oversrc; };
			img.onmouseout	= function () { this.src = this.defaultsrc; };
			
			SI_preloadImgs[i] = new Image();
			SI_preloadImgs[i].src = img.oversrc;
			}
		}
	}

/* SI_initializeFilters()/SI_activateFilter() v1.2
 * 
 * Notes:
 * The first filter should ALWAYS BE "all"
 *
 * Now works with definition lists (dd's only) AND an 
 * unordered list when SI_filters['filterGroup'].ul 
 * is set to true
 *
 * ClassNames used in the filter cannot contain on another
 * or the filter won't work properly
 *
 * v1.2 : Now fails silently when the Filter container can't be found
 */
var SI_filters=new Object();
function SI_initializeFilters() {
	for (var filter in SI_filters) {
		SI_activateFilter(filter,SI_filters[filter].active);
		}
	}
function SI_activateFilter(filterGroup,activeFilter) {
	var d = document;
	if (!d.getElementsByTagName) return;
	
	c = (SI_filters[filterGroup].ul)?'ul':'dl';
	r = (SI_filters[filterGroup].ul)?'li':'dd';
	
	var filterContent = d.getElementById('filter-'+filterGroup);
	if (!filterContent) { return; }
	
	/* Reset everything */
	for (i=0; i<SI_filters[filterGroup].filters.length; i++) {
		var f = d.getElementById('filter-'+filterGroup+'-'+SI_filters[filterGroup].filters[i]);
		f.className = f.className.removeClass('active');
		}
	for (j=0; dl=filterContent.getElementsByTagName(c)[j]; j++) {
		dl.style.display='block';
		for (k=0;dd=dl.getElementsByTagName(r)[k]; k++) {
			dd.style.display='block';
			dd.className = dd.className.removeClass('alt','first-child','last-child');
			dd.style.marginTop='';
			}
		}
	/* Reset complete */
	
	// Activate appropriate filter tab
	var a = d.getElementById('filter-'+filterGroup+'-'+activeFilter);
	a.className = a.className.addClass('active');
	
	/* Filter away */
	for (j=0; dl=filterContent.getElementsByTagName(c)[j]; j++) {
		var allHidden = true;
		var alt = false;
		var firstChild = 0;
		var lastChild = null;
		for (k=0;dd=dl.getElementsByTagName(r)[k]; k++) {
			if (dd.className.indexOf(activeFilter)==-1 && activeFilter!='all') {
				dd.style.display='none';
				}
			else {
				firstChild++;
				lastChild = dd;
				allHidden=false;
				if (alt) {
					dd.className = dd.className.addClass('alt');
					alt=false;
					}
				else { alt=true; }
				if (firstChild==1) {
					dd.className = dd.className.addClass('first-child');
					}
				}
			}
		if (lastChild!=null && firstChild>1) {
			lastChild.className = lastChild.className.addClass('last-child');
			}
		if (allHidden) { dl.style.display='none'; }
		}
	
	if (SI_filters[filterGroup].bin) { SI_filters[filterGroup].bin.value = activeFilter; }
	
	// Redraw the footer...
	SI_clearFooter();
	}

/* SI_initializeToggles()/SI_simpleToggle() v1.0
 * A simplified version of SI_toggleGroups() for toggling unrelated elements
 */
var SI_toggles = new Array();
function SI_initializeToggles() {
	var d = document;
	if (!d.getElementById) return;
	for (var toggle in SI_toggles) {
		SI_toggles[toggle][2] = (SI_toggles[toggle][2])?0:1;
		SI_simpleToggle(toggle);
		}
	}
function SI_simpleToggle(toggle) {
	var d = document;
	if (!d.getElementById) return;
	
	var div = d.getElementById(toggle);
	var lnk = d.getElementById(toggle+'-toggle');
	var state = SI_toggles[toggle][2];
	state = (state)?0:1;
	SI_toggles[toggle][2] = state;
	
	var display		= (state)?'block':'none';
	var className	= (state)?'toggle-min':'toggle-exp';
	
	lnk.innerHTML = SI_toggles[toggle][state];
	lnk.className = className;
	div.style.display = display;
	
	// Redraw the footer...
	SI_clearFooter();
	}

/* SI_cookie v1.1 and related functions
 * Creates an object that stores the value for a year in the future and the 
 * domain the cookie should be written to
 */
var SI_cookie=new Object();
SI_cookie.domain = location.hostname.replace(/^www\./,'');
SI_cookie.year = new Date(); fixDate(SI_cookie.year); SI_cookie.year.setTime(SI_cookie.year.getTime() + 365 * 24 * 60 * 60 * 1000);
// Copyright (c) 1996-1997 Athenia Associates. http://www.webreference.com/js/ License is granted if and only if this entire copyright notice is included. By Tomer Shiran.
function setCookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; }
function getCookie(name) { var prefix = name + '='; var c = document.cookie; var nullstring = ''; var cookieStartIndex = c.indexOf(prefix); if (cookieStartIndex == -1) { return nullstring; } var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length); if (cookieEndIndex == -1) { cookieEndIndex = c.length; } return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex)); }
function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } }
function fixDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); }

/* SI_loadFontSize() v1.1
 * Loads the user's preferred font size. 
 * Requires configuration of the `SI_fontSize` object in /js/si_onload.js
 */
var SI_fontSize=new Object();
function SI_loadFontSize() {
	var c = getCookie('fontsize');
	SI_fontSize.defaultSize = (c!='')?c:SI_fontSize.defaultSize;
	// Override the default defined in the CSS with the user's preferred font-size
	document.write('<style type="text/css">#'+SI_fontSize.baseElement+' { font-size: '+SI_fontSize.defaultSize+'em; }<'+'/style>\n');
	// Create a date object and set it to one year from now
	setCookie('fontsize', SI_fontSize.defaultSize, SI_cookie.year, '/', SI_cookie.domain, '');
	};
/* SI_changeFontSize() v1.1
 * `operator` should be one of two strings, '+' or '-' to increase or decrease 
 * font-size. The determined value is stored in a cookie and used on subsequent
 * page loads.
 */
function SI_changeFontSize(operator) {
	SI_fontSize.defaultSize = eval(SI_fontSize.defaultSize + operator + SI_fontSize.difference);
	document.getElementById(SI_fontSize.baseElement).style.fontSize = SI_fontSize.defaultSize+'em';
	setCookie('fontsize', SI_fontSize.defaultSize, SI_cookie.year, '/', SI_cookie.domain, '');
	SI_clearFooter();
	};

/* SI_deHTTPSLinks() v1.5
 * Changes all https links to http
 * Used when login must be secure but browsing 
 * of protected areas need not be.
 *
 * 1.5	: Added SI_skipHTTPS array to keep specified links as https
 * 		: Only runs on pages that are already HTTPS
 */
function SI_deHTTPSLinks() {
	// If this page isn't https already then skip the entire function
	if (!document.getElementsByTagName || !(window.location.href.indexOf('https')!=-1)) { return; }
	
	// If we haven't defined any allowed HTTPS then convert all links to http
	var allow = (typeof SI_skipHTTPS != "undefined");
	var r = '';
	// Assemble the RegExp from the array of files to keep as https
	if (allow) {
		r = '(secure\.|^[^?]+('; // Must appear before the ? (query string)
		for (var j=0; j<SI_skipHTTPS.length; j++) { r += SI_skipHTTPS[j] + '|'; }
		r = r.replace(/\|$/,'') + '))'; // trim the last | and close it up
		}
	re = new RegExp(r,'gi'); // compile
	
	var a = document.getElementsByTagName('a');
	// Convert all the others to http
	for (var i=0;i<a.length;i++) {
		var b = (a[i].href.search(re)!=-1);
		if (b && allow) { continue; }
		a[i].href = a[i].href.replace(/https/,'http');
		}
	}

/* addClass()/removeClass() String Prototypes v1.0
 * Shortcut for the addition/removal of (multiple) classNames to HTML
 * objects. Takes care of adding spaces when a class is already assigned 
 * and cleaning up whitespace when removing a class.
 */
String.prototype.addClass = function() {
	var txt = this;
	for (var i=0; i<arguments.length; i++) { txt += ((txt=='')?'':' ')+arguments[i];}
	return txt;
	};
String.prototype.removeClass = function() {
	var txt = this;
	for (var i=0; i<arguments.length; i++) { 
		txt = txt.replace(new RegExp('( '+arguments[i]+'\\b|\\b'+arguments[i]+' |\\b'+arguments[i]+'\\b)'),'');
		}
	return txt;
	};

/* SI and SI.resize Objects v1.0
 * Resize creates a hidden div and monitors changes in it's offsetHeight
 * to determine when the user resizes text.
 */
var SI		= new Object();
SI.resize	= new Object();
SI.resize.initialize = function() {
	if (document.all && window.print) { return; }
	
	var c = document.createElement('div');
	
	c.style.position	= 'fixed';
	c.style.top			= '0';
	c.style.visibility	= 'hidden';
	c.style.width		= '10em';
	c.style.height		= '10em';
	
	SI.resize.control = document.body.appendChild(c);
	SI.resize.h = 0;
	window.setInterval('SI.resize.detectChange()',50);
	}
SI.resize.detectChange = function() {
	var o = SI.resize.h;
	SI.resize.h = SI.resize.control.offsetHeight;
	if (o!=SI.resize.h) SI.resize.hasOccurred();
	}
/* SI.resize.hasOccurred() v1.0
 * Add functions that you want to be called whenever 
 * the user resizes text to this method.
 */
SI.resize.hasOccurred = function() {
	SI_clearFooter();
	}

SI.Func = {
	customizeFormToggle : function(e) {
		if (!document.getElementById) return;
		var f = document.getElementById('customize-form');
		if (e.className!='active') {
			e.className='active';
			f.className='active';
			}
		else {
			e.className='';
			f.className='non-dom';
			}
		return false;
		}
	};

/* SI_toggleCheckBoxGroup() v1.0
 * Toggles a group of sub-checkboxes. First argument should always be
 * `this`, a reference to the main checkbox, the second argument is the 
 * id of the element that contains the sub-checkboxes.
 * NOTE: Don't include the main checkbox in the same container as the
 * sub-checkboxes
 */
function SI_toggleCheckBoxGroup(e,id) {
	var checked	= e.checked;
	var group	= document.getElementById(id);
	var inputs	= group.getElementsByTagName('input');
	for (var i=0; i<inputs.length; i++) {
		var input = inputs[i];
		if (input.type=='checkbox') {
			input.checked = checked;
			}
		}
	}

/* SI_preventFlashOverlap() v1.0
 * Adds a class of "prevent-overlap" to the html element so that certain HTML 
 * elements can be hidden on platforms that don't support overlapping
 * HTML and the Flash object. Can be used anytime after the opening HTML 
 * tag, including onload.
 */
function SI_preventFlashOverlap() {
	if (!(navigator.userAgent.toLowerCase().indexOf('windows')!=-1) && document.getElementsByTagName) {
		var html = document.getElementsByTagName('html')[0];
		html.className += ((html.className=='')?'':' ')+'prevent-overlap';
		// alert('Can\'t render menus over Flash content: '+html.className);
		};
	};
	
/******This is the flash detection script.******
 This classes the <html> element as `hasFlash` if flash is found. This style
 hook can be used to hide our to-be-replaced content before it even comes down
 the datapipe and eliminate the FOPSC ("Flash of Partially Styled Content")
 
 I've determined that the lighter the page weight the greater chance of a FOPSC.
 ******************************************************************************/

function SI_embedFlash(id,swf,w,h) {
	if (!document.getElementsByTagName) return;
	var swfHTML;
	swfHTML  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">';
	swfHTML += '	<param name="movie" value="'+swf+'" />';
	swfHTML += '	<param name="wmode" value="opaque" />';
	swfHTML += '	<embed src="'+swf+'" width="'+w+'" height="'+h+'" wmode="opaque" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />';
	swfHTML += '<'+'/object>';
	document.getElementsByTagName('html')[0].className += ' viewFlash';
	document.getElementById(id).innerHTML = swfHTML;
	}

function SI_removeFlash(id) {
	if (!document.getElementsByTagName) return;
	document.getElementsByTagName('html')[0].className = document.getElementsByTagName('html')[0].className.replace(' viewFlash','');
	document.getElementById(id).innerHTML = '';
	}
//2/16/06 - added to use as common email function
function emailCheck(emailStr,form) {

	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */

	var checkTLD=1;

	/* The following is the list of known TLDs that an e-mail address must end with. */

	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */

	var emailPat=/^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address. 
	These characters include ( ) < > @ , ; : \ " . [ ] */

	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a 
	username or domainname.  It really states which chars aren't allowed.*/

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of non-special characters.) */

	var atom=validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */

	var word="(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	/* Finally, let's start trying to figure out if the supplied address is valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {

		/* Too many/few @'s or something; basically, this address doesn't
		even fit the general mould of a valid e-mail address. */

		alert("Email address seems incorrect (check @ and .'s)");
		form.focus();
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Ths username contains invalid characters.");
			form.focus();
			form.select();
			return false;
		   }
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Ths domain name contains invalid characters.");
			form.focus();
			form.select();
			return false;
		   }
	}

	// See if "user" is valid 

	if (user.match(userPat)==null) {
		// user is not valid
		alert("The username doesn't seem to be valid.");
		form.focus();
		form.select();
		return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {

		// this is an IP address

		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!");
				form.focus();
				form.select();
				return false;
			   }
		}
	}

	// Domain is symbolic name.  Check if it's valid.
	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	//alert("len: "+len)
	//alert("domArr: "+domArr)
	//alert("atomPat: "+atomPat)

	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("The domain name does not seem to be valid.");
			form.focus();
			form.select();
			return false;
		   }
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
		form.focus();
		form.select();
		return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len<2) {
		alert("This address is missing a hostname!");
		form.focus();
		form.select();
		return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

/* Landon - 3/2/06
 * For use on Directory Search Results for buddy lists
 */
function checkAll(checkbox){
	for(i=0; i < checkbox.length; i++){
		checkbox[i].checked = true;
	}
}

/* Landon - 3/2/06
 * For use on Directory Search Results for buddy lists
 */
function uncheckAll(checkbox){
	for(i=0; i < checkbox.length; i++){
		checkbox[i].checked = false;
	}
}

/* Landon - 3/2/06
 * For use on Directory Search Results for buddy lists
 */
function alumniActions(info){
	document.dirAction.pageaction.value = info.value
	document.dirAction.submit();
}
//from giving form need it for buddy list
function isFilled(elm) {
    if (elm.value == "" ||
        elm.value == null)
    return false;
    else return true;
}

//Used for alt image hover effect on form buttons -Corbin
function SimpleImageSwap(input,filename) {
	input.src=filename;
}
//Used to swap in/out default text in search box -Corbin
function SetSearchText(input,newText,currentText){
	if (input.value == currentText) {
		input.value = newText;
	}
}

// isDate, isDateString, and isDateInternal are used to 
// check validity of dates; do not call isDateInternal directly, 
// but instead use either of isDate or isDateString - JL060828
function isDate(month, day, year)
{
  // inputs must be integer or string (e.g. not boolean, etc.): call isDateString to make sure
  return isDateString (month.toString() + "/" + day.toString() + "/" + year.toString());
}
function isDateString (DateString) // mm/dd/yyyy
{
  // input must be string: use toString() to make sure
  var dateParts = DateString.toString().split("/");
  // input must be 3 parts: m/d/y
  if (dateParts.length != 3)
  {
    return false;
  }
  
  var month = dateParts[0];
  var day   = dateParts[1];
  var year  = dateParts[2];

  // month, day, year must be integer
  if ( parseInt(month).toString() != parseInt(month) ||
       parseInt(day).toString()   != parseInt(day)   ||
       parseInt(year).toString()  != parseInt(year)     )
  {
    return false;
  }
  // now check for valid date
  return isDateInternal (month, day, year);
}
function isDateInternal (month, day, year)
{
  // do not call this function directly
  // call from isDate or isDateString to make sure inputs are integers
  
  // javascript month range is 0 - 11
  month = month - 1;
  // javascript year is 0 - 99
  year  = year % 100;
  
  var dateValue = new Date(year, month, day);
  
  //alert('test  '+dateValue);
  if ( dateValue.getYear()  == year  &&
       dateValue.getMonth() == month &&
       dateValue.getDate()  == day      )
  {
    return true;
  }
  else
  {
    return false
  }
}

