var currentTabID;

function changeTab(tabID) 
{    
	var previousTab;
	var tabLeft;
	var tabMiddle;
	var tabRight;
	var previousTabContent;
	var tab;
	var content;
	
	if (currentTabID == null){
	    previousTab = document.getElementById('1');
	    previousTabContent = document.getElementById('c1'); //this is the default tab
	    currentTabID = '1';
	} else {
	    previousTab = document.getElementById(currentTabID);
	    previousTabContent = document.getElementById('c' + currentTabID);
    }
    if (currentTabID == tabID) return;
    
    if (previousTab == null)return;
    if (previousTabContent == null) return;
    
    previousTab.className = 'ngoTabInactive textBold';
    tabLeft = document.getElementById('l' + currentTabID);
    tabRight = document.getElementById('r' + currentTabID);
    tabMiddle = document.getElementById('m' + currentTabID);
    if (tabLeft != null && tabRight != null && tabMiddle != null)
    {
        tabLeft.className = 'ngoTabInactiveLeft';
        tabRight.className = 'ngoTabInactiveRight';
        tabMiddle.className = 'ngoTabInactiveMiddle';
    }
    previousTabContent.style.display = 'none';
    
	tab = document.getElementById(tabID);
	content = document.getElementById('c' + tabID);
	if (tab == null) return;
	if (content == null) return;
	
	tab.className = 'ngoTabActive textBold';
	tabLeft = document.getElementById('l' + tabID);
    tabRight = document.getElementById('r' + tabID);
    tabMiddle = document.getElementById('m' + tabID);
    if (tabLeft != null && tabRight != null && tabMiddle != null)
    {
        tabLeft.className = 'ngoTabActiveLeft';
        tabRight.className = 'ngoTabActiveRight';
        tabMiddle.className = 'ngoTabActiveMiddle';
    }
    content.style.display = 'block';
    currentTabID = tabID;

}
function onLoadTab()
{
    var url = window.location.href;
    var tabLeft;
    var tabRight;
    var tabMiddle;
    var pound = url.indexOf('#c');
    var activeTab = 1;
    if (pound > 0)
    {
        activeTab = url.substring(pound+2);
    }
    
    for(var i=0; i<idArray.length; i++){
        if (i != activeTab-1){
            element = document.getElementById(idArray[i]);
            if (element != null) {
                element.style.display = 'none';
             }
        } else {
            changeTab(activeTab);
         }
    }
}