﻿function toggleTab(btn){	
	var tabId = btn.id.replace("btn","tab");
	var tab = document.getElementById(tabId);
	var tabCollection = tab.parentNode.childNodes;
	for(var i=0; i<tabCollection.length; i++){		
		if(tabCollection[i].id && tabCollection[i].id.indexOf("tab")>-1){						
			btn = document.getElementById(tabCollection[i].id.replace("tab","btn"));
			if(tab == tabCollection[i]){
				tabCollection[i].style.display = "block";
				btn.className = "TabButtonOn";
			} else {
				tabCollection[i].style.display = "none";
				btn.className = "TabButtonOff";
			}
		}
	}
}

function setTab(tabId){
	var tab = document.getElementById(tabId);
	if(tab){
		toggleTab(tab);
	}
}
