// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function getPortList(state) {
		new Ajax.Request('getPortForState.php?s=' + state, {
			 method: 'post',
			 onLoading: function(showSpinner){
					//Element.show($('state_spinner')); 
			 },
			 onSuccess: function(request){
					console.log(request);
					result = request.responseText;
					//Element.hide($('state_spinner'));
					$('port_list').update(result);
			 },
			 onFailure: function(transport){ 
				alert("Network error: could not establish a connection. Please try again."); 
			}
		})
	
	return false;
}

function updateWidget(location) {
	if(location != "") {
		new Ajax.Updater('widget', '/includes/widget.php?p=' + location, { });
		return false;
	}
}
