$(function() {

	$("a[href^=http]").each(
		function(){
			$(this).attr('target', '_blank');
		}
	);

	$("#major_nav>li").hover(
		function() { $(this).addClass('hover'); },
		function() { $(this).removeClass('hover'); }		    	
	);
	var dashboard_height = '150px';
	
	$('#members_landing_header').wrap('<div id="dashboard_effect"></div>');
	$('#dashboard_effect').css({ overflow: 'hidden', float: 'right', width: '100%', height: dashboard_height });
	$('#my_dashboard').css('display', 'block').click(function(){
		var status = ($('#dashboard_effect').is(':visible')) ? 'open' : 'closed';
		if (status == 'open') {
			$('#dashboard_effect').animate({ width: 0 }, 1000, function() {
				$(this).animate({ height: 0 }, 800, function() {
					$(this).hide();
				});
				$('#my_dashboard').css('background-image', 'url(/sup/img/backgrounds/my_dashboard_closed.gif)');
			});
			status = 'closed';
		} else {
			$('#dashboard_effect').show().animate({ height: dashboard_height }, 800, function() {
				$(this).animate({width: '100%'}, 1000);
				$('#my_dashboard').css('background-image', 'url(/sup/img/backgrounds/my_dashboard.gif)');
			});
			status = 'open';
		}
		$.cookie('dashboard::status', status, { expires: 1, path: '/' });
		return false;
	});
	
	if ($.cookie('dashboard::status') == 'closed') {
		$('#dashboard_effect').hide().css({ width: 0, height: 0 });
		$('#my_dashboard').css('background-image', 'url(/sup/img/backgrounds/my_dashboard_closed.gif)');
	} else if (location.pathname != '/members/' && $.cookie('dashboard::status') == null) {
		$('#dashboard_effect').hide().css({ width: 0, height: 0 });
		$('#my_dashboard').css('background-image', 'url(/sup/img/backgrounds/my_dashboard_closed.gif)');
	}

	$("#my_dashboard_container").show();

});