// Set highest height
var hh = 0;

// Set old status
var os = new String();

$( function()
{
	// Hover effect for stacked icons
	$('.stacked_icon, .thumbs_icon').hover(
		function() {
			// Get the url from the rel
			var url = $(this).attr( 'rel' );
			
			// Set the old status
			os = window.status;
			
			// Set the status bar
			window.status = url;
			
			// Do the hover effect
			$(this).addClass( 'hovered' );
		},
		function() { $(this).removeClass( 'hovered' ); }
	);
	
	// Fix height for stacked icons
	// First get the highest value
	$('.stacked_icon, .thumbs_icon').each( function()
	{
		// Get the current height
		var h = $(this).height();
		
		// Set height if higher then the
		// saved one
		hh = (h>hh) ? h : hh;
	})
	
	// Set all stacked icons to the highest height
	.height( hh );
	
	
	// Sets icon stacks / thumbs clickable
	$('.stacked_icon, .thumbs_icon').click( function()
	{
		// Get the url
		var url = $(this).attr( 'rel' );
		
		// Goto the new url location
		window.location.href = url;
	});
	
	
	// Function for the image switch on an icon's page
	$('.jsthumb').click( function()
	{
		// Get the correct id
		var id = $(this).attr('rel');
		
		// Hide all images and remove all active states
		$('.jsimage').hide();
		$('.jsthumb').removeClass( 'active' );
		
		// Add the active state to the curren item
		$(this).addClass( 'active' );
		
		// Show the corresponding image
		$('#img_'+id).show();
		
		return false;
	});
});