/**
 * Changes the active language to a new value. The browser will redirect to the 
 * same page, but with the new language.
 */
function setLanguage(base, page, language) {
	window.location = base + page + '/' + language + '/';
}

/**
 * Changes the visibility of the element with the specified ID.
 */
function setVisible(elementID, visible) {
	var element = document.getElementById(elementID);
	element.style.display = visible ? 'block' : 'none';
}

/**
 * Makes the element with the name tabX visible, and all other tab elements
 * invisible.
 */
function setVisibleTab(tabNumber) {
	for (var i = 0; i < 20; i++) {
		if (document.getElementById('tab' + i) == null) {
			continue;
		}
		setVisible('tab' + i, tabNumber == i);
	}
}

/**
 * Invoked when a screenshot tab on the product page is clicked. This method is
 * intentionally different from the tabs in the other pages, since they work in
 * slightly different ways.
 */
function toggleProductScreenshot(index) {
	for (var i = 0; i < 3; i++) {
		var active = (index == i);
		document.getElementById('screenshot' + i).style.display = active ? 'block' : 'none';
		document.getElementById('screenshotB' + i).className = active ? 'screenshotButtonActive' : 'screenshotButtonInactive';
	}
}

