var pageValue = null;
var intervalId = null;

function setPage(newPage) 
{
	pageValue = newPage;
	
	//	Check if Flash object exists
	if (window.document.mymovie) 
	{
		//	Set page variable in _root timeline of Flash movie
		window.document.mymovie.SetVariable("page", newPage);
		
		//	Set URL
		window.location = "#" + newPage;
	}
}

function checkAddress()
{
	var url = window.location + "";
	var p = url.split('#');

	if(pageValue != null && pageValue != p[p.length - 1])
	{
		setPage(p[p.length - 1]);
	}
}

//	Set interval to check for browser back/forward button press
intervalId = window.setInterval('checkAddress()', 250);