jQuery(document).ready(function() {
	
	// Expand Contact Panel
	jQuery("#contact_us").click(function(){
		jQuery("div#contact_panel").slideDown("slow",function(){
			jQuery("#login").animate({opacity:0});
			jQuery("#news").animate({opacity:0},function(){
				jQuery(".toggle a").toggle();
			});
		});
	});	
	
	// Expand Log In Panel
	jQuery("#login_link").click(function(){
		jQuery("div#login_panel").slideDown("slow",function(){
			jQuery("#contact").animate({opacity:0});
			jQuery("#news").animate({opacity:0},function(){
				jQuery(".toggle a").toggle();
			});
		});	
	});	
	
	// Expand News Panel
	jQuery("#news_link").click(function(){
		jQuery("div#news_panel").slideDown("slow",function(){
			jQuery("#contact").animate({opacity:0});
			jQuery("#login").animate({opacity:0},function(){
				jQuery(".toggle a").toggle();
			});
		});	
	});	
	
	// Collapse Panel
	jQuery(".close").click(function(){
		jQuery("div.panel").slideUp("slow", function(){
			setTimeout('jQuery(".login").animate({opacity:1});', 500);
			jQuery(".toggle a").toggle();
		});
	});		
	
	jQuery("#submitSubscribeButton").click(function(){
		var siteId = jQuery("#storedSiteId").val();
		var email = jQuery("#news-email").val();
		jQuery.post("utilities/add_to_mailing_list.jsp", { siteId: siteId, email: email },function(data) {
     		jQuery("#news-email-holder").html("Subscription Successful!");
  		});
		return false;
	});
		
});
