jQuery(document).ready(function()
{
	//Initialize accordion and setup change callback functions.
	jQuery("#accordion_nav").accordion({fillSpace:true, change:function(event, ui)
	{
		//accordion_nav_selected_reset();
		//ui.newHeader.data("selected", true);
	}});

	//Set height of navigation object.
	jQuery("#accordion_nav").each(function()
	{
		jQuery(this).height(jQuery(this).parent().height());
	});

	//Force hover on content when header is hovered.
	jQuery("#accordion_nav h1").each(function()
	{
		jQuery(this).hover(function()
		{
			jQuery(this).next("div").addClass("ui-accordion-content-hover");
		},
		function()
		{
			jQuery(this).next("div").removeClass("ui-accordion-content-hover");
		});
	});

	//Force hover on header and content when content is hovered.
	jQuery("#accordion_nav div").each(function()
	{
		jQuery(this).hover(function()
		{
			jQuery(this).addClass("ui-accordion-content-hover");
			jQuery(this).prev("h1").addClass("ui-state-hover");
		},
		function()
		{
			jQuery(this).removeClass("ui-accordion-content-hover");
			jQuery(this).prev("h1").removeClass("ui-state-hover");
		});
	});

	//Change the entire li into a hyperlink.
	jQuery("#accordion_nav div ul li").each(function()
	{
		jQuery(this).click(function()
		{
			window.location = jQuery(this).children("a").attr("href");
		});
	});
});

//Initialize Front Page Carousel.
jQuery(document).ready(function()
{
    $("div.recologyCarousel").recologyCarousel();
});

//Initialize Staff Photo Modal Block.
jQuery(document).ready(function()
{
	//Create modal block.
	window.modal_staff_image = new modal_block("staff_image");

	//Bindings to open map.
    $("a[href='images/recology_del_norte_staff_640x.jpg']").each(function()
    {
   		$(this).click(function(event)
   		{
   			event.preventDefault();
			modal_staff_image.show();
   		});
	});

	//Bindings to close map.
    $("#staff_image img").each(function()
    {
   		$(this).click(function(event)
   		{
			modal_staff_image.hide();
   		});
	});
});
