var speed = 300;

$(function() {	

	switchContent( 0 );
	
	$( "li.accordian" ).click( function()
	{
		var position = $( "li.accordian" ).index( this );
		switchContent( position );
		
		$( this ).css({ cursor: "default" });
	});
	
	$( "li.accordian" ).hover(
		function() 
		{
			var position = $( "li.accordian" ).index( this );
			overContent( position );
		},
		function() 
		{
			var position = $( "li.accordian" ).index( this );
			outContent( position );
		}
	);
});

function switchContent( position )
{
	$( "li.accordian:eq(" + position + ")" ).animate({ width: "639", backgroundPosition: "-318px" }, speed, "swing" ).find( ".hero-content" ).fadeIn( speed );
	$( "li.accordian:not(:eq(" + position + "))" ).animate({ width: "159", backgroundPosition: "0px" }, speed, "swing" ).find( ".hero-content" ).fadeOut( speed );
}

function overContent( position )
{
	if( $( "li.accordian:eq(" + position + ")" ).css( "backgroundPosition" ) == "0px 50%" )
	{
		$( "li.accordian:eq(" + position + ")" ).css({ backgroundPosition: "-159px", cursor: "pointer"  });
	}
}

function outContent( position )
{
	if( $( "li.accordian:eq(" + position + ")" ).css( "backgroundPosition" ) == "-159px 50%" )
	{
		$( "li.accordian:eq(" + position + ")" ).css({ backgroundPosition: "0px", cursor: "default" });
	}
}


