function getCookieVars(e)
{
	f = getObj('flashmap');
	
	cookie =  'mapid=' + f.GetVariable('type')
			+ '&vsbl=' + f.GetVariable('vsbl')
			+ '&posx=' + f.GetVariable('posx')
			+ '&posy=' + f.GetVariable('posy')
			+ '&curx=' + f.GetVariable('curx')
			+ '&cury=' + f.GetVariable('cury')
			+ '&zoom=' + f.GetVariable('zoom')
			+ '&icon=' + f.GetVariable('icon');
	
	setCookie(getCookieName(), cookie);
}



function setCookie(name, value, days)
{
	if (days)
	{
		var date = new Date();
		date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000) );
		var expires = '; expires=' + date.toGMTString();
	}
	else
	{
		var expires = '';
	}
	
	document.cookie = name + '=' + value + expires + '; path=/';
}



function getCookieName()
{
	// cookie name is determined by the body tag ID attribute
	nodelist = document.getElementsByTagName('body');
	cookiename = nodelist[0].id;
	
	return cookiename;
}



function reloadPage()
{
	getCookieVars();
	window.location.reload();
}



function initMap()
{
	if ( document.getElementById('mainmenu') )
		handleEvent(document.getElementById('mainmenu'), 'click', getCookieVars);
	
	if ( document.getElementById('advsearch') )
		handleEvent(document.getElementById('advsearch'), 'click', getCookieVars);
}

//addLoadEvent(initMap);

handleEvent(window, 'load', initMap);



