// Tab Javascript

var currentSelectedTab = new Array();
currentSelectedTab[0] = 0;
currentSelectedTab[1] = 0;
currentSelectedTab[2] = 0;
currentSelectedTab[3] = 0;
currentSelectedTab[5] = 0;
var skipTabChange = 0;
var browser=navigator.appName;

function TabChange(tabset,tab)
{
	if(skipTabChange == 1 && browser != 'Microsoft Internet Explorer')
	{
		skipTabChange = 0;
		return;
	}
	if(tab == currentSelectedTab[tabset])
		return;

	if($('tabs_' + tabset + '_'+ tab))
	{
		$('tabs_' + tabset + '_' + tab).className = 'activeTab';
		$('tabbed_info_'+tabset+'_'+tab).style.display = 'block';
	}
	if($('tabs_' + tabset + '_'+ currentSelectedTab[tabset]))
	{
		$('tabs_' + tabset + '_'+ currentSelectedTab[tabset]).className = 'inactiveTabWithInfo';
		$('tabbed_info_'+tabset+'_'+currentSelectedTab[tabset]).style.display= 'none';		
	}
	
	
	currentSelectedTab[tabset] = tab;
	if(tabset == 5) 
	{
		if(tab != 0 && tab != 1)
		{
			if ($('SchoolProfileChartDiv')) {
				$('SchoolProfileChartDiv').style.display = 'block';
				UpdateSchoolProfileChart();
			}
		}
		else
		{
			if ($('SchoolProfileChartDiv')) {
				$('SchoolProfileChartDiv').style.display = 'none';
			}
		}
	}
	if(tabset == 2 || (tabset == 1 && tab == 1))
	{
		if(currentSelectedTab[2] == 0)
		{
			//Hide everything not needed
			$('ComparisonTab_1').style.display="none";
			$('CompareChartDiv').style.display="none";
			
			//Show what is needed
			$('ComparisonTab_0').style.display="block";
			$('BubbleChartDiv').style.display="block";
			//$('BubbleChartLegend').style.display="block";
			
			//Update Chart
			updateStudentProgressIndicators();
		}
		if(currentSelectedTab[2] == 1)
		{
			//Hide Everything not needed
			$('ComparisonTab_0').style.display="none";
			$('BubbleChartDiv').style.display="none";
			//$('BubbleChartLegend').style.display="none";
			
			//Show what is needed
			$('CompareChartDiv').style.display="block";
			$('ComparisonTab_1').style.display="block";
			
			//Update Chart
			updateAcademicPerformanceIndicators();
		}
	}
	if(tabset == 3 || (tabset == 1 && tab == 2))
	{
		if(currentSelectedTab[3] == 0)
		{
			//Hide everything not needed
			$('ProfileComparisonTab_1').style.display="none";
			
			//Show what is needed
			$('ProfileComparisonTab_0').style.display="block";
			$('CompareProfileChartDiv').style.display="block";
			
			//Update Chart
			updateFRLIndicators();
		}
		if(currentSelectedTab[3] == 1)
		{		
			//Hide everything not needed
			$('ProfileComparisonTab_0').style.display="none";
			
			//Show what is needed
			$('ProfileComparisonTab_1').style.display="block";
			$('CompareProfileChartDiv').style.display="block";
			
			//Update Chart
			updateEthnicityIndicators();	
		}
	}
}