// <!--
// JavaScript Document
function glowIt(obj,type,level) {
var hicolor;
var offcolor;
if (level==1) {
	hicolor='#333399';
	offcolor='#000066';
} else if (level==2) {
	hicolor='#3366cc';
	offcolor='#333399';
}
	if (type==1) {
		obj.style.backgroundColor=hicolor;
		obj.style.cursor='hand';
	} else {
		obj.style.backgroundColor=offcolor;
	}
}

function glowIt_T(obj,type,level) {
var hicolor;
var offcolor;
	hicolor='#8cb974';
	offcolor='#699851';
	if (type==1) {
		obj.style.backgroundColor=hicolor;
		obj.style.color='edeb9f';
		obj.style.cursor='hand';
	} else {
		obj.style.color='ffffff';
		obj.style.backgroundColor=offcolor;
	}
}

function whereami() {
	var url=window.location.href;
	document.write(url.substring((url.lastIndexOf('/') + 1), url.length));
}

// Create HTML code to display the buttons.
function CreateNavCol(relative, menuname) {
	var rowString = "";

	document.write("<table width=\"190\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"mainLEFT\">");
	
	// Logo
	rowString = "<tr><td><img src=\"" + relative;
	rowString = rowString + "images/ripley-img.gif\" width=190 height=151 alt=\"\"></td></tr>";
	document.write(rowString);
	
	// Home
	buildMenu(relative, "index.htm", "Home");
	
	// About Ripley
	buildMenu(relative + "about/", "about.htm", "About Ripley");
	if (menuname == "about") {
		// Need to build submenu
		buildSubMenu("pictures.htm", "Pictures");
		buildSubMenu("busdist.htm", "Business District");
		buildSubMenu("organizations.htm", "Organizations");
		buildSubMenu("churches.htm", "Churches");
		buildConstructionSubMenu("cemeteries.htm", "Cemeteries");
		buildSubMenu("history.htm", "History");
	}
	
	// Government
	buildMenu(relative + "government/", "government.htm", "Government");
	/*if (menuname == "government") {
		// Need to build submenu
		buildConstructionSubMenu("townsupervisor.htm", "Town Supervisor");
		buildSubMenu("townboard.htm", "Town Board");
		buildConstructionSubMenu("townjustice.htm", "Town Justices");
		buildSubMenu("townclerk.htm", "Town Clerk");
		buildSubMenu("fed.htm", "Federal/State/County");
	}*/
	
	// Services
	buildMenu(relative + "services/", "services.htm", "Services");
	if (menuname == "services") {
		// Need to build submenu
		buildSubMenu("assessment.htm", "Assessment");
		buildSubMenu("zoning.htm", "Building/Zoning");
		buildSubMenu("animal.htm", "Dog Control");
		buildSubMenu("emergency.htm", "Emergency Services");
		buildSubMenu("garbage.htm", "Garbage/Recycling");
		buildSubMenu("highways.htm", "Highway Dept.");
		buildConstructionSubMenu("parksrec.htm", "Parks and Recreation");
		buildSubMenu("taxinfo-school.htm", "Taxes - School");
		buildSubMenu("taxinfo-towncounty.htm", "Taxes - Town and County");
		buildSubMenu("townclerk.htm", "Town Clerk's Office");
		buildSubMenu("court.htm", "Town Court");
		buildSubMenu("water.htm", "Water/Sewer Dept.");
		buildSubMenu("wic.htm", "WIC Program");
	}
		
	// Town Facilities
	buildMenu(relative + "facilities/", "facilities.htm", "Town Facilities");
	if (menuname == "facilities") {
		// Need to build submenu
		buildSubMenu("library.htm", "Library");
		buildSubMenu("schools.htm", "School");
		buildConstructionSubMenu("parks.htm", "Parks");
	}

	// Events
	buildMenu(relative + "events/", "events.htm", "Town Calendar");
	
	// Addition spacing...
	rowString = "<tr><td><br><br></td></tr>";
	document.write(rowString);
	
	// Event Calendar
	//buildOtherMenu(relative, "events.htm", "Event Calendar");
	
	// Contacts
	buildOtherMenu(relative, "contacts.htm", "Quick Contacts");

	// Addition spacing...
	rowString = "<tr><td><br><br></td></tr>";
	document.write(rowString);
	
	// For updates, contact...
	rowString = "<tr><td><span id=\"contactwebmaster\"><a href=\"mailto:ripleywebmaster@gmail.com\">Have updates or corrections?</a></span></td></tr>";
	document.write(rowString);

	// Addition spacing...
	rowString = "<tr><td><br></td></tr>";
	document.write(rowString);
	
	document.write("</table>");
}


