var highlight = 0;
var maxNav = 5;
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 objImg = document.getElementById("am" + i).innerHTML.toLowerCase()
		
			var prefix = objImg.substr(objImg.indexOf('"', objImg.indexOf("alt")) + 1, 3) + "_";


			if (pathName.indexOf(prefix) > -1)
			{
				highlight=i;
				break;
			}
		}
	}
}


if (highlight > 0)
{
	document.getElementById("am"+ highlight).innerHTML = document.getElementById("am"+ highlight).innerHTML.replace(".gif", "_f2.gif");

}

// 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;
	}
}
*/
