// JavaScript Document

var getContent = new HtmlRequestObject();
var getContent2 = new HtmlRequestObject();

function reloadData(inDiv, inURL, inForm, postFunctions, inChannel) {
	
	stid = '';
	
	if(inForm) {
		stid = inForm.stid.options[inForm.stid.selectedIndex].value;
		stid = 'stid=' + stid;
	}
	
	if (inChannel == 2) {	
		if (postFunctions) { 
			getContent2.runAfterProcessingRequest = function() { eval( postFunctions ); }
		}
		getContent2.ProcessRequest(inDiv, inURL, stid, 'POST');	
			
	} else {
		if (postFunctions) { 
			getContent.runAfterProcessingRequest = function() { eval( postFunctions ); }
		}		
		getContent.ProcessRequest(inDiv, inURL, stid, 'POST');		
	}

}

function showDiv(inDiv, inVis)
{
	document.getElementById(inDiv).style.visibility = inVis;
}


function postDiv()
{
	showDiv('station_select_list','hidden');
}


function changeWeatherStation(inForm)
{	
	postFunctions = "showText('station_select_list_pu')";
	reloadData('data_area_pu', '/includes/current_wx_pop_up.php', inForm, postFunctions, 1);
}

function changeWeatherStation2(inForm, inType)
{	
	stid = inForm.stid.options[inForm.stid.selectedIndex].value;
	
	vars = 'stid=' + stid + '&product=' + inType;
	getContent2.ProcessRequest('graph_area', '/tools/wx_graph.php', vars, 'POST');	

}

function showText(inDiv)
{
	document.getElementById(inDiv).style.visibility = "visible";
}

function hideText(inDiv)
{
	document.getElementById(inDiv).style.visibility = "hidden";
}

setInterval(init,300000);