	// the following javascript methods will be used by the template ajax_LocalChooser template
	// 	they can't be declared there, because the html snippet will be inserted dynamically into the dom

	function setSessionCookie(cookieName, cookieValue)
	{
		document.cookie = cookieName+'='+cookieValue;
	}
	
	function setEndLessCookie(cookieName, cookieValue)
	{
		var elapsed = new Date();
		var in10Years = elapsed.getTime() + (60*60*24*360*10*1000); // 10 years
		elapsed.setTime(in10Years); 
		document.cookie = cookieName+'='+cookieValue+'; expires=' + elapsed.toGMTString();
	}
	
	function closeLayer()
	{
		$('alternativeSiteContainer').hide();
	}

	var urlForTheAjaxCall;
	
	function registerAjaxCallOnLoad(url)
	{
		urlForTheAjaxCall = url;
		Event.observe(window, 'load', makeTheAjaxCall);
	}
	
	function makeTheAjaxCall()
	{	
		new Ajax.Request(urlForTheAjaxCall, 
		{
			method: 'get',
			requestHeaders:  ['Pragma', 'no-cache', 'Cache-Control', 'must-revalidate','If-Modified-Since', document.lastModified],
			onSuccess: function(transport) 
			{
				document.body.appendChild(new Element('div').update(transport.responseText));
			}
		});
	}