
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;}
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||ws.sensorTypeID==65){this.SetImageSrc(m.img,'sm_flag.png');}else if(ws.statusID==4){this.SetImageSrc(m.img,'../down.png');}else if(ws.sensorReadings.length){var rd=ws.sensorReadings[0];if(rd.direction==null||rd.direction==' ')
rd.direction='';
if(ws.statusID == 1){ if (ws.wfOnly) { this.SetImageSrc(m.img, 'windMarker.pl?s=&d=' + rd.direction.toUpperCase() + '&c=' + color); } else if (rd.average >= 0 && rd.average != null) { if(rd.direction != ''){ 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=' + Math.round(rd.average) + '&d=-1&c=' + color); } } else if (rd.average == null && rd.direction == '') { this.SetImageSrc(m.img, 'windMarker.pl?s=&d=-1&c=' + color); } }
else if(ws.statusID==7||rd.direction==''){if(rd.direction==''&&ws.statusID!=7){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);}}
else if(rd.direction!=''&&ws.statusID==7){if(rd.average!=null&&rd.average!=''){avgout=Math.round(rd.average);}
else{avgout='';}
if(ws.wfOnly){this.SetImageSrc(m.img,'windMarker.pl?s=&d='+rd.direction.toUpperCase()+'&c=7A7C77&sh=0');}else if(rd.average>=0){this.SetImageSrc(m.img,'windMarker.pl?s='+avgout+'&d='+rd.direction.toUpperCase()+'&c=7A7C77&sh=0');m.img.style.zIndex=Math.round(rd.average);}}
else{if(ws.wfOnly){this.SetImageSrc(m.img,'windMarker.pl?s=&d=-1&c=7A7C77&sh=0');}else{this.SetImageSrc(m.img,'windMarker.pl?s=&d=-1&c=7A7C77&sh=0');}}}}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;}}
