function Tab(tabEnd,tabText) {
	this.TabEnd = tabEnd;
	this.TabText = tabText;
}

function WWWCommTabs(name,tabCount) {
	this.tabArray = new Array();
	this.TabCount = tabCount;

	WWWCommTabs.prototype.TabSelected = null;
	WWWCommTabs.prototype.OnSelectTab = OnSelectTab;
	this.SelectedTab = 1;

	for( var ct = 1; ct <= this.TabCount; ct++)
	{	
		var currentTabEnd = document.getElementById('tab' + ct + '_end');
		var currentTabText = document.getElementById('tab' + ct + '_text');
		this.tabArray[ct] = 	new Tab(currentTabEnd,currentTabText);
	}
}

function OnSelectTab(selectedTab) {
	if (selectedTab != this.SelectedTab)
	{
		var currentTab = this.tabArray[selectedTab];
		var previousTab = this.tabArray[this.SelectedTab];
		
		currentTab.TabEnd.className = 'selectedend';
		currentTab.TabText.className = 'selectedbody';
		previousTab.TabEnd.className = 'deselectedend';
		previousTab.TabText.className = 'deselectedbody';
		
		this.SelectedTab = selectedTab;
	}
	
	if (this.TabSelected != null)
	{
		this.TabSelected(selectedTab);
	}
}
