// JavaScript Document
var SenateLiveOpen = false;
$(function() {
	InitTabs("homePageTabNavigation","homePageTabInformation");
	$('#frontPageMainTabs li').click(function() {
		var DivToShow = $(this).children('a').attr('id'); 
		DivToShow = DivToShow.replace("option","tabBody");
		if (DivToShow.match("Video"))
		{
			$("#frontPageMainTabs li a").removeClass("featured-selected");
			$(this).children('a').addClass("video-selected");
		}
		else
		{
			$("#frontPageMainTabs li a").removeClass("video-selected");
			$(this).children('a').addClass("featured-selected");
		}						   				
		$(".tabbodyMain").hide();
		$("#" + DivToShow).show() ;
		return false; 
	}) ;
	$('#SL_Toggle').live('click',function() {
							
	    if (SenateLiveOpen == false)
		{
			$('#SenateLiveContent').load('/session/SenateLiveEmbed.cfm?format=rss');						   
			$('#SL_Toggle').html("Close Bill Panel");
			$('#SL_Toggle').addClass("selected");
			SenateLiveOpen = true;
		}
		else
		{
			SenateLiveOpen = false;
			$('#SL_Toggle').html("Open Bill Panel");
			$('#SL_Toggle').removeClass("selected");
		}
		$('#SenateLiveContent').toggle(100);							   
		return false;
	});
	$('#RefreshBillPanel').live("click", function() {
		$('#SenateLiveContent').hide();
		$('#SenateLiveContent').load('/Session/SenateLiveEmbed.cfm?format=rss');	
		
		$('#SenateLiveContent').show();
		$('#optionBillHistory').click();
		return false;
	}); 
	//jQuery('#IconCarousel1').jcarousel();
	if ($('#SessionLiveData').html() != null)
	{
		setTimeout("updateSessionLive();",5000);  //5 seconds
	}	
	$('a.SL_OpenBillPanel_REMVOVED_TEMP').live("click",function() {
	    $('#SessionLiveHTML').load('/Session/SessionLiveBill.cfm?format=rss&SenateLiveOpen=' + SenateLiveOpen);	
		$('#SessionLiveHTML').show();
		return false;
	});
	
	$("#showAllTodaysEvents").click(function() {
		$('.MeetingAdjourned').toggle() ;			
		Label = $(this).html() ;
		if (Label.indexOf("Hide") > -1)
		{
			
			$(this).html("Show All of Today's Events") ;
		}
		else
		{
			$(this).html("Hide Adjourned Events") ;
		}
		
		return false;
		}) ;
});

function updateSessionLive() {
	$('#SessionLiveData').load('/Session/_SessionLive.cfm?format=rss&SenateLiveOpen=' + SenateLiveOpen);
	setTimeout("updateSessionLive();",5000);  //5 seconds
}
