/** 
* jQuery
*/

$(function() 
{
	/* 
	 * Set column that will be the longest to relative so the footer stays at the bottom of the page
	 * The position rules for the three divs take effect only when javascript is enabled
	 * Home, Resources, Jobs - middle rail is longest so it is made relative
	 * All others (search results) - left rail is longest so it is made relative 
	*/	
	/*
	$('body.home #content_main').css("position" ,"relative");
	$('body.home #content_right').css("position", "absolute");
	$('body.resources #content_main').css("position" ,"relative");
	$('body.resources #content_right').css("position", "absolute");
	$('body.jobs #content_main').css("position" ,"relative");
	$('body.jobs #content_right').css("position", "absolute");
*/
	//--Rotate through featured schools--//
	$('#featured_schools > ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000);
	//Show tab navigation if javascript is enabled
	$('#school_tabs').removeClass("hidden");
	//--Rotate through featured schools--//
	$('#featured_articles > ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000);
	//Show tab navigation if javascript is enabled
	$('#article_tabs').removeClass("hidden");
	//Show all appropriate hide/show buttons if javascript is enabled (location changer)
	$('#zip_updater').addClass("hidden");
	$('.show_zip_updater').removeClass("hidden");
	$('.cancel_zip_updater').removeClass("hidden");
	
	//--Change/Cancel button on right rail--//
	$(".show_zip_updater").click(function()
	{
		$("#zip_updater").slideDown('fast');
		$(".show_zip_updater").fadeOut('slow');
	});
	$(".cancel_zip_updater a").click(function()
	{
		$("#zip_updater").slideUp('slow');
		$(".show_zip_updater").fadeIn('slow');
	});
	//Show all appropriate hide/show buttons if javascript is enabled (search blurbs)
	$('#search_blurb .show_blurb').removeClass("hidden");
	$('#search_blurb .hide_blurb').removeClass("hidden");
	$('#search_blurb .search_blurb_hide').addClass("hidden");
	
	//--Change/Cancel button on middle rail--//
	$("#search_blurb .show_blurb").click(function()
	{
		$("#search_blurb .search_blurb_hide").slideDown('fast');
		$("#search_blurb .show_blurb").fadeOut('slow');
	});
	$("#search_blurb .hide_blurb").click(function()
	{
		$("#search_blurb .search_blurb_hide").slideUp('slow');
		$("#search_blurb .show_blurb").fadeIn('slow');
	});
	//Wait 4 seconds and then fade out the flash message (if it is there)
	$(".flash_box").animate({opacity: 1.0}, 4000);
	$(".flash_box").fadeOut(2000);

});