/* Set the path to this event */
var eventPath = "";

/* preload any images (navigation, mouseovers, layers, etc.) */
var imgAr = new Array(
	"/images/arrow_nav_B.gif",
	"/images/utNav_colleague_B.gif",
	"/images/utNav_questions_B.gif",
	"/images/utNav_print_B.gif"
);

if (document.images) {
	var imgs = new Array();
	for (var i=0; i<imgAr.length; i++) {
  	imgs[i] = new Image(); 
		imgs[i].src = imgAr[i];
  }
}

/* General Open Window Function... 
Arguments: url, name, width (int), height (int), scrollbars (boolean 0 or 1)--
width, height, and scrollbars values are optional.*/
function openWin(url, name, w, h, s) {
	if (w) { w = "width=" + w; } else { w = "width=300" }
	if (h) { h = "height=" + h; } else { h = "height=400"}
	if (s) { s = "scrollbars=" + s } else { s = "scrollbars=0" }
	messagewindow = window.open(url, name, ""+w+","+h+","+s+",menubar=no,top=50,left=50,resizable=yes");
	messagewindow.focus();
}

/* a general swap image function.
Takes 3 arguments: image, menuNum, state

image   = to be efficient, this is part of the actual graphic's filename, 
          minus the "_A" or "_B", AND part of the image's "name=" parameter
menuNum = allows a specific image to be chosen, like in a nav menu; may be left blank
state   = either 0 (On) or 1 (Off, default state)

This script can be used with any image, as long as the 2 images that
make up a mouseover set follow a naming format like "imagename_A.gif"
or "imagename_B.gif". Also, make sure that the 'image'+'menuNum' equals
the "name" parameter of the image in question.
*/
function chgImg(image,menuNum,state) {
	if(document.images) {
		if (state!=0) {
		document.images[image+menuNum].src = eventPath+"/images/"+image+"_B.gif";
		}
		else {
		document.images[image+menuNum].src = eventPath+"/images/"+image+"_A.gif";
		}
	}
}


/*
FAQ Filter Pull-Down handler. Takes a single argument of 'action' 
to build into the location URL. Can be made more general by standardizing
the name of the Form and the name of the SELECT menu, so that those can
be hard-coded into the 'selectedValue' variable.
*/
function handleFilter(action) {
	var selectedValue   = document.faqFilter.topic.options[document.faqFilter.topic.options.selectedIndex].value;
	
	if ((selectedValue != 0) || (selectedValue != "")) {
		window.location = action + "\?topic=" + selectedValue;
	}
}

/*
Print Page handler. No arguments.
*/
function printPage() {
	var destLoc
	var pageURL    = window.location.href;
	var pageQStr   = window.location.search;
	var strPrintIt = "PrintIt=1";
	
	/* remove any anchors from the URL -- this confuses the ASP that handles
	hiding page elements. */
	if (pageURL.indexOf("#")) {
		pageURLArray = (pageURL.split("#"));
		pageURL = pageURLArray[0];
	}
	
	/* Create the printable URL and send to browser */
	if ((pageQStr.length!="") || (pageQStr.length!=0)) {
		destLoc = pageURL + "&" + strPrintIt;
	} else {
		destLoc = pageURL + "?" + strPrintIt;
	}
	window.location.href = destLoc;
}

/*
E-mail to Colleague handler. Single argument: the 'pageTitle' variable in
URL encoded form.
*/
function emailColleague(Title) {
	var pageURL   = window.location.href;
	var pageTitle = Title;
	window.open("/colleague.asp?pageURL="+pageURL+"&pageTitle="+pageTitle, "Email_Colleague", "width=410,height=420,menubar=no,top=50,left=50,resizable=yes");
}

