jQuery(document).ready(function(){
/*
	INSTRUCTIONS:	
	1. Add admin-feature.js to your profile.	
	2. Add admin-theme.css to your profile.
	3. Add this html to your profile:

	<div id="adminBlock" style="display:none;">
		<div id="adminBlockWrapper"></div>
	</div>	
	
	4. Initialize Admin Menu by adding the following to your jQuery:
	// Calculate width of menu items (admin-menu)
		var totalWidth = jQuery("your menu element").outerWidth();
		var startWidth = 0;

		// Append other menu item (admin-menu)
		// Make sure to check if the :visible is necessary for you
		jQuery(".level1-item").each(function() {
		startWidth += jQuery(this).outerWidth();
		if(startWidth > totalWidth)
		{
			jQuery(this).appendTo("#adminBlockWrapper");
		}	
	});
*/
	
//Get the height
	jQuery("#adminBlockWrapper").css('border', '4px solid #cdcfd2').css('padding', '20px');
	// And use it as the starting position of the block
	var adminHeight = jQuery("#adminBlock").outerHeight();
	var startingHeight = adminHeight - 0;

	// Offset menu so that only the "button" to open the menu is visible
	jQuery("#adminBlock").css("top", -startingHeight);

	// Create open and close button for the menu
	jQuery("#adminBlock").append('<span class="open"></span><span style="display: none;" class="close"></span>');

	// Slides out the menu when clicked on the open button and make it a close button	
	jQuery("#adminBlock .open").click(function(){
		jQuery("#adminBlock").animate({top: 0}, 850);
		//jQuery("#adminBlockWrapper").css('top', '0');
		jQuery(this).hide();
		jQuery(".close").show();
	});

	// Closes the menu and makes the button a open button again	
	jQuery("#adminBlock .close").click(function() {
		jQuery("#adminBlock").animate({top: -startingHeight}, 350);
		jQuery(this).hide();
		jQuery(".open").show();
	});	

	// Add a hover class to the items for styling purposes	
	jQuery("#adminBlock li").hover(function(){
		jQuery(this).addClass("hover");
	}, function(){
		jQuery(this).removeClass("hover");
	});	
	
});

