var currNum=0;
var switcher = 0;
var currentTabContent = document.getElementById('TabContent'+currNum);

function switchTab(tab){

    switcher = 1;
    unlightTab(currNum);
    hightlightTab(tab);
    switcher = 0;

    identity=document.getElementById('center_tab_'+tab);
    if (!identity)
                return false;
    identity.className="TabSelectedCenter";

    //hide current content
    currentTabContent = document.getElementById('TabContent'+currNum); 
    currentTabContent.style.display = "none";

    //show new content
    TabContent = document.getElementById('TabContent'+tab);
    TabContent.style.display = ""; 

    // page header
    currentHeaderContent = document.getElementById('HeaderContent'+currNum);
    if (currentHeaderContent) {
	    currentHeaderContent.style.display = "none";

	    //show new content
	    HeaderContent = document.getElementById('HeaderContent'+tab);
	    HeaderContent.style.display = ""; 
    }

    currNum=tab;
}

function hightlightTab(tab){
//
// names: left_tab_, center_tab_, right_tab_
//
        if ((tab!=currNum) || (switcher == 1)){
		identity=document.getElementById('center_tab_'+tab);
		if (!identity)
                        return false;
		identity.className="TabNormalCenter TabSelectedCenter";

		tab_bottom = document.getElementById('tab_bottom_'+tab);
		if (tab_bottom) {
			tab_bottom.className = "TabSelectedBottom";
			if (tab == 0) {
				tab_bottom.className += " border-left";
			}
		}
	}
}


function unlightTab(tab){
//
// names: left_tab_, center_tab_, right_tab_
//
	if ((tab!=currNum) || (switcher == 1)){
		identity=document.getElementById('center_tab_'+tab);
		if (!identity)
                        return false;
		identity.className="TabNormalCenter";

		tab_bottom = document.getElementById('tab_bottom_'+tab);
		if (tab_bottom) {
			tab_bottom.className = "TabNormalBottom";
			if (tab == 0) {
				tab_bottom.className += " border-left";
			}
		}
	}

}

function openContent(id) {

//	opener = document.getElementById("opener"+id);
	box = document.getElementById("box"+id);

	if (!box) 
		return false;

	box.style.display = (box.style.display == "") ? "none" : "";
}

function closeContent(id) {

        box = document.getElementById("box"+id);

        if (!box)
                return false;

        box.style.display = "none";
}


function show_custom() {
	cust = document.getElementById("customize");
	if (!cust)
                return false;
	cust.style.display = "";

	_details = document.getElementById("details");
        if (!_details)
                return false;
	_details.style.display = "none";

	_tab_nav = document.getElementById("tab_nav");
        if (!_tab_nav)
                return false;
	_tab_nav.style.display = "none";
}

function show_details() {
	cust = document.getElementById("customize");
        if (!cust)
                return false;
	cust.style.display = "none";

	_details = document.getElementById("details");
        if (!_details)
                return false;
	_details.style.display = "";

	_tab_nav = document.getElementById("tab_nav");
        if (!_tab_nav)
                return false;
	_tab_nav.style.display = "";
}


switchTab(0);

