function show_tab(tab_num){
	tab_name = "tab_" + tab_num;
	tab_content_name = "tab_content_" + tab_num;
	hide_all_tab_contents("tab_content_wrapper");
	reset_tabs();
	document.getElementById(tab_name).className = "current";
	show_div(tab_content_name);
}

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

function reset_tabs() {
	var li = document.getElementById("navlist").getElementsByTagName("a");
	for (var i = 0; i < li.length; i++) {
		li[i].className = "";
	}
}

function hide_all_tab_contents(content) {
	var tab_contents = getElementsByClassName(document.getElementById(content), "div", "tab_content");
	for (i=0; i<tab_contents.length; i++) {
		tab_contents[i].style.display = "none";
	}
}

function show_div(div){
	var element;
	if (document.getElementById) { 
		// this is the way the standards work
		element = document.getElementById(div).style;
	}
	else if (document.all) {
		// this is the way old msie versions work
		element = document.all[div].style;
	}
	else if (document.layers) {
		// this is the way netscape4 works
		element = document.layers[div].style;
	}
	element.display = "";
}

function hide_div(div){
	var element;
	if (document.getElementById) {
		// this is the way the standards work
		element = document.getElementById(div).style;
	}
	else if (document.all) {
		// this is the way old msie versions work
		element = document.all[div].style;
	}
	else if (document.layers) {
		// this is the way netscape4 works
		element = document.layers[div].style;
	}
	element.display = "none";
}