if(is_establishment){
	$(document).ready(function(){
		compress_hours_table();
		set_current_hours_status_actions();
		today_hours_status();
	});
}

// Copresses the hours table into a single view link
	function compress_hours_table(){
		var hours_table = $('div.hours table');
		hours_table.before("<a href='hours' id='toggle_hours'>View</a>");
		hours_table.css('display','none');
		$('a#toggle_hours').click(function(){
			var a_tag = $(this);
			if($('div.hours table').is(':hidden')){
				a_tag.html('Hide');
				$('div.hours table').slideDown('fast');
			}
			else{
				a_tag.html('View');
				$('div.hours table').slideUp('fast');
			}
			
			return false;
		});
	}
	
// -------------------------------------------------

// Get today's status among the hours table
	function today_hours_status(){
		var page_id = $('div#page_wrapper').attr('list_id');
		$.ajax({
			type: "GET",
			url: site_url+"/?p=today_in_hours&page_id="+page_id,
			dataType: "script"
		});
	}
// ----------------------------------------

// Set hours current status actions
	function set_current_hours_status_actions(){
		$('a#current_hours_status').live('click',function(){
			var status = $(this).attr('href');
			var iframe = "<iframe frameborder='0' name='search_frame' id='search_frame' src='"+site_url+"/?p=view_same_hours_ests&status="+status+"'></iframe>";
			remove_extra();
			$('div#page_content').html(iframe);
			document.title = 'Establishments Currently '+status;
			
			return false;
		});
	}
// ---------------------------------