
var highlight = 0;
var maxNav = 6;
var i;
for (i=1; i<=maxNav; i++)
{

		if (window.location == document.getElementById("am"+i).href)
		{
			highlight = i;
			break;
		}

}

if (highlight == 0)
{
	var pathName = window.location.pathname;

	if (pathName=="" || pathName =="/")	//www.phosphor.co.nz or www.phosphor.co.nz/
	{
		highlight = 1;
	}
	else
	{
		for (i=1; i<=maxNav; i++)
		{
			var prefix = document.getElementById("am"+i).innerHTML.split(" ")[0].toLowerCase();

			if (pathName.indexOf(prefix) > -1)
			{
				highlight=i;
				break;
			}
		}
	}
}

if (highlight>0){
	document.getElementById("am"+ highlight).style.color = '#FFFFFF';
/*	switch (highlight)
	{
	case 1:
		document.getElementById("lPrev").style.color = "B1AFA4";
		document.getElementById("lPrev").style.cursor = "default";
		break;
	case 6:
		document.getElementById("lNext").style.color = "B1AFA4";
		document.getElementById("lNext").style.cursor = "default";
		break;

	}
*/
}

// Just a few of them.... don't bother.... load them all at each page
MM_preloadImages('images/buttons/btn-site-masterplan_f2.gif',
				 'images/buttons/btn-site-neighbourhood5_f2.gif',
				 'images/buttons/btn-location-map_f2.gif',
				 'images/buttons/btn-location-back_f2.gif');




function prev()
{
	if (highlight > 1)	// can't go prev at 1
	{
		window.location = document.getElementById("am"+(highlight-1)).href;
	}
}

function next()
{
	if (highlight < maxNav)	//can't go next at maxNav
	{
		window.location = document.getElementById("am"+(highlight+1)).href;
	}
}

