﻿$(document).ready(function() { 
	
	// Equalise heights of panels in each row
	$("DIV.blogListRow").each(function(i){
		
		// Find out the top height of the panels
		var topHeight = 0;
		var panelToFix;
		$("DIV.blogListPanel", this).each(function(ii){

			topHeight = $("DIV.blogListBodyContent", this).height() > topHeight ? $("DIV.blogListBodyContent", this).height() : topHeight;
			
		});
		
		// Set height if panel is shorter the topHeight
		$("DIV.blogListPanel", this).each(function(ii){
						
			if($("DIV.blogListBodyContent", this).height() < topHeight){
				$("DIV.blogListBodyContent", this).height(topHeight);
			}
			
		});
		
	});
	
});


var currentBloggers;
var currentPanel;
function toggleBloggers(bloggersID) {
	
	var nextBloggers = document.getElementById(bloggersID);
	var nextPanel = document.getElementById("blogListPanel"+bloggersID.substring(bloggersID.length-1,bloggersID.length));
	
	if(currentBloggers != null){
		currentBloggers.style.display = "none";
		if(currentPanel != null){
			currentPanel.style.zIndex = "0";
		}
	}
	
	if(nextBloggers.style.display == "none" && currentBloggers != nextBloggers){
		nextBloggers.style.display = "block";
		nextPanel.style.zIndex = "50";
		currentBloggers = nextBloggers;
		currentPanel = nextPanel;
	} else {
		currentBloggers = null;
		currentPanel = null;
	}
	
}
