function openCategory( form ) { 
	if (form.category.selectedIndex == "") {
	//no action
	} else {	
		var newIndex = form.category.selectedIndex; 
		if ( newIndex == 0 ) { 
		//no action 
		} else { 
			cururl = "fs-calendar.asp?monthNo="+ queryString("monthNo") +"&category=" + form.category.options[ newIndex ].value; 
			window.location.assign( cururl );
		} 
	}
} 

function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
	for(var j=0; j < this.keyValuePairs.length; j++) {
		if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
	var a = new Array(this.getLength());
	for(var j=0; j < this.keyValuePairs.length; j++) {
		a[j] = this.keyValuePairs[j].split("=")[0];
		}
	return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}

function open_new_window() 
{
	new_window = open("","hoverwindow","width=300,height=300,left=100,top=10");
	new_window.document.open();
	new_window.document.write("<html><title>Development Calendar Help</title>");
	new_window.document.write("<body bgcolor=\"#FFFFFF\">");
	new_window.document.write("Use the 'Choose a category' drop down selector to view scheduled courses ");
	new_window.document.write("for a specific category like Employee Development or Faculty Development.");
	new_window.document.write("<br><br>To navigate to a different month click on the month's name in the  ");
	new_window.document.write("navigation bar at the top of the page or use < and > in the calendar's header ");
	new_window.document.write("to navigate to the previous or next month.<br><br>Use << and >> in the calendar's ");
	new_window.document.write("header to move to the previous or next year.");
	new_window.document.write("<br>"); 
	new_window.document.write("<br>");
	new_window.document.write("</body></html>");

	new_window.document.close(); 
}

function close_window() 
{
	new_window.close();
}


function toggleLayer(whichLayer)
{
	if (document.getElementById){
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
		eraseCookie("calendarDisplay");
		setCookie("calendarDisplay", document.getElementById("calendarTable").style.display, 5);
	}
	else if (document.all){
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
		eraseCookie("calendarDisplay");
		setCookie("calendarDisplay", document.getElementById("calendarTable").style.display, 5);
	}
	else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
		eraseCookie("calendarDisplay");
		setCookie("calendarDisplay", document.getElementById("calendarTable").style.display, 5);
	}
}

function getCookie(NameOfCookie)
{ 
	if (document.cookie.length > 0) { 
		begin = document.cookie.indexOf(NameOfCookie+"="); 
		if (begin != -1) { 
			begin += NameOfCookie.length+1; 
			end = document.cookie.indexOf(";", begin);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end)); 
		} 
	}
	return null; 
}

function setCookie(NameOfCookie, value, expiredays) 
{ 
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
} 
 
function eraseCookie(name) {
	setCookie(name,"",-1);
}
