var toggleNavigation = function() {
	$('.nav_subsection').css({
            position: "relative",
            top: -1,
            left: 0,
            display: "none" // info cells are just kicked off the page with CSS (for accessibility)
    });
	//$('.nav_subsection').hide();
	$(".submenu").mouseenter(function() {
		$(this).find('ul').show();
	});
	$("#content-1").mouseleave(function() {
		$('.nav_subsection').hide();
	});
}



var toggleNavNotReports = function() {
	//$('#about_submenu').hide();
	$('#reports_submenu').css({
            position: "relative",
            top: -1,
            left: 0
   });
   $('#about_submenu').css({
            position: "relative",
            top: -1,
            left: 0,
            display: "none" 
   });
	$(".submenu").mouseenter(function() {
		$(this).find('ul').show();
	});
	$("#content-1").mouseleave(function() {
		$('#about_submenu').hide();
	});
}



var toggleNavNotAbout = function() {
	$('#reports_submenu').hide();
		$('#reports_submenu').css({
            position: "relative",
            top: -1,
            left: 0,
            display: "none"
   });
   $('#about_submenu').css({
            position: "relative",
            top: -1,
            left: 0
   });
   $(".submenu").mouseenter(function() {
		$(this).find('ul').show();
	});
	$("#content-1").mouseleave(function() {
		$('#reports_submenu').hide();
	});
}



var reportSetup = function() {
	//$(".report_unit:odd").css("background-color","#DDE5ED");
	//$(".report_summary").hide();
	$('.report_summary').css({
            position: "relative",
            top: -1,
            left: 0,
            display: "none" // info cells are just kicked off the page with CSS (for accessibility)
   });
   $(".report_title").css("background-image","url(../images/plus.png)");
	$(".report_unit").slice(20).hide();
	$(".report_unit").click(function() {
		if (!($(this).hasClass("clickedopen"))) {
			//$(this).find('dd').show();
			$(this).find('p:eq(1)').show();
			$(this).find('p:eq(0)').css("background-image","url(../images/minus.png)");
			$(this).addClass("clickedopen");
		}
		else {
			$(this).find('p:eq(1)').hide();
			$(this).find('p:eq(0)').css("background-image","url(../images/plus.png)");
			$(this).removeClass("clickedopen");
		}
	});
	$(".report_unit a").click(function(e) {
		e.stopPropagation();
	});
}


var openFirst = function() {
	$(".report_summary:first").show();
	$(".report_title:first").css("background-image","url(../images/minus.png)");
	$(".report_unit:first").addClass("clickedopen");
}


var toggleReports = function() {
	$("#expandor").click(function() {
		if (!($(this).hasClass("clickedopen"))) {
			$(".report_unit").slice(20).show();
			$(this).text("Show Fewer Reports");
			$(this).addClass("clickedopen");
		}
		else {
			$(".report_unit").slice(20).hide();
			$(this).text("Show Older Reports");
			$(this).removeClass("clickedopen");
		}
	});
}




var aboutTableSetup = function() {
	$(".staff_detail:odd").css("background-color","#DDE5ED");
	//$(".bio_row").hide();
	$('.bio_row').css({
      position: "relative",
      top: -1,
      left: 0,
      display: "none" // info cells are just kicked off the page with CSS (for accessibility)
   });
	$(".name").css("background-image","url(../images/plus.png)");
	$(".staff_detail").click(function() {
		if (!($(this).hasClass("clickedopen"))) {
			$(this).next().css("background-color",$(this).css("background-color"));
			$(this).next().show();
			$(this).find("td:first").css("background-image","url(../images/minus.png)");
			$(this).addClass("clickedopen");
		}
		else {
			$(this).next().hide();
			$(this).find("td:first").css("background-image","url(../images/plus.png)");
			$(this).removeClass("clickedopen");
		}
	});
}



var setDropdown = function() {
	var php_category = $("#php").val();
	$("#select_box").val(php_category);
	$("#select_box").change(function() {
		var selected = $(this).val();
		if (!("gonowhere"==selected)) {
		document.location.href = "reports.php?category=" + selected;
		}
	});
}
	
	
var multimediaSetup = function() {
	$("#multimedia_list").find("li:odd").css("background-color","#DDE5ED");
}

var highlightActive = function(button) {
	$("#"+button).css("background-color","#6698BD");
}


var multipageReport = function(section_number) {
	$('.div_report_section').hide();
   $('.div_report_section').eq(0).show();
   $('.div_report_section').eq(0).addClass("sectionlive");
   $('.toc_section').eq(0).addClass("live");
   $('#rightbottomnav').show();
   var index=section_number;
   setBottomNav(index);
   $('#rightbottomnav').click(function() {
   	$(".sectionlive").hide();
		$(".sectionlive").removeClass("sectionlive");
		index++;
		$(".div_report_section").eq(index).addClass("sectionlive");
		window.scrollTo(0,0);
		$(".sectionlive").show();
		setBottomNav(index);
	});
	$('#leftbottomnav').click(function() {
   	$(".sectionlive").hide();
		$(".sectionlive").removeClass("sectionlive");
		index--;
		$(".div_report_section").eq(index).addClass("sectionlive");
		window.scrollTo(0,0);
		$(".sectionlive").show();
		setBottomNav(index);
	});
   $(".toc_section").click(function() {
		if (!($(this).hasClass("live"))) {
			$(".sectionlive").hide();
			$(".toc_list").hide();
			$(".sectionlive").removeClass("sectionlive");
			$(".live").removeClass("live");
			$(this).addClass("live");
			index = $('.toc_section').index(this);
			$(".div_report_section").eq(index).addClass("sectionlive");
			$(".sectionlive").show();
			setBottomNav(index);
		}
	});
	$(".gotoend").click(function() {
		var num_sections = $(".div_report_section").length;
		index = num_sections-1;
		$(".sectionlive").hide();
		$(".sectionlive").removeClass("sectionlive");
		$(".div_report_section").eq(index).addClass("sectionlive");
		window.scrollTo(0,0);
		$(".sectionlive").show();
		setBottomNav(index);
	});
}

var gotoSection = function (section_number) {
	section_number = section_number - 1;
	if ((section_number < $(".div_report_section").length) && (section_number>0)) {
		$(".sectionlive").hide();
		$(".sectionlive").removeClass("sectionlive");
		$(".div_report_section").eq(section_number).addClass("sectionlive");
		//window.scrollTo(0,0);
		$(".sectionlive").show();
		setBottomNav(section_number);
	}

}

var setBottomNav = function (ind) {
	if (!(0==ind)) {
		$("#leftbottomnav").show();
	}
	else {
		$("#leftbottomnav").hide();
	}
	var listlength = $('.toc_section').length;
	listlength--;
	if (!(ind==listlength)) {
		$("#rightbottomnav").show();
	}
	else {
		$("#rightbottomnav").hide();
	}
}
	
	

