function tabNav(sKey) {
	sBaseLocation = getDocumentBaseLocation();
	document.location.href = sBaseLocation + "#" + sKey;
	setTab();
}

var sCurrTabKey;
function setTab() {
	var sAnchorSection = getAnchorSection();
	var oTab = document.getElementById("Tab" + sAnchorSection);
	var oContent = document.getElementById("BestCities" + sAnchorSection);
	var oCurrTab, oCurrContent;
	
	if ( sCurrTabKey ) {
		oCurrTab = document.getElementById("Tab" + sCurrTabKey);
		oCurrContent = document.getElementById("BestCities" + sCurrTabKey);
		
		oCurrTab.className = "tab";
		oCurrContent.className = 'bestCitiesTab';
	}
	
	oTab.className = "tab current";
	oContent.className = 'bestCitiesTab active';
	sCurrTabKey = sAnchorSection;
}

function getAnchorSection() {
	var sLoc = new String(window.location.href);
	var sLocParts;
	
	if ( sLoc.search(/\#/) < 0 ) return sDefaultTabSection;
	
	sLocParts = sLoc.split('#');
	
	return sLocParts[1];
}

function getDocumentBaseLocation() {
	var sLoc = new String(window.location.href);
	var sLocParts;
	
	if ( sLoc.search(/\#/) < 0 ) return sLoc;
	
	sLocParts = sLoc.split('#');
	
	return sLocParts[0];
}

