function initFrame() 
{
	manageFrame(location.hash.substring(1));
}


function manageFrame(newAnchor) 
{
	theAnchor = newAnchor;
	dynframeDiv = document.getElementById('dynframe');
	supermarketselectionDiv = document.getElementById('supermarketselection');

	if (dynframeDiv == undefined) 
	{
		// Should never happen
		alert("dynframeDiv undefined"); // debug
		return;
	}

	if (theAnchor == undefined) 
	{
		// Should never happen
		alert("theAnchor undefined"); // debug
		return;
	}

	if (theAnchor == '')
	{
		// Hide the iFrame
		// alert("theAnchor == ''"); // debug
		dynframeDiv.innerHTML = "";
		return;
	} 

	if (theAnchor.substring(0,1) == 'h')
	{
		// Hide the supermarket selector
		// alert("theAnchor has h "); // debug
		supermarketselectionDiv.style.display = "none";
		theAnchor = theAnchor.substring(1);
	}
	else
	{
		// Display the supermarket selector 
		supermarketselectionDiv.style.display = "block";
	}


	// alert("theAnchor == " + theAnchor); // debug
	
	dynframeDiv.innerHTML = "<iframe src='http://write-a-letter.greenpeace.org/" + theAnchor + "' style='border-style: none; width: 100%; height: 700px'></iframe>";

}