﻿// JScript File

function window_onload()
{
	var x
	if (x != 1)
	{
		SetTab( getQueryVariable("tab") );
		x = 1;
	}
}

function getQueryVariable(variable)
{
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++)
	{
		var NO_VARIABLE = 'Tab1';
		var pair = vars[i].split("=");
		if (pair[0] == variable)
		{
			return pair[1];
		}
		else
		{
			return NO_VARIABLE;
		}
	}
}

function SetTab(variable)
{
	var ActiveTabBorderStyle = 'solid';
	var ActiveTabeBorderColor = '#ddd8b5';
	var ActiveTabBorderWidth = '1px';
	var InactiveTabBorderStyle = 'solid';
	var InactiveTabBorderColor = '#afafa5';
	var InactiveTabBorderWidth = '1px';
	
	var UNSELECTED_COLOR = '#ffffff';
	var SELECTED_COLOR = '#f8f6e8';
	var Tab1 = document.getElementById('Tab1')
	var Tab2 = document.getElementById('Tab2')
	
	// RESET ALL TABS TO A DEFAULT STYLE
	Tab1.style.backgroundColor = UNSELECTED_COLOR;
	Tab1.style.fontWeight = 'normal';
	Tab1.style.color = '#000000';
	
	Tab2.style.backgroundColor = UNSELECTED_COLOR;
	Tab2.style.fontWeight = 'normal';
	Tab2.style.color = '#000000';
	
	if (variable == 'Tab2')
	{
		Tab2.style.backgroundColor = SELECTED_COLOR;
		Tab2.style.fontWeight = 'bolder';
		Tab2.style.color = '#000000';
		
		// SET MOUSE CURSOR LOOK
		Tab1.style.cursor = 'hand';
		Tab2.style.cursor = 'default';
		
		// SET THE PANELS TO BE HIDDEN OR DISPLAYED
		document.getElementById('PanelForTab1').style.display = 'none';
		document.getElementById('PanelForTab2').style.display = '';
		
		// SET TAB LOOK
		Tab2.style.borderRightStyle=Tab2.style.borderLeftStyle=Tab2.style.borderTopStyle = ActiveTabBorderStyle;
		Tab2.style.borderRightColor=Tab2.style.borderLeftColor=Tab2.style.borderTopColor = ActiveTabeBorderColor;
		Tab2.style.borderRightWidth=Tab2.style.borderLeftWidth=Tab2.style.borderTopWidth = ActiveTabBorderWidth;
		Tab2.style.borderBottomStyle=Tab2.style.borderBottomColor=Tab2.style.borderBottomWidth = '';
		
		document.getElementById('Tab1').style.borderRightStyle=Tab1.style.borderLeftStyle=Tab1.style.borderTopStyle = InactiveTabBorderStyle;
		document.getElementById('Tab1').style.borderRightColor=Tab1.style.borderLeftColor=Tab1.style.borderTopColor = InactiveTabBorderColor;
		document.getElementById('Tab1').style.borderRightWidth=Tab1.style.borderLeftWidth=Tab1.style.borderTopWidth = InactiveTabBorderWidth;
		document.getElementById('Tab1').style.borderBottomStyle = 'solid';
		document.getElementById('Tab1').style.borderBottomColor = '#ddd8b5';
		document.getElementById('Tab1').style.borderBottomWidth = '1px';
	}
	else
	{
		Tab1.style.backgroundColor = SELECTED_COLOR;
		Tab1.style.fontWeight = 'bolder';
		Tab1.style.color = '#000000';
		
		// SET MOUSE CURSOR LOOK
		Tab1.style.cursor = 'default';
		Tab2.style.cursor = 'hand';
	
		// SET THE PANELS TO BE HIDDEN OR DISPLAYED
		document.getElementById('PanelForTab1').style.display = '';
		document.getElementById('PanelForTab2').style.display = 'none';
		
		// SET TAB LOOK
		Tab1.style.borderRightStyle=Tab1.style.borderLeftStyle=Tab1.style.borderTopStyle = ActiveTabBorderStyle;
		Tab1.style.borderRightColor=Tab1.style.borderLeftColor=Tab1.style.borderTopColor = ActiveTabeBorderColor;
		Tab1.style.borderRightWidth=Tab1.style.borderLeftWidth=Tab1.style.borderTopWidth = ActiveTabBorderWidth;
		Tab1.style.borderBottomStyle=Tab1.style.borderBottomColor=Tab1.style.borderBottomWidth = '';
		
		Tab2.style.borderRightStyle=Tab2.style.borderLeftStyle=Tab2.style.borderTopStyle = InactiveTabBorderStyle;
		Tab2.style.borderRightColor=Tab2.style.borderLeftColor=Tab2.style.borderTopColor = InactiveTabBorderColor;
		Tab2.style.borderRightWidth=Tab2.style.borderLeftWidth=Tab2.style.borderTopWidth = InactiveTabBorderWidth;
		Tab2.style.borderBottomStyle = 'solid';
		Tab2.style.borderBottomColor = '#ddd8b5';
		Tab2.style.borderBottomWidth = '1px';
	}
}
