function CheckForHash()
{
	if(document.location.hash)
	{
		var HashLocationName = document.location.hash;
		HashLocationName = HashLocationName.gsub('#','');
		
		var children = $('pop_up_boxes').descendants();
		children.each(function(item) 
		{
			if((HashLocationName != item.identify()) && item.hasClassName('popup'))
			{
				// item.hide();
				new Effect.Fade(item.identify());
				new Effect.BlindUp(item.identify());
			}
			
		});
		
		// $(HashLocationName).show();
		new Effect.Appear(HashLocationName);
		new Effect.BlindDown(HashLocationName);
	}
	
	else
	{
		var children = $('pop_up_boxes').descendants();
		children.each(function(item) 
		{
			if(item.hasClassName('popup'))
			{
				// item.hide();
				$('hd_' + item.identify()).show();
				new Effect.Fade(item.identify());
				new Effect.BlindUp(item.identify());
			}
			
		});
	}
}
 		
function RenameAnchor(anchorid, anchorname)
{
	$(anchorid).writeAttribute('name', anchorname); //this renames the anchor
}

function RedirectLocation(anchorid, anchorname, HashName)
{
	RenameAnchor(anchorid, anchorname);
	document.location = HashName;
	CheckForHash();
}

window.onload = CheckForHash;