//Changes the selected tab
function clickedTab(clickedId) {
	var classId = getElementClassAttributeName();
	
	//Try to access applicable elements of the page
	var tabs = null;
	var divs = null;
	try {
		tabs = document.getElementById("rvpanel").getElementsByTagName("li");
		divs = document.getElementById("leftSide").getElementsByTagName("div");
	} catch (e) {}
	
	//Set id and class values to those applicable elements
	if ((tabs != null) && (divs != null)) {
		for (var i = 1; i < tabs.length; i++) {
			//alert(i);
			var currentTab = tabs.item(i);
			var currentDiv = divs.item(i);
			if ((currentTab != null) && (currentDiv != null)) {
				if (i == clickedId) {
					
					currentDiv.className = 'visible';
					//currentTab.setAttribute("id", "current");
				} else {
					//currentTab.setAttribute("id", "");
					currentDiv.className = 'hidden';
				}
			}
		}
	}
}

function scrollDivToAnchor(a) {
	var b = document.getElementById(targBox);
	b.scrollTop = document.getElementById(a).offsetTop - b.offsetTop;

	// alternately, if your elements are not nested within other nodes inside the box,
	// you could use document.getElementById(a).parentNode.scrollTop
	// that way you wouldn't need to specify the id of the scrollable box
}

//Resets the first tab to be selected on page load
function initTabs() {
	var foundIt = false;
	var divID = getQueryVariable("divID");
	if ((divID != null) && (divID.length > 0)) { 
		var divs = document.getElementById("mainContainer").getElementsByTagName("div");
		if (divs != null) { 
			for (var i = 0; i < divs.length; i++) {
				var currentDiv = divs.item(i);
				if (currentDiv != null) { 
					if (divID == currentDiv.getAttribute("id")) { 
						showLayer(i);
						foundIt = true;
					}
				}
			}
		}
	}
	
	if (!foundIt) { clickedTab(0); }
}
