/**
* script door Laura Drewes
* vervangt de yui scripts
* 31-03-2010
* 
* function to show the current tab
* triggered when a tab is hit
* changing class van tab en van inner
*/

function showTab(tabName, insertName){
	//de div die getoond moet worden
	var showDiv = window.document.getElementById(insertName);
	//huidige inserts resetten
	hideInserts(showDiv.parentNode);
	//nieuwe insert active maken
	showDiv.className = 'inner active';
	
	//de tab die actief moet worden
	var showTab = window.document.getElementById(tabName);
	//huidige tabs resetten
	hideTabs(showTab.parentNode);
	//nieuwe tab active maken
	showTab.className = "selected";
}

/**
* function to hide all tabs 
* met class selected 
*/
function hideTabs(div){
	//alert('hideTabs ' + div.className);

	var elems = div.getElementsByTagName('li');
	var len = elems.length;
	
	var thisElem;
	for (var i = 0; i < len; i++)
	{
	  thisElem = elems[i];
	  if (thisElem.className == 'selected')
	  {
		thisElem.className = "inactive";
	  }
	}
	return;
}


/**
* function to hide all divs 
* met class active 
*/
function hideInserts(div){
	//alert('hideInserts ' + div);
	className = div.className.replace("inner active", "inner hidden");
	div.className = className;
	
	var divs = div.getElementsByTagName("DIV");
	var len = divs.length;
	var thisDiv, thisDivID;
	for (var i = 0; i < len; i++)
	{
	  thisDiv = divs[i];
	  if (thisDiv.className == 'inner active')
	  {
		thisDiv.className = "inner hidden";
	  }
	}
	return;
}
