// JavaScript Document created 25/08/2008 by Fraser Patullo to change background colour in tables so they stand out.
//Array globals to be accessed by various methods
var Apr = new Array();
var May = new Array();
var Jun = new Array();
var Jul = new Array();
var Aug = new Array();
var Sep = new Array();
var Oct = new Array();
var allDates = new Array();

$(document).ready(function(){
	prepArray();
	addTabs();
	var rowArray = $("table tr");
	prepPage(rowArray);
});

function prepPage(rowArray){
	
	for(var i=0; i<rowArray.length; i++)
	{
		if(i%2){
		$(rowArray[i]).addClass("hilight");
		}
		
	}
}
function addTabs(){
	$("#monthTabs a").click(function(){
			$("#monthTabs li").removeClass("tabSelected");
			$(this).parent().addClass("tabSelected");
			var month = $(this).attr("id");
			showData(month);
			return false;
	});
}

function prepArray(){
	allDates = $("table tr:not(:first)")
	$("table tr").each(function(i){
		var month = $(this).attr("class");
		
		
		switch(month){
			case "Apr":
			Apr[Apr.length] = this;
			break;
			
			case "May":
			May[May.length] = this;
			break;
			
			case "Jun":
			Jun[Jun.length] = this;
			break;
			
			case "Jul":
			Jul[Jul.length] = this;
			break;
			
			case "Aug":
			Aug[Aug.length] = this;
			break;
			
			case "Sep":
			Sep[Sep.length] = this;
			break;
			
			case "Oct":
			Oct[Oct.length] = this;
			break;
		}//end switch
		
								});
}
function showData(month){
	if(month == "all")
	{
		$("table tr:not(:first)").remove();
		for(var i=0; i<allDates.length; i++)
		{
			$("table").append(allDates[i]);
		}
	}
	else{
		var tempMonthArray = eval(month);
		$("table tr:not(:first)").remove();
		for(var i=0; i<tempMonthArray.length; i++)
		{
			$("table").append(tempMonthArray[i]);
		}
	}
	
}

