/*Code is Copyright ©2009 R5 Digital LLC.  All Rights Reserved.  This code may not be reused, modified, redistributed, sold, leased, rented, or otherwise tampered with without the written permission of R5 Digital LLC.*/

function makenav(page){
	var pages = new Array();
	var pagesstring = '{"about": {"text": "About the Farm School","url": "/about/", "parent": "", "cls": "nav"},\
"calendar": {"text": "Events Calendar","url": "/calendar/", "parent": "", "cls": "nav"},\
"activities": {"text": "Fall Activities","url": "/activities/", "parent": "", "cls": "nav"},\
"fallevents": {"text": "Fall Events","url": "/activities/fall-events.htm","parent": "activities", "cls": "subnav"},\
"cornmaze": {"text": "Corn Maze","url": "/activities/corn-maze.htm","parent": "activities", "cls": "subnav"},\
"fallnights": {"text": "Fall Nights","url": "/activities/fall-nights.htm","parent": "activities", "cls": "subnav"},\
"produce": {"text": "Fruits & Vegetables","url": "/produce/", "parent": "", "cls": "nav"},\
"pickyourown": {"text": "Pick Your Own","url": "/produce/pick-your-own.htm","parent": "produce", "cls": "subnav"},\
"aboutourproduce": {"text": "About Our Produce","url": "/produce/about-our-produce.htm","parent": "produce", "cls": "subnav"},\
"csa": {"text": "CSA","url": "/produce/csa.htm","parent": "produce", "cls": "subnav"},\
"tours": {"text": "Tours & Education","url": "/tours/", "parent": "", "cls": "nav"},\
"tourspring": {"text": "Spring & Summer","url": "/tours/spring-summer.htm","parent": "tours", "cls": "subnav"},\
"tourfall": {"text": "Fall","url": "/tours/fall.htm","parent": "tours", "cls": "subnav"},\
"volunteer": {"text": "Internships & Volunteer Opportunities","url": "/volunteer/", "parent": "", "cls": "nav"},\
"parties": {"text": "Birthday Parties","url": "/parties/", "parent": "", "cls": "nav"},\
"board": {"text": "Board & Staff","url": "/board/", "parent": "", "cls": "nav"},\
"directions": {"text": "Map & Directions","url": "/directions/", "parent": "", "cls": "nav"},\
"contact": {"text": "Contact Us","url": "/contact/", "parent": "", "cls": "nav"},\
"home": {"text": "Home Page","url": "/", "parent": "", "cls": "nav"}}';
	var pages = eval("(" + pagesstring + ")");
	
	var j;
	
	var thisnav='<table width="90%" border="0" align="center" cellpadding="0" cellspacing="5" style="padding-left:5px;">';
	
	for (j in pages)
	{
		if (page == "home")
		{
			if (j == "home")
			{
			}
			else if (pages[j].parent == '')
			{
				thisnav += '<tr><td><a href="' + pages[j].url + '" class="' + pages[j].cls + '"';
			if (pages[j].target != '' && typeof(pages[j].target) != "undefined")
				{
					thisnav += ' target="' + pages[j].target + '"';
				}
			thisnav += '>' + pages[j].text + '</a></td></tr>';
			}
			else
			{
			}
		}
		else if (pages[j].parent != '')
		{
			if (pages[j].parent == page || pages[page].parent == pages[j].parent || pages[page].parent == j)
			{
				thisnav += '<tr><td><a href="' + pages[j].url + '" class="' + pages[j].cls + '"';
				if (pages[j].target != '' && typeof(pages[j].target) != "undefined")
				{
					thisnav += ' target="' + pages[j].target + '"';
				}
				thisnav += '>' + pages[j].text + '</a></td></tr>';
			}
		}
		else
		{
			thisnav += '<tr><td><a href="' + pages[j].url + '" class="' + pages[j].cls + '"';
			if (pages[j].target != '' && typeof(pages[j].target) != "undefined")
				{
					thisnav += ' target="' + pages[j].target + '"';
				}
			thisnav += '>' + pages[j].text + '</a></td></tr>';
			
		}
	}
	thisnav += '</table>';
	return thisnav;
}