// JavaScript Document

function writeMenu(mNum, cPage, sNum, sPage) {
	var menuStr;
	var menuURL=new Array();
	var menuItm=new Array();
	
	var subMenuURL=new Array();
	var subMenuItm=new Array();
		
	menuStr = "<ul>";

	switch (mNum) {
	case 1:
		//History / Information
		menuItm[0]="General Information"
		menuURL[0]="/info/index.html"
		menuItm[1]="Wilton Town History"
		menuURL[1]="/info/history.html"
		menuItm[2]="Historic Districts &amp; Properties"
		menuURL[2]="/info/historicDist0.html"
		menuItm[3]="Permits and Licenses"
		menuURL[3]="/info/permits.html"
		menuItm[4]="Voter Information"
		menuURL[4]="/departments/voter.html"
		menuItm[5]="Town Officials"
		menuURL[5]="/info/officials.html"
		menuItm[6]="First Selectman's Office"
		menuURL[6]="/info/selectman.html"
		menuItm[7]="Boards &amp; Memberships"
		menuURL[7]="/info/boards.html"
		menuItm[8]="Wilton Cable TV 79"
	    menuURL[8]="/info/cable79.html"
		menuItm[9]="Veterans"
		menuURL[9]="/info/veterans.html"
		menuItm[10]="News Archives"
		menuURL[10]="/news/index.html"
		menuItm[11]="Public Notices"
		menuURL[11]="/news/notices.html"
		menuItm[12]="Emergency Preparedness"
		menuURL[12]="/info/disaster.html"
		
	break    
	
	case 2:
	//Departments / Services
	  menuItm[0]="General Information"
	  menuURL[0]="/departments/index.html"
	  menuItm[1]="Ambulance/Paramedic"
	  menuURL[1]="http://www.wiltonambulance.org"
	  menuItm[2]="Assessor"
	  menuURL[2]="/departments/assessor.html"
	  menuItm[3]="Building Department"
	  menuURL[3]="/departments/building.html"
	  menuItm[4]="Conservation"
	  menuURL[4]="/departments/conservation0.html"
	  menuItm[5]="Fire Department"
	  menuURL[5]="/departments/fire.html"
	  menuItm[6]="Health Department"
	  menuURL[6]="/departments/health.html"
	  menuItm[7]="Inland Wetlands"
	  menuURL[7]="/departments/inland.html"
	  menuItm[8]="Parks & Recreation"
	  menuURL[8]="/departments/park.html"
	  menuItm[9]="Planning & Zoning"
	  menuURL[9]="/departments/planningAndZoning.html"
	  menuItm[10]="Police Department"
	  menuURL[10]="/departments/police.html"
	  menuItm[11]="Public Works"
	  menuURL[11]="/departments/publicWorks.html"
	  menuItm[12]="Registrar of Voters"
	  menuURL[12]="/departments/Voter/voter.html"
	  menuItm[13]="Social Services"
	  menuURL[13]="/departments/social.html"
	  menuItm[14]="Tax Collector"
	  menuURL[14]="/departments/tax.html"
	  menuItm[15]="Town Clerk"
	  menuURL[15]="/departments/clerk.html"
	  menuItm[16]="Transportation"
	  menuURL[16]="/departments/transportation.html"
	  menuItm[17]="Wilton CERT"
	  menuURL[17]="/departments/cert.html"
		break
	
	case 3:
		//CALENDAR

		break
	
	case 4:
		//Library / education
		menuItm[0]="General Information"
		menuURL[0]="/education/index.html"
		menuItm[1]="Board of Education"
		menuURL[1]="/education/board.html"
		menuItm[2]="Schools"
		menuURL[2]="/education/schools.html"
		menuItm[3]="Library"
		menuURL[3]="/education/library.html"
		menuItm[4]="Adult Computer Learning"
		menuURL[4]="/education/acl.html"
		break	
	case 5:
		//Jobs
		break
	
	case 6:
		//What's New
		menuItm[0]="January 2008"
		menuURL[0]="/news/whatsNew.html"
		
		break
	
	
	
	default:
	
	
	}

//-----------------------------------------------------------------
//SECOND TIER MENUs
//-----------------------------------------------------------------
	switch (sNum) {
	case 1: 
		//Hitoric Districts
		subMenuItm[0]="Information &amp; List"
		subMenuURL[0]="/info/historicDist1.html"
		subMenuItm[1]="Map"
		subMenuURL[1]="/info/historicDist2.html"
		subMenuItm[2]="Photographs"
		subMenuURL[2]="/info/historicDist3.html"
		subMenuItm[3]="Definition &amp; Purpose"
		subMenuURL[3]="/info/historicDist4.html"
		subMenuItm[4]="Local vs. National"
		subMenuURL[4]="/info/historicDist5.html"
		subMenuItm[5]="Commission"
		subMenuURL[5]="/info/historicDist6.html"
		subMenuItm[6]="Rules &amp; Procedures"
		subMenuURL[6]="/info/historicDist7.html"
		subMenuItm[7]="C of A Process"
		subMenuURL[7]="/info/historicDist8.html"
		subMenuItm[8]="C of A Application Form (PDF)"
		subMenuURL[8]="/PDFs/HistoricDistricts/applicationAppropriateness.pdf' target='_blank"
		subMenuItm[9]="Ordinance"
		subMenuURL[9]="/info/historicDist9.html"
		
	break
	
	case 2:
		//Voter
		subMenuItm[0]="Registration"
		subMenuURL[0]="/departments/Voter/voter.html"
		subMenuItm[1]="Polling Districts & Sample Ballots"
		subMenuURL[1]="/departments/Voter/voter2.asp"
		subMenuItm[2]="Election Calendar"
		subMenuURL[2]="/departments/Voter/voter3.html"
		subMenuItm[3]="Voter Info Look-up"
		subMenuURL[3]="/departments/Voter/voter4.asp"
		subMenuItm[4]="Absentee Ballots"
		subMenuURL[4]="/departments/Voter/voter5.html"
	break
	
	case 3: 
		//Building Departmebnt
		subMenuItm[0]="Building FAQ"
		subMenuURL[0]="/departments/buildingFAQ.html"

	break
	
	case 4: 
		//Conservation
		subMenuItm[0]="Open Space Regulations"
		subMenuURL[0]="/departments/conservation1.html"
		subMenuItm[1]="Hiking Precautions"
		subMenuURL[1]="/departments/conservation2.html"
		subMenuItm[2]="Conservation FAQ"
		subMenuURL[2]="/departments/conservation_FAQ.html"

	break
	case 5:
		//Selectman Stuff
		subMenuItm[0]="Selectmen Minutes"
		subMenuURL[0]="/info/selectmanMinutes.html"
		subMenuItm[1]="State of the Town"
		subMenuURL[1]="/info/selectmanStateOfTown.html"
		subMenuItm[2]="Airspace Planning"
		subMenuURL[2]="/news/publicNotice_010808.html"
	break

	default:
	}

	for (i=0; i< menuItm.length; i++) {
		menuStr += "<li><a href='";
		menuStr += menuURL[i];
		menuStr += "'";
		if (menuURL[i] == cPage) {
			menuStr += " class='selected' ";
		}
		menuStr += ">";
		menuStr += menuItm[i];
		menuStr += "</a>";
	//ADD Second tier menu here
		if (sNum && (menuURL[i] == cPage)) {
			menuStr += "<div id='subMenu'><ul>";
			for (ix=0; ix< subMenuItm.length; ix++) {
				menuStr += "<li><a href='";
				menuStr += subMenuURL[ix];
				menuStr += "'";
				if (subMenuURL[ix] == sPage) {
					menuStr += " class='selected' ";
				}
				menuStr += ">";
				menuStr += subMenuItm[ix];
				menuStr += "</a>";
				menuStr += "</li>";
			}
			menuStr += "</ul></div>";
		}
		//END second tier submenu declaration
		menuStr += "</li>";
	}

	menuStr += "</ul>";

document.write(menuStr);

}