/**
 * @author rob.robb.ns
 */
$(document).ready(function(){
	
 	var docHeight = $(document).height();
 	$("#divider").css({height:docHeight});
 	
	//hide the picbox
	$("#picBox").hide();
	
	//sets the picbox logo according to page that is active
	if ($("#bodyId").is(".categoryHome"))
			{$(".cat").attr("src", "/Common/Img/main-cat.jpg")
			 $("#mainTitle").html("MCYSPA");
			}

	if ($("#bodyId").is(".nutrition-cat"))
			{$(".cat").attr("src", "/Common/Img/nutrition-cat2.jpg");
			 $("#mainTitle").html("Nutrition Resources");
			}
			
	if ($("#bodyId").is(".funding-cat"))
			{$(".cat").attr("src", "/Common/Img/funding-cat2.jpg")
			 $("#mainTitle").html("Related Funding Opportunities");
			}
			
	if ($("#bodyId").is(".news-events"))
			{$(".cat").attr("src", "/Common/Img/post-news-cat.jpg")
			 $("#mainTitle").html("Post News And Events");
			}
			
	if ($("#bodyId").is(".outreach"))
			{$(".cat").attr("src", "/Common/Img/outreach-cat.jpg")
			 $("#mainTitle").html("MCYSPA Community Outreach");
			}
		
	if ($("#bodyId").is(".activity-resources"))
			{$(".cat").attr("src", "/Common/Img/activity-cat.jpg")
			 $("#mainTitle").html("Physical Activity Resources");
			}
	if ($("#bodyId").is(".init"))
			{$(".cat").attr("src", "/Common/Img/main-cat.jpg")
			 $("#mainTitle").html("MCYSPA: Initiatives");
			}	
	
	//rollovers for sidebar logo's
	//for spaces to play logo
	$("#s2p").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/s2p-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})
	
	//for apple logo
	$("#apple").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/hf-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for day of play logo
	$("#dop").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/dop-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for gis logo
	$("#gis").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/gis-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for yas logo
	$("#yas").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/azsta-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for sypf logo
	$("#sypf").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/sypf-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for spex logo
	$("#spex").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/spex-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for a2z logo
	$("#a2z").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/a2z-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})	
	
	//for pc logo
	$("#pc").hover(function()
	{
		$(".ro").attr("src", "/Common/Img/pc-ro.gif");
		$("div:hidden").show();
	}, function()
	{
		$("#picBox").hide();
		$(".ro").attr("src", "#");
	})
	
	//the ajax pages - these are the sidebar links
	$("a#s2p-link").click(function() {
		$.get("/Common/ajax/s2p.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
						});
							});
					
	$("a#healthy-foods-link").click(function() {
		$.get("/Common/ajax/healthy-foods.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});
					
	$("a#dop-link").click(function() {
		$.get("/Common/ajax/dop.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});
					
	$("a#gis-link").click(function() {
		$.get("/Common/ajax/gis.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
					self.location = '#ajax-response';
						});
							});
					
	$("a#azsta-link").click(function() {
		$.get("/Common/ajax/azsta.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});
					
	$("a#sypf-link").click(function() {
		$.get("/Common/ajax/sypf.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});
				

	//the ajax pages - these are the footer links
	$("a#history-link").click(function() {
		$.get("/Common/ajax/history.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});
	
	$("a#partners-link").click(function() {
		$.get("/Common/ajax/partners.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});
					
	$("a#donors-link").click(function() {
		$.get("/Common/ajax/donors.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});

	$("a#faq-link").click(function() {
		$.get("/Common/ajax/faq.html", function(data){
			$("#ajax-response").html(data);
				docHeightTwo();
				});
					});

	

});//end jquery document ready

  //the 2nd docheight function to fix the green bar after ajax calls
	function docHeightTwo()
	{
		var docHeightAgain = $(document).height();
 		$("#divider").css({height:docHeightAgain});
	
	}
	
