	/*
	************************************************************************

	Default scripts
		General scripts

	@Homepage:		http://www.internotredici.com
	@Author:			Fabrizio Menghini Calderón <fabrizio@internotredici.com>
	@License:		Creative Commons Attribution-Noncommercial-Share Alike 
						3.0 Unported License
	@Copyright:		2009 (c) Interno Tredici. 
						Some rights reserved.

	************************************************************************
	*/





	/*
	========================================================================
		JQuery ready function
	========================================================================
	*/

	$(document).ready
	(
		function()
		{
			// Opening ready function



			/*
			==================================================================
				Instructions
			==================================================================
			*/

			// IE fixes
			if(document.all)
			{
				// Fix the link on the hero image
				// Get the image path and put as background for the link
				var hero_image = $("#hero dd img").attr("src");
				$("#hero dd a").css("background-image","url("+ hero_image +")");

				// Fix the link on every featured article
				$(".featured_article img").each(function(index)
				{
					var featured_image = $(this).attr("src");
					$(this).next("a").css("background-image","url("+ featured_image +")");
				});

				$("#main_content .featured_article:nth-child(3n+4)").css("margin-right","0");
				$(".highlight *:last").css("margin-bottom","0");
			}


			// Add the onchange functionality for the issue selector
			$("#issue_selector form").submit(function() 
			{
				var val = $(this).find('select').val();
				if(val!='')
					document.location.href = val;
				return false;
			});
			
			if($('#tabs_navigation').length>0 && $('#tabs_navigation span.currentsection').length==0)
			{
				var text = $('#tabs_navigation li a:first').html();
				$('#tabs_navigation li:first').find('a').remove();
				$('#tabs_navigation li:first').append('<span class="currentsection">'+text+'</span>');
			}

			// Closing ready function
		}
	);

