Event.observe(window, "load", function(){
	
	prettyPrint();
	
	if(window.location.hash.match("#")){
		//wow, someone is F5.. lets bring them to the right content
		var page = window.location.hash.substr(1).toLowerCase();
		if(["contextmenu","datepicker","modal","notification","modal","selectbox","tooltip"].include(page)){
			$(page+"_content").show();
			$('original_content').remove();
		}
	}
	
	$$("#UIList li a").each(function(link){
		link.observe('click', function(){
			if($('original_content')){
				new Effect.toggle('original_content', 'blind', {duration: 0.5, afterFinish: function(){
					$('original_content').remove();
				}});
			}
			var page = link.getAttribute("href").substr(1).toLowerCase();
			$$('div.content_div').each(function(content_div){
				if(content_div.visible() && content_div.getAttribute('id') != page+"_content"){
					Effect.toggle(content_div,"appear",{duration: 0.5});
				}
			});
			new Effect.Appear(page+"_content", {duration: 0.5});
		});
	});
});
