
//The variable "the_path" must be set to the ABSOLUTE location of the images folder!!

var the_path = "http://www.hagerstownexpress.com/images/";

//The code below preloads the rollover images. If you add one to this array and it is part of the menu, name it "[section_name]+[_over]"
if (document.images) {
	var preload_these = new Array('reservations_over.gif','amenities_over.gif','directions_over.gif','priority_over.gif','meeting_over.gif','group_over.gif','weather_over.gif','tour_facility_over.gif','things_over.gif');
	for (var index=0; index<preload_these.length; index++) {
		var its_name = new Image();
		its_name.src = the_path + preload_these[index];
	}
}
//This little bit is for the image swaps.
//Notice that it checks to see if they are rolling over a "selected image" and if the are, it leaves the function (via return).
var selected_img;
function swapIt(the_name,the_src) {
	if (the_name == selected_img) return
	window.document.images[the_name].src = the_path + the_src;
}
//The function below checks the url and determines what section they are in. Then it swaps out the appropriate image in the menu.
//The first three lines of this function pick apart the url to find what folder the page is in.
//If your page is in a folder that is nested in a section folder THIS WILL NOT WORK!
//The "name" attribute of the img tag must match the folder name of the section.
//Name the highlighted image "[folder_name]+[_selected]"  
function swapInSelected() {
	var end_string = window.location.href.lastIndexOf("/");
	var modified_url = window.location.href.substring(0,end_string);
	var folder_name = modified_url.substring(modified_url.lastIndexOf("/") + 1,modified_url.length);
	
	var folders = new Array('amenities','reservations','directions','tour_facility','group','meeting','priority','things','weather');
	for (var f=0; f<folders.length; f++) {
		if (folder_name == folders[f]) {
			selected_img = folder_name;
			window.document.images[folder_name].src = the_path + folder_name + "_selected.gif";
		}
	}
}
function popWin(the_page,the_width,the_height) {
	var the_win = window.open(the_page,'happs','menubar=yes,status=yes,scrollbars=yes,resizable=yes,height='+the_height+',width='+the_width);
	if (window.focus) {
		the_win.focus();
		the_win.moveTo(0,0);
	}	
}