function cnnShowSelectWeatherLocation(fromLink,toSelect) {
	document.getElementById(fromLink).style.display = 'none';
	document.getElementById(toSelect).style.display = 'block';
}

function cnnShowSelectWeatherSelectBoxes(Selected) {
	document.getElementById(Selected).style.display = 'block';
}

function cnnHideCityMatches(id) {
	if (document.getElementById && document.getElementById(id) && document.getElementById(id).style) {
			 document.getElementById(id).style.visibility="hidden";
			 document.getElementById(id).style.display="none";
	};
}

function cnnShowCityMatches(id) {
	if (document.getElementById &&  document.getElementById(id) && document.getElementById(id).style) {

			 document.getElementById(id).style.visibility="visible";
			 document.getElementById(id).style.display="block";
			 
			 document.getElementById('cnnWeatherRegionBox').style.display="none";
			 document.getElementById('cnnWeatherStateBox').style.display="none";
			 document.getElementById('cnnWeatherCityBox').style.display="none";
			
	}; 
	
	document.getElementById('cnnFindWeatherMoreOptions').style.display="block";
	return false;
}

function CNN_changeMap(el,url) { //url argument was intended for making XHR request, I don't know how we're planning on building these from the back end. It may be as simple as including SSI's in the divs below and just showing and hiding the div. If we need to add the ability to make an XHR request to fetch the data that should be trivial to do assuming there aren't cross domain issues to tackle.
	try {
		cnnCheckTab(el.parentNode);
	} catch(e) {};
}

function cnnCheckTab(tabID){
	var tabContainer = $('cnnTabHeader').getElementsBySelector('div');
	var maps = $('cnnWeatherMaps').getElementsBySelector('div');		
	var tabs = $$('div#cnnTabNav li');
	var firstTab = tabs[0]
	var lastTab = tabs[tabs.length - 1];
	if (tabID == firstTab) {
		$(tabID).className = "currentLeft";
	} else if (tabID == lastTab) {
		$(tabID).className = "currentRight";
	} else {
		$(tabID).className = "current";
	}
	for (var i = 0; i<tabs.length; i++) {
		if (tabs[i] != tabID && ($(tabs[i]).className != '')) {
			if (i == 0) {
				$(tabs[i]).className = 'cnn2pxLeftPad';
			} else {
				$(tabs[i]).className = '';
			}
			try {
				$(maps[i]).className = 'cnnInactiveMap';	
			} catch(e) {};
		} else if(tabs[i] == tabID) {
			$(tabContainer[0]).className = 'cnnTab'+i;
			try {
				$(maps[i]).className = '';
			} catch(e) {};
		}
	}
}