function runWidget(){
	//Check to make sure there is a valid date
	if(document.getElementById('start_date') && document.getElementById('start_date').value && checkValidDate(document.getElementById('start_date').value) == 1){
		//Good to go
		var widgetYmd=dateConvertm_d_Y_to_Ymd(document.getElementById('start_date').value);
	}
	else{
		//Invalid date
		alert("Please specify a valid date in MM/DD/YYYY format (ex. 01/20/2009)");
		return;
	}
	
	//Get the location
	if(document.getElementById('text') && document.getElementById('text').value && document.getElementById('text').value.length >= 1){
		var location=document.getElementById('text').value;
	}
	else{
		//No location entered
		alert("Please specify a valid location");
		return;
	}
	
	//What type of location are we dealing with?
	var locationType="";
	
	if(checkValidZip(location) == 1){
		locationType="zipcode";
	}
	else if(checkValidLocation(location) == 1){
		locationType="station";
	}
	else{
		alert("Invalid format");
		return
	}
	
	var src_url="/ajax/widget_data.php?l="+location+"&d="+widgetYmd+"&type="+locationType;
	src_url=encodeURI(src_url);
	$('#widget_div').load(src_url);
	
	return;
}

function checkValidZip(zip){
  var valid_zip_regexp=/^(\d{5})$/;
  
  if(valid_zip_regexp.test(zip)){ return 1; }
  
  return;
}

function checkValidLocation(location){
  
  var valid_loc_regexp=/^([a-zA-Z'\.\s,-]+)$/;
  var valid_loc_regexp_chk_1=/^([a-zA-Z'\.\s,-]+),[a-zA-Z'\.\s,]+$/;
  var valid_loc_regexp_chk_2=/^([a-zA-Z'\.\s,-]+),[a-zA-Z'\.\s,]+,[a-zA-Z'\.\s,]+$/;

  if(valid_loc_regexp.test(location)){ return 1; }
  if(valid_loc_regexp_chk_1.test(location)){ return 1; }
  if(valid_loc_regexp_chk_2.test(location)){ return 1; }

  return;
}

function loadLocationOption(url){
	url=encodeURI(url);
	$('#widget_div').load(url);
	return;
}