var tabs = [];
var tabContents = [];
window.onload = initOnLoad;
function initOnLoad() {
	tabs = document.getElementById('tabs').getElementsByTagName('li');
	var promtabContents = document.getElementById('tabs-cc').childNodes;
	for (var i=0;i<promtabContents.length;i++){
		if(promtabContents[i].tagName == 'DIV'){
			tabContents.push(promtabContents[i]);
		}
	}
	for (var i=0;i<tabs.length;i++){
		tabs[i].onclick = tabswitcher;
		tabs[i].onmouseover = tabhighlighter;
		tabs[i].onmouseout = tabunhighlighter;
	}
}
function tabswitcher() {
	if(!this.className.match(/currenttab/)){
		for(var i=0;i<tabs.length;i++){
			tabs[i].className = tabs[i].className.replace(/\bcurrenttab/);
		}
		this.className += ' currenttab';
		var currID;
		for (var i=0;i<tabs.length;i++){
			if (this === tabs[i]) {currID=i;}	
		}
		for(var i=0;i<tabContents.length;i++){
			tabContents[i].className = tabContents[i].className.replace(/\bvisible/);
		}
		tabContents[currID].className += ' visible';
		
	}
}

function tabhighlighter() {
	if(!this.className.match(/currenttab/)){
		this.className += ' sfhover';
	}
}

function tabunhighlighter() {
	this.className = this.className.replace(/\bsfhover/);
}
