
function WeatherStation(source_url,direction_url){if(source_url==null)
source_url='json/weatherstation.php';if(direction_url==null)
direction_url='images/windIcons/';this.source_url=source_url;this.img_src=direction_url;this.name="Old Weatherstations";this.autoreload_timeout=60000;this.default_timeout=150;this.max_marker_count=300;this.marker_width=40;this.marker_height=18;this.MAX_READING_AGE=90*60;}
WeatherStation.prototype=new WfMarker();WeatherStation.prototype.LoadMarkers=function(request,json){GEvent.trigger(this,'beforeload',request);this.ClearMarkers();weatherstations=eval("("+request.responseText+")");var d=new Date();var marker_count=Math.min(weatherstations.length,this.max_marker_count);for(var i=0;i<marker_count;i++){var m=this.markers[i];var ws=weatherstations[i];var color='FFFFFF';if(ws.sensorTypeID==1){color='FFFF00';}
m.weatherstation=ws;m.latlng=new GLatLng(ws.lat,ws.lon);m.spd.innerHTML='';m.img.style.zIndex=0;if(ws.sensorTypeID==17){this.SetImageSrc(m.img,'g_flag.png');}else if(ws.sensorReadings.length){var rd=ws.sensorReadings[0];if(d.getTime()/1000-rd.datetime>this.MAX_READING_AGE){if(ws.wfOnly){this.SetImageSrc(m.img,'windMarker.pl?s=&d=-1&c='+color);}else{this.SetImageSrc(m.img,'windMarker.pl?s=&d=-1&c='+color);}
m.img.style.zIndex=0;}else{if(rd.direction==null||rd.direction==' ')
rd.direction='';if(ws.wfOnly){this.SetImageSrc(m.img,'windMarker.pl?s=&d='+rd.direction.toUpperCase()+'&c='+color);}else if(rd.average>=0){this.SetImageSrc(m.img,'windMarker.pl?s='+Math.round(rd.average)+'&d='+rd.direction.toUpperCase()+'&c='+color);m.img.style.zIndex=Math.round(rd.average);}}}else{this.SetImageSrc(m.img,'windMarker.pl?s=&d=-1&c='+color);}
this.SetPos(m);this.map_pane.appendChild(m.div);}
this.markerRequest=null;if(this.loadingControl)
this.loadingControl.Hide();GEvent.trigger(this,'afterload');}
WeatherStation.prototype.SetImageSrc=function(img,src){if(document.all){img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src='"+this.img_src+src+"')";img.src='http://mapper.weatherflow.com/images/windIcons/blank.gif';}else{img.src=this.img_src+src;}}