function buildNewMenu(relative, file, name) {
	var url=window.location.href;
	var currfile = url.substring((url.lastIndexOf('/') + 1), url.length);
	var rowString = "";
	var imgString = "&nbsp;&nbsp;<img src='http://www.ripley-ny.com/images/new.gif' width='20px' />";
	
    rowString = "<tr><td class=\"menuL1SEP\">&nbsp;</td></tr>"
	document.write(rowString);

	if (file == currfile) {
		rowString = "<tr><td class=\"menuL1SEL\">";
	} else {
		rowString = "<tr><td class=\"menuL1\" onClick=\"location.href=\'";
		rowString = rowString + relative + file;
		rowString = rowString + "\';\" onMouseOver=\"glowIt(this,1,1);\" onMouseOut=\"glowIt(this,0,1);\">";
	}
	rowString = rowString + name;
	rowString = rowString + imgString + "</td></tr>"
	document.write(rowString);
}

function buildMenu(relative, file, name) {
	var url=window.location.href;
	var currfile = url.substring((url.lastIndexOf('/') + 1), url.length);
	var rowString = "";
	
    rowString = "<tr><td class=\"menuL1SEP\">&nbsp;</td></tr>"
	document.write(rowString);

	if (file == currfile) {
		rowString = "<tr><td class=\"menuL1SEL\">";
	} else {
		rowString = "<tr><td class=\"menuL1\" onClick=\"location.href=\'";
		rowString = rowString + relative + file;
		rowString = rowString + "\';\" onMouseOver=\"glowIt(this,1,1);\" onMouseOut=\"glowIt(this,0,1);\">";
	}
	rowString = rowString + name;
	rowString = rowString + "</td></tr>"
	document.write(rowString);
}

function buildSubMenu(file, name) {
	var url=window.location.href;
	var currfile = url.substring((url.lastIndexOf('/') + 1), url.length);
	var rowString = "";
	
    rowString = "<tr><td class=\"menuL2SEP\">&nbsp;</td></tr>"
	document.write(rowString);

	if (file == currfile) {
		rowString = "<tr><td class=\"menuL2SEL\">";
	} else {
		rowString = "<tr><td class=\"menuL2\" onClick=\"location.href=\'";
		rowString = rowString + file;
		rowString = rowString + "\';\" onMouseOver=\"glowIt(this,1,2);\" onMouseOut=\"glowIt(this,0,2);\">";
	}
	rowString = rowString + name;
	rowString = rowString + "</td></tr>"
	document.write(rowString);
}

function buildConstructionSubMenu(file, name) {
	var url=window.location.href;
	var currfile = url.substring((url.lastIndexOf('/') + 1), url.length);
	var rowString = "";
	
    rowString = "<tr><td class=\"menuL2SEP\">&nbsp;</td></tr>"
	document.write(rowString);

	if (file == currfile) {
		rowString = "<tr><td class=\"menuL2SEL\">";
	} else {
		rowString = "<tr><td class=\"menuL2Construction\">";
	}
	rowString = rowString + name;
	rowString = rowString + "</td></tr>"
	document.write(rowString);
}

function buildOtherMenu(relative, file, name) {
	var url=window.location.href;
	var currfile = url.substring((url.lastIndexOf('/') + 1), url.length);
	var rowString = "";
	
    rowString = "<tr><td class=\"menuOtherSEP\">&nbsp;</td></tr>"
	document.write(rowString);

	if (file == currfile) {
		rowString = "<tr><td class=\"menuOtherSEL\">";
	} else {
		rowString = "<tr><td class=\"menuOther\" onClick=\"location.href=\'";
		rowString = rowString + relative + file;
		rowString = rowString + "\';\" onMouseOver=\"glowIt(this,1,1);\" onMouseOut=\"glowIt(this,0,1);\">";
	}
	rowString = rowString + name;
	rowString = rowString + "</td></tr>"
	document.write(rowString);
}

function insertFooter() {
	var rowString = "";
	
	rowString = "<tr><td class=\"disclaimerFooter\" valign=\"bottom\" colspan=1>";
	document.write(rowString);
	rowString = "<a href=\"javascript:openmoreinfo(\'disclaimer.htm\')\" style=\"color: #edeb9f;\">Disclaimer</a>"
	document.write(rowString);
	rowString = "</td>";
	document.write(rowString);
	rowString = "<td class=\"mainFooter\" valign=\"bottom\" colspan=1>";
	document.write(rowString);
	rowString = "&copy;2009 Town of Ripley, NY";
	document.write(rowString);
	rowString = "</td></tr>";
	document.write(rowString);
}

// Open new window.
function openmoreinfo(popurl) {
	window.open(popurl,'moreinfo','width=475,height=425,scrollbars=yes');
}

// Open new window.
function OpenNewWindow(newPage) {
	window.open(newPage, 'newwindow', 'width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
}

// -->
