function Expand( sTargetID, sLinkID )
{
	if( $( "#" + sTargetID ).css( "display" ) == "none" )
	{
		$( "#" + sTargetID ).slideDown( "normal" );
		$( "#" + sLinkID ).removeClass( "bar_plus" );
		$( "#" + sLinkID ).addClass( "bar_minus" );
	}
	else
	{
		$( "#" + sTargetID ).slideUp( "normal" );
		$( "#" + sLinkID ).removeClass( "bar_minus" );
		$( "#" + sLinkID ).addClass( "bar_plus" );
	}
}

function ParseNav( navId )
{
	$( "div#" + navId ).find( "li" ).each(

		function( i )
		{
			$( this ).hover(

				function()
				{
					$( this ).addClass( "over" );
				},

				function()
				{
					$( this ).removeClass( "over" );
				}

			);
		}
	);
}

var GB_ANIMATION = true;

$( document ).ready( function()
{
	ParseNav( "topnav" );

	$( "a.greybox_country" ).click(
		
		function()
		{
			var t = this.title || $(this).text() || this.href;

			var height	= 250;
			var width	= 400;

			GB_show( t, this.href, height, width );

			return false;
		}
	
	);

	$( "a.greybox_subscribe" ).click(
		
		function()
		{
			var t = this.title || $(this).text() || this.href;

			var height	= 470;
			var width	= 400;

			GB_show( t, this.href, height, width );

			return false;
		}
	
	);

	// EXPANDOS
	$( "div.expando_heading" ).click( function()
	{
		$( this ).next( "div.expando_desc" ).slideToggle();
		$( this ).toggleClass( "bar_plus" );
		$( this ).toggleClass( "bar_minus" );
	});
	
	// START: TWITTER
	var settings = 
	{
		id: 'freightinvestor', 
		count: 2, 
		enableLinks: true, 
		ignoreReplies: true, 
		clearContents: true,
		//template: '<img src="%user_profile_image_url%"/> "%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'
		template: '"%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'
	};
	getTwitters("tweet", settings);
	// END: TWITTER

	// START: TWITTER-SIDEBAR
	
	$( ".market-news-title" ).click( function()
	{
		$( "#tweet" ).slideToggle( 300 );
		
		if( $( this ).hasClass( "active" ) )
		{
			$( this ).removeClass( "active" )	
		}
		else
		{
			$( this ).addClass( "active" );	
		}
	});
	
	// END: TWITTER-SIDEBAR

	$( "a[rel=lightbox]" ).lightbox();
	
	// START: HOME PAGE TABS
	$( "ul.feed-tabs" ).tabs("div.feeds > div", 
	{
		current: "active"	
	});
	// END: HOME PAGE TABS
	
	// START: HOME PAGE HERO SPOT
	
	var speed = 300;		

	$( ".pane-1-area" ).click( function()
	{
		$( "#pane-1-map" ).show();
		$( "#pane-2-map-a, #pane-2-map-b, #pane-3-map" ).hide();
		
		$( ".pane-1-closed" ).hide( 1, function() { $( ".pane-1-open" ).fadeIn( speed ) });
		
		$( ".pane-2-open" ).hide( 1, function() { $( ".pane-2-closed" ).fadeIn( speed ) });
		$( ".pane-3-open" ).hide( 1, function() { $( ".pane-3-closed" ).fadeIn( speed ) });
		
		$( "#pane-2" ).animate({ left: "480px" }, speed);
		$( "#pane-3" ).animate({ left: "660px" }, speed);
	});
	
	
	$( ".pane-2-area" ).click( function()
	{
		$( "#pane-2-map-a, #pane-2-map-b" ).show();
		$( "#pane-1-map, #pane-3-map" ).hide();
		
		$( ".pane-2-closed" ).hide( 1, function() { $( ".pane-2-open" ).fadeIn( speed ) });
		
		$( ".pane-1-open" ).hide( 1, function() { $( ".pane-1-closed" ).fadeIn( speed ) } );
		$( ".pane-3-open" ).hide( 1, function() { $( ".pane-3-closed" ).fadeIn( speed ) });
		
		$( "#pane-2" ).animate({ left: "110px" }, speed);
		$( "#pane-3" ).animate({ left: "660px" }, speed);
	});
	
	
	$( ".pane-3-area" ).click( function()
	{
		$( "#pane-3-map" ).show();
		$( "#pane-2-map-a, #pane-2-map-b, #pane-1-map" ).hide();
		
		$( ".pane-3-closed" ).hide( 1, function() { $( ".pane-3-open" ).fadeIn( speed ) });
		
		$( ".pane-1-open" ).hide( 1, function() { $( ".pane-1-closed" ).fadeIn( speed ) });
		$( ".pane-2-open" ).hide( 1, function() { $( ".pane-2-closed" ).fadeIn( speed ) });
		
		$( "#pane-2" ).animate({ left: "110px" }, speed);
		$( "#pane-3" ).animate({ left: "280px" }, speed);
	});
	
	
	// END: HOME PAGE HERO SPOT
	
});