/////////////////////////////////////////////////////////////////////////////
// Function : NavNode (constructor)
// Comments :
/////////////////////////////////////////////////////////////////////////////
function NavNode(id, label, href, parent)
{
	this.m_parent = null;
	this.m_level = 0;

	if (parent)
	{
		this.m_parent = parent;
		this.m_level = parent.m_level+1;
	}

	this.m_id = id;

	// assume that m_label will most often be used directly as HTML
	this.m_rawlabel = label;

	label = label.replace(/&/g, '&amp;');
	label = label.replace(/</g, '&lt;');
	label = label.replace(/>/g, '&gt;');
	label = label.replace(/"/g, '&quot;');

	this.m_label = label;

	this.m_href = href;
	this.m_subNodes = new Array();

	var argValues = NavNode.arguments;
	var argCount = NavNode.arguments.length;

	for (i = 4 ; i < argCount ; i++)
	{
		var attrName = argValues[i].split("==")[0];
		var attrValue = argValues[i].split("==")[1];

		eval("this.cp_" + attrName + " = '" + attrValue + "';");
	}

	NavNode.prototype.addNode = addNode;
	NavNode.prototype.isSelected = isSelected;
}

/////////////////////////////////////////////////////////////////////////////
// Function : addNode
// Comments :
/////////////////////////////////////////////////////////////////////////////
function addNode(id, label, href)
{
	var newIndex = this.m_subNodes.length;
	var newNode = new NavNode(id, label, href, this);

	var argValues = addNode.arguments;
	var argCount = addNode.arguments.length;

	for (i = 3 ; i < argCount ; i++)
	{
		var attrName = argValues[i].split("==")[0];
		var attrValue = argValues[i].split("==")[1];

		eval("newNode.cp_" + attrName + " = '" + attrValue + "';");
	}

	this.m_subNodes[newIndex] = newNode;
	return newNode;
}

/////////////////////////////////////////////////////////////////////////////
// Function : isSelected
// Comments :
/////////////////////////////////////////////////////////////////////////////
function isSelected()
{
    var pos = window.location.href.lastIndexOf("/");
    var docname = window.location.href.substring(pos+1, window.location.href.length);

    pos = this.m_href.lastIndexOf("/");
    var myname = this.m_href.substring(pos+1, this.m_href.length);

    if (docname == myname)
		return true;
	else
		return false;
}

/////////////////////////////////////////////////////////////////////////////
// Function : customSectionPropertyExists
// Comments :
/////////////////////////////////////////////////////////////////////////////
function customSectionPropertyExists(csp)
{
	return (typeof csp != _U && csp != null);
}

/////////////////////////////////////////////////////////////////////////////
// Function : getCustomSectionProperty
// Comments :
/////////////////////////////////////////////////////////////////////////////
function getCustomSectionProperty(csp)
{
	if (customSectionPropertyExists(csp))
	{
		return csp;
	}
	else
	{
		return "";
	}
}

/////////////////////////////////////////////////////////////////////////////

var g_navNode_Root = new NavNode('2','Home',ssUrlPrefix + 'index.htm',null,'secondaryUrlVariableField==region1');
g_navNode_0=g_navNode_Root.addNode('3','Council',ssUrlPrefix + 'Council/index.htm','secondaryUrlVariableField==region1');
g_navNode_0_0=g_navNode_0.addNode('9','Members',ssUrlPrefix + 'Council/Members/index.htm');
g_navNode_0_1=g_navNode_0.addNode('13','Council Meetings',ssUrlPrefix + 'Council/CouncilMeetings/index.htm');
g_navNode_0_2=g_navNode_0.addNode('8','Committees and Appointments',ssUrlPrefix + 'Council/CommitteesandAppointments/index.htm','secondaryUrlVariableField==region1');
g_navNode_0_3=g_navNode_0.addNode('10','Minutes',ssUrlPrefix + 'Council/Minutes/index.htm');
g_navNode_0_4=g_navNode_0.addNode('11','Agendas',ssUrlPrefix + 'Council/Agendas/index.htm','secondaryUrlVariableField==region1');
g_navNode_0_5=g_navNode_0.addNode('12','By-laws',ssUrlPrefix + 'Council/By-laws/index.htm');
g_navNode_0_7=g_navNode_0.addNode('392','Mayor\'s Message',ssUrlPrefix + 'Council/MayorsMessage/index.htm');
g_navNode_0_8=g_navNode_0.addNode('1430','2010 Election',ssUrlPrefix + 'Council/Election/index.htm');
g_navNode_1=g_navNode_Root.addNode('4','Municipal Services',ssUrlPrefix + 'MunicipalServices/index.htm');
g_navNode_1_0=g_navNode_1.addNode('14','Departments',ssUrlPrefix + 'MunicipalServices/Departments/index.htm');
g_navNode_1_0_0=g_navNode_1_0.addNode('27','Emergency Services',ssUrlPrefix + 'MunicipalServices/Departments/EmergencyServices/index.htm');
g_navNode_1_0_1=g_navNode_1_0.addNode('28','Building',ssUrlPrefix + 'MunicipalServices/Departments/Building/index.htm');
g_navNode_1_0_2=g_navNode_1_0.addNode('29','By-law, Canine Enforcement',ssUrlPrefix + 'MunicipalServices/Departments/By-lawCanineEnforcement/index.htm');
g_navNode_1_0_3=g_navNode_1_0.addNode('30','Clerk, Administration',ssUrlPrefix + 'MunicipalServices/Departments/ClerkAdministration/index.htm');
g_navNode_1_0_4=g_navNode_1_0.addNode('31','Finance',ssUrlPrefix + 'MunicipalServices/Departments/Finance/index.htm');
g_navNode_1_0_5=g_navNode_1_0.addNode('32','Human Resources',ssUrlPrefix + 'MunicipalServices/Departments/HumanResources/index.htm');
g_navNode_1_0_6=g_navNode_1_0.addNode('33','IT, Website Administrator',ssUrlPrefix + 'MunicipalServices/Departments/ITWebsiteAdministrator/index.htm');
g_navNode_1_0_7=g_navNode_1_0.addNode('34','Planning',ssUrlPrefix + 'MunicipalServices/Departments/Planning/index.htm');
g_navNode_1_0_8=g_navNode_1_0.addNode('35','Public Works',ssUrlPrefix + 'MunicipalServices/Departments/PublicWorks/index.htm');
g_navNode_1_0_9=g_navNode_1_0.addNode('36','Reception',ssUrlPrefix + 'MunicipalServices/Departments/Reception/index.htm');
g_navNode_1_1=g_navNode_1.addNode('15','Waste Management',ssUrlPrefix + 'MunicipalServices/EnvironmentalServices/index.htm');
g_navNode_1_1_1=g_navNode_1_1.addNode('38','Waste Disposal Site',ssUrlPrefix + 'MunicipalServices/EnvironmentalServices/WasteDisposalSite/index.htm');
g_navNode_1_2=g_navNode_1.addNode('16','Forms / Permits',ssUrlPrefix + 'MunicipalServices/FormsPermits/index.htm');
g_navNode_2=g_navNode_Root.addNode('5','Community',ssUrlPrefix + 'Community/index.htm');
g_navNode_2_0=g_navNode_2.addNode('17','Community Calendar',ssUrlPrefix + 'Community/CommunityCalendar/index.htm');
g_navNode_2_1=g_navNode_2.addNode('112','Public Notice',ssUrlPrefix + 'Community/PublicNotice/index.htm');
g_navNode_2_2=g_navNode_2.addNode('18','Recreation and Tourism',ssUrlPrefix + 'Community/RecreationandTourism/index.htm');
g_navNode_2_3=g_navNode_2.addNode('19','Township Newsletter',ssUrlPrefix + 'Community/TownshipNewsletter/index.htm');
g_navNode_2_4=g_navNode_2.addNode('20','Frequently Asked Questions',ssUrlPrefix + 'Community/FrequentlyAskedQuestions/index.htm');
g_navNode_2_5=g_navNode_2.addNode('21','Community Services Listing',ssUrlPrefix + 'Community/CommunityServicesListing/index.htm');
g_navNode_2_6=g_navNode_2.addNode('22','History',ssUrlPrefix + 'Community/History/index.htm');
g_navNode_2_7=g_navNode_2.addNode('23','Map of Adjala-Tosorontio',ssUrlPrefix + 'Community/MapofAdjala-Tosorontio/index.htm');
g_navNode_2_8=g_navNode_2.addNode('24','Map of Discover Simcoe',ssUrlPrefix + 'Community/MapofDiscoverSimcoe/index.htm');
g_navNode_2_9=g_navNode_2.addNode('25','Township Statistics',ssUrlPrefix + 'Community/TownshipStatistics/index.htm');
g_navNode_3=g_navNode_Root.addNode('6','Contact Us',ssUrlPrefix + 'ContactUs/index.htm');
g_navNode_3_0=g_navNode_3.addNode('26','Staff Directory',ssUrlPrefix + 'ContactUs/StaffDirectory/index.htm');
g_navNode_4=g_navNode_Root.addNode('7','Search',ssUrlPrefix + 'Search/index.htm','secondaryUrlVariableField==region1');
