var map;
var arrStationDataAll;//coantains all the records of all the stations separated by "|".
var arrStationDataIndividual;//contains individual records split by "/" for separating all field values of each station.
var la;
var lo;
var strStationData;
var strLocation="";
var RainGaugeData;
function initialize(gstrStationData,gla,glo,WeatherVariable, strLoc)
{
    strLocation=strLoc;
    strStationData=gstrStationData;
    la=gla;
    lo=glo;
  	if (GBrowserIsCompatible())
	{
		map= new GMap2(document.getElementById("map_canvas"));                
		var mapControl = new GMapTypeControl();                                             
		map.addControl(mapControl); 
		map.addControl(new GLargeMapControl());
		map.setCenter(new GLatLng(la,lo), 13);
		map.setMapType(G_HYBRID_MAP);
		if(strLocation != "douglasco")
		{
	    	map.setZoom(7); 
		}
		else
		{
		   map.setZoom(9); 
		}
    	createOverlay(WeatherVariable,strStationData);   
	}
}

function initializeRainGaugeData(gstrStationData,gla,glo,WeatherVariable, strLoc,strRainGaugeData)
{
    strLocation=strLoc;
    strStationData=gstrStationData;
    RainGaugeData=strRainGaugeData;
    
    la=gla;
    lo=glo;

	if (GBrowserIsCompatible())
	{
	  map= new GMap2(document.getElementById("map_canvas"));       
	  // new code for outline the douglas county
	  map.setCenter(new GLatLng( 39.358711,-104.988885), 13);    
      map.addControl(new GMapTypeControl());
      map.addControl(new GLargeMapControl());
      map.addControl(new GScaleControl());
      map.setMapType(G_HYBRID_MAP);
      map.setZoom(7);
      
      
     var polygon = new GPolyline([new GLatLng( 39.56602 , -105.04867),
     new GLatLng(39.12969 , -105.32883),    
     new GLatLng(39.12981 , -104.66374),    
     new GLatLng(39.5656 , -104.66013),
     new GLatLng(39.56602 , -105.04867)     
     ], "#0000ff", 5);
    
     map.addOverlay(polygon);
     //end of new code	
      createOverlay(WeatherVariable,strStationData); 
      map.setZoom(10);
   	}
}
// ====================RainGauge===========
function createOverlayRainGauge(RainGaugeData)
{
     // new code for outline the douglas county
	  map.setCenter(new GLatLng( 39.358711,-104.988885), 13);  
      map.addControl(new GMapTypeControl());
      map.addControl(new GLargeMapControl());
      map.addControl(new GScaleControl());
      map.setMapType(G_HYBRID_MAP);
      map.setZoom(10);
      
      var polygon = new GPolyline([new GLatLng( 39.56602 , -105.04867),
     new GLatLng(39.12969 , -105.32883),    
     new GLatLng(39.12981 , -104.66374),    
     new GLatLng(39.5656 , -104.66013),
     new GLatLng(39.56602 , -105.04867)
     ], "#0000ff", 5);
    
     map.addOverlay(polygon);
	 //end of new code
  try
	{ 	
	 var arrRainGaugeDataAll =RainGaugeData.split("|");
	 for(i=0;i<arrRainGaugeDataAll.length-1;i++)
	 { 
	    var arrRainGaugeDataIndividual=arrRainGaugeDataAll[i].split("^")
		var StationID=arrRainGaugeDataIndividual[0];	
		var StationName=arrRainGaugeDataIndividual[1];
		var DisplayName=arrRainGaugeDataIndividual[2];
		var City=arrRainGaugeDataIndividual[3];
		var State=arrRainGaugeDataIndividual[4];
		var County=arrRainGaugeDataIndividual[5];
		var Zipcode=arrRainGaugeDataIndividual[6];
		var Latitude=arrRainGaugeDataIndividual[7];	
		var Longitude=arrRainGaugeDataIndividual[8];	
		var MeasurementDate=arrRainGaugeDataIndividual[9];
		var StartDate1 =new Date(MeasurementDate);
        var EndDate1=new Date();
        EndDate1.setDate(EndDate1.getDate()-30);
        if(StartDate1 > EndDate1)
        {
          if(Latitude !="" && Longitude !="")
	      {
	          var latlng = new GLatLng(Latitude,Longitude);
	  	      var Last10Min=arrRainGaugeDataIndividual[10];
			  var Last1Hr=arrRainGaugeDataIndividual[11];
			  var Last6Hrs=arrRainGaugeDataIndividual[12];
			  var Last12Hrs=arrRainGaugeDataIndividual[13];
			  var Last24Hrs=arrRainGaugeDataIndividual[14];
			  var Last7Days=arrRainGaugeDataIndividual[15];
			  var Last21Days=arrRainGaugeDataIndividual[16];
			  map.addOverlay(createMarkerRainGaugeData(latlng,StationID,StationName,DisplayName,City,State,County,Zipcode,Latitude,Longitude,MeasurementDate,Last10Min,Last1Hr,Last6Hrs,Last12Hrs,Last24Hrs,Last7Days,Last21Days));
		 } 							
    }
   	//end
 }
}
catch(e) {alert(e.message);}
}
			
function createMarkerRainGaugeData(point,StationID,StationName,DisplayName,City,State,County,Zipcode,Latitude,Longitude,MeasurementDate,Last10Min,Last1Hr,Last6Hrs,Last12Hrs,Last24Hrs,Last7Days,Last21Days)
{  
  document.getElementById('lblWeatherVariable').innerText='RainGauge Data';
  document.getElementById('lblWeatherVariable').textContent='RainGauge Data';
  var icon = new GIcon();
  icon.image = 'images/gmapicons/raingauge.png';
  icon.iconSize = new GSize(DisplayName.length*7.5,32);
  icon.iconAnchor = new GPoint(16, 16);
  icon.infoWindowAnchor = new GPoint(DisplayName.length*3.5, 7);
  opts = { 
					"icon": icon,
					"clickable": true,
					"title": DisplayName,
					"labelText": "<table border='0' cellpadding='0' cellspacing='0'  style='font-size:8pt; width:100%;white-space:nowrap;font-color:gray; text-align:center;'><tr><td>" + DisplayName +  "</td></tr></table>" ,
					"labelOffset": new GSize(-6, -10)
					};
					var marker = new LabeledMarker(point, opts);
					GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml("<table border='0' style='font-size:8pt;font-color:gray;width:200pt;text-align:left;'><tr><td>" +"StationID : " + StationID + "</td></tr><tr><td>" +"StationName : " + StationName + "</td></tr><tr><td>" + "Display Name : " + DisplayName + "</td></tr><tr><td>" +"City : " + City + "</td></tr><tr><td>" +"State : " + State + "</td></tr><tr><td>" +"County : " + County + "</td></tr><tr><td>" +"Zipcode : " + Zipcode + "</td></tr><tr><td>" + "Latitude : " + Latitude + "</td></tr><tr><td>" + "Longitude : " + Longitude + "</td></tr><tr><td>" + "MesurementDate : " + MeasurementDate + "</td></tr><tr><td>" + "Last10Min : " + Last10Min + "</td></tr><tr><td>" + "Last1Hr : " + Last1Hr + "</td></tr><tr><td>" + "Last6Hrs : "  + Last6Hrs + "</td></tr><tr><td>" + "Last12Hrs : " + Last12Hrs + "</td></tr><td>" + "Last24Hrs : " + Last24Hrs + "</td></tr><tr><td>" + "Last7Days : " + Last7Days + "</td></tr><tr><td>" + "Last21Days : " + Last21Days + "</td></tr></table>");
					});
					return marker;
		 }
// ====================RainGauge===========
function LabeledMarker(latlng, opt_opts){
  this.latlng_ = latlng;
  this.opts_ = opt_opts;

  this.labelText_ = opt_opts.labelText || "";
  this.labelClass_ = opt_opts.labelClass || "LabeledMarker_markerLabel";
  this.labelOffset_ = opt_opts.labelOffset || new GSize(0, 0);
  
  this.clickable_ = opt_opts.clickable || true;
  this.title_ = opt_opts.title || "";
  this.labelVisibility_  = true;
   
  if (opt_opts.draggable) {
  	// This version of LabeledMarker doesn't support dragging.
  	opt_opts.draggable = false;
  }
  GMarker.apply(this, arguments);
}

LabeledMarker.prototype = new GMarker(new GLatLng(0, 0));
LabeledMarker.prototype.initialize = function(map) {
  // Do the GMarker constructor first.
  GMarker.prototype.initialize.apply(this, arguments);
  
  this.map_ = map;
  this.div_ = document.createElement("div");
  this.div_.className = this.labelClass_;
  this.div_.innerHTML = this.labelText_;
  this.div_.style.position = "absolute";
  this.div_.style.cursor = "pointer";
  this.div_.title = this.title_;
  
  map.getPane(G_MAP_MARKER_PANE).appendChild(this.div_);

  if (this.clickable_) {
   
    function newEventPassthru(obj, event) {
      return function() { 
        GEvent.trigger(obj, event);
      };
    }
  
    // Pass through events fired on the text div to the marker.
    var eventPassthrus = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout'];
    for(var i = 0; i < eventPassthrus.length; i++) {
      var name = eventPassthrus[i];
      GEvent.addDomListener(this.div_, name, newEventPassthru(this, name));
    }
  }
}
LabeledMarker.prototype.redraw = function(force) {
GMarker.prototype.redraw.apply(this, arguments);
// Calculate the DIV coordinates of two opposite corners of our bounds to
// get the size and position of our rectangle
var p = this.map_.fromLatLngToDivPixel(this.latlng_);
var z = GOverlay.getZIndex(this.latlng_.lat());
// Now position our div based on the div coordinates of our bounds
this.div_.style.left = (p.x + this.labelOffset_.width) + "px";
this.div_.style.top = (p.y + this.labelOffset_.height) + "px";
this.div_.style.zIndex = z; // in front of the marker
}
LabeledMarker.prototype.remove = function() {
GEvent.clearInstanceListeners(this.div_);
if (this.div_.outerHTML) {
    this.div_.outerHTML = ""; //prevent pseudo-leak in IE
  }
  if (this.div_.parentNode) {
    this.div_.parentNode.removeChild(this.div_);
  }
  this.div_ = null;
  GMarker.prototype.remove.apply(this, arguments);
}
LabeledMarker.prototype.copy = function() {
  return new LabeledMarker(this.latlng_, this.opt_opts_);
}

LabeledMarker.prototype.show = function() {
  GMarker.prototype.show.apply(this, arguments);
  if (this.labelVisibility_) {
    this.showLabel();
  } else {
    this.hideLabel();
  }
}

LabeledMarker.prototype.hide = function() {
  GMarker.prototype.hide.apply(this, arguments);
  this.hideLabel();
}
LabeledMarker.prototype.setLabelVisibility = function(visibility) {
  this.labelVisibility_ = visibility;
  if (!this.isHidden()) { // Marker showing, make visible change
    if (this.labelVisibility_) {
      this.showLabel();
    } else {
      this.hideLabel();
    }
  }
}


/**
 * Returns whether label visibility is set on.
 * @return {Boolean}  
 */
LabeledMarker.prototype.getLabelVisibility = function() {
  return this.labelVisibility_;
}


/**
 * Hides the label of the marker.
 */
LabeledMarker.prototype.hideLabel = function() {
  this.div_.style.visibility = 'hidden';
}


/**
 * Shows the label of the marker.
 */
LabeledMarker.prototype.showLabel = function() {
  this.div_.style.visibility = 'visible';
}
//---------
function m()
{
					
        			//<%CreateStateMap()%>;
					//var strStationData='<%=strStationAllData%>';	
					//alert('strStationData');
}
function initializeVariableLink(WeatherVariable)
{  
   map= new GMap2(document.getElementById("map_canvas"));
   if (GBrowserIsCompatible())
   {
      if(strLocation != "douglasco")
      { 
          var ZoomLevel=map.getZoom();
	      var mapControl = new GMapTypeControl();                                             
	      map.addControl(mapControl); 
	      map.addControl(new GLargeMapControl());
	      map.setCenter(new GLatLng(la,lo), 13);
	      map.setMapType(G_HYBRID_MAP);
	      map.setZoom(7); 
	      createOverlay(WeatherVariable,strStationData);  
	    
	     /* map.setCenter(new GLatLng(la,lo), 13);    
         map.addControl(new GMapTypeControl());
         map.addControl(new GLargeMapControl());
         map.addControl(new GScaleControl());
         map.setMapType(G_HYBRID_MAP);
         map.setZoom(7);
         alert(WeatherVariable); 
	     createOverlay(WeatherVariable,strStationData); */ 
      }
      else
      {
         // new code for outline the douglas county
	      map.setCenter(new GLatLng( 39.358711,-104.988885), 13); 
         map.addControl(new GMapTypeControl());
         map.addControl(new GLargeMapControl());
         map.addControl(new GScaleControl());
         map.setMapType(G_HYBRID_MAP);
         map.setZoom(10);
      
      var polygon = new GPolyline([new GLatLng( 39.56602 , -105.04867),
     new GLatLng(39.12969 , -105.32883),    
     new GLatLng(39.12981 , -104.66374),    
     new GLatLng(39.5656 , -104.66013),
     new GLatLng(39.56602 , -105.04867)
     ], "#0000ff", 5);
    
        map.addOverlay(polygon);
	   //end of new code
	 
      }
      
     	 
	 if(WeatherVariable != "RainGaugeData")
	 {
	   createOverlay(WeatherVariable,strStationData);  
	 }
	 else
	 {
	    createOverlayRainGauge(RainGaugeData);
	 }
	 				
	}
}
    
function createOverlay1(strStationData)
{				
	arrStationDataAll= strStationData.split("|");
	for(var i=0;i<arrStationDataAll.length;i++)
	{
		arrStationDataIndividual=arrStationDataAll[i].split("^")
	    var la=arrStationDataIndividual[0];
		var lo=arrStationDataIndividual[1];							
		createMarker(la,lo);                       
	}
						
}


            function createOverlay(WeatherVariable,strStationData)
            {
            
            try
            {
              arrStationDataAll= strStationData.split("|");
              for(var i=0;i<arrStationDataAll.length;i++)
              {
                        arrStationDataIndividual=arrStationDataAll[i].split("^")
                        var la=arrStationDataIndividual[0];
                        var lo=arrStationDataIndividual[1];
                        var latlng = new GLatLng(la,lo);
                        var StationID=arrStationDataIndividual[2];
                        if(StationID==null)
                            StationID="-";
                        var Temperature=arrStationDataIndividual[3];
                        if(Temperature==null)
                            Temperature="-";    
                        var wind=arrStationDataIndividual[4];
                        if(wind==null)
                            wind="-";
                        var gust=arrStationDataIndividual[5];
                        if(gust==null)
                            gust="-";
                        var Humidity=arrStationDataIndividual[6];
                        if(Humidity==null)
                            Humidity="-"
                        var DewPoint=arrStationDataIndividual[7];
                        if(DewPoint==null)
                            DewPoint="-"
                        var RainfallSinceMidNight=arrStationDataIndividual[8];
                        if(RainfallSinceMidNight==null)
                            RainfallSinceMidNight="-";
                        var strTime=arrStationDataIndividual[9];
                        if(strTime==null)
                            strTime="-";
                        var strStationName=arrStationDataIndividual[10];
                        if(strStationName==null)
                            strStationName="-";
                            //alert(strStationName);
                        var strCity=arrStationDataIndividual[11];
                        if(strCity==null)
                            strCity="-";
                        var strLink=arrStationDataIndividual[12];
                        if(strLink==null)
                            strLink="-";
                        var strMarkerColor=arrStationDataIndividual[13]; 
                         var x=arrStationDataIndividual[14];  
                         var baromericPressure=arrStationDataIndividual[15];  
                         var valhumidity= arrStationDataIndividual[16];   
                         var valRainfall =  arrStationDataIndividual[17];               
                                                          
                        var WVData="-";
                        
                        switch (WeatherVariable)
                        {               
                            case "T":
                            WVData=Temperature;
                            break;
                            case "W":
                            WVData=wind;
                            break;
                            case "G":
                            WVData=gust;
                            break;                       
                            case "H":
                            WVData=Humidity;
                            break;
                            case "D":
                            WVData=DewPoint;                        
                            break;
                            case "R":
                            WVData=RainfallSinceMidNight;
                            break;
                        }
                        if (WVData!="-")
                        {
                            if(strStationName !="-" || strCity !="-" || strTime !="-" || Temperature!="-" || wind!="-" || gust!="-" || Humidity !="-" || DewPoint!="-" || RainfallSinceMidNight!="-")
                            {
                                map.addOverlay(createMarker(latlng,strStationName,strCity,strTime,Temperature,wind,gust,Humidity,DewPoint,RainfallSinceMidNight,WeatherVariable,strLink,strMarkerColor,x,baromericPressure,valhumidity,valRainfall));                  
                            }      
                       }
                       
                    } 
                    
                }
                catch(e) {alert(e.message);}
            }

				function createMarker1(la,lo)
				{  
									
					var latlng = new GLatLng(la,lo);
					var icon = new GIcon();
					icon.image = 'http://gmaps-samples.googlecode.com/svn/trunk/markers/circular/greencirclemarker.png';
					icon.iconSize = new GSize(32, 32);
					icon.iconAnchor = new GPoint(16, 16);
					icon.infoWindowAnchor = new GPoint(25, 7);

					opts = { 
					"icon": icon,
					"clickable": true,
					"title": "letter A",
					"labelText": "15",
					"labelOffset": new GSize(-6, -10)
					};
					var marker = new LabeledMarker(latlng, opts);

					GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml("I'm a Labeled Marker!");
					});
					map.addOverlay(marker);										
				}  
				
				
		function createMarker(point,strStationName,strCity,strTime,Temperature,wind,gust,Humidity,DewPoint,RainfallSinceMidNight,WeatherVariable,strLink,strMarkerColor,x,baromericPressure,valhumidity,valRainfall)
         {  
          
             var strDisplayName=strStationName;
             var icon = new GIcon();
             var windspeed=x
             var bPressure =baromericPressure
             var humi =valhumidity
             var rainfall=valRainfall
            
             var checkSign="False";
             switch (WeatherVariable)
             {               
                    case "T":
                        WV=Temperature;
                        
                        /*temperatures: less than 0 (purple), 1-9 (dark blue), 10-19 (light blue), 20-29 (light 
                         green), 30-39 (green), 30-39 (dark green), 40-49 (yellow), 50-59 (light blue), 60-69 (blue), 
                         70-79 (orange), 80-89 (red), 90-99 (dark red), 100 and up (purple) */
						document.getElementById('lblWeatherVariable').innerText='Temperature';
						document.getElementById('lblWeatherVariable').textContent='Temperature';

                         if(WV<0)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';
                          
                        }
                         if(WV>=1 && WV<=9)
                        {
                         
                          icon.image ='images/gmapicons/darkblue.png';
                          
                        }
                         if(WV>=10 && WV<=19)
                        {
                         
                          icon.image ='images/gmapicons/lightblue.png';
                          
                        }
                         if(WV>=20 && WV<=29)
                        {
                         
                          icon.image ='images/gmapicons/lightgreen.png';
                          
                        }
                         if(WV>=30 && WV<=39)
                        {
                         
                          icon.image ='images/gmapicons/green.png';
                          
                        }
                         if(WV>=40 && WV<=49)
                        {
                         
                          icon.image ='images/gmapicons/yellow.png';
                          
                        }
                        if(WV>=50 && WV<=59)
                        {
                         
                          icon.image ='images/gmapicons/lightblue.png';
                          
                        }
                        if(WV>=60 && WV<=69)
                        {
                         
                          icon.image ='images/gmapicons/blue.png';
                          
                        }
                        
                         if(WV>=70 && WV<=79)
                        {
                         
                          icon.image ='images/gmapicons/orange.png';
                          
                        }
                         if(WV>=80 && WV<=89)
                        {
                         
                          icon.image ='images/gmapicons/red.png';
                          
                        }
                         if(WV>=90 && WV<=99)
                        {
                         
                          icon.image ='images/gmapicons/darkred.png';	
                          
                        }
                         if(WV>=100)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';	
                          
                        }
                       
                        
                        break;
                    case "W":
                        WV=wind;
                        document.getElementById('lblWeatherVariable').innerText='Wind Speed';
                        document.getElementById('lblWeatherVariable').textContent='Wind Speed';
                         if(windspeed>=0 && windspeed<=15)
                        {
                         
                          icon.image ='images/gmapicons/orange.png';
                          
                        }
                         if(windspeed>=16 && windspeed<=20)
                        {
                         
                          icon.image ='images/gmapicons/red.png';
                          
                        }
                         if(windspeed>21)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';
                          
                        }
                        
                      
                        
                        break;
                    case "G":
                        WV=gust;
                       
                        document.getElementById('lblWeatherVariable').innerText='Wind Gust';
                        document.getElementById('lblWeatherVariable').textContent='Wind Gust';
                           if(bPressure<29.00)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';
                          
                        }
                         if(bPressure>=29.01 && bPressure<=30.00)
                        {
                         
                          icon.image ='images/gmapicons/orange.png';
                          
                        }
                         if(bPressure>=30.01)
                        {
                         
                          icon.image ='images/gmapicons/red.png';
                          
                        }
                        
                        break;                       
                    case "H":
                        WV=Humidity;
                        
                        // same as temperature breakdown
                        document.getElementById('lblWeatherVariable').innerText='Humidity';
                        document.getElementById('lblWeatherVariable').textContent='Humidity';
                         if(humi<0)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';
                          
                        }
                         if(humi>=1 && humi<=9)
                        {
                         
                          icon.image ='images/gmapicons/darkblue.png';
                          
                        }
                         if(humi>=10 && humi<=19)
                        {
                         
                          icon.image ='images/gmapicons/lightblue.png';
                          
                        }
                         if(humi>=20 && humi<=29)
                        {
                         
                          icon.image ='images/gmapicons/lightgreen.png';
                          
                        }
                         if(humi>=30 && humi<=39)
                        {
                         
                          icon.image ='images/gmapicons/green.png';
                          
                        }
                         if(humi>=40 && humi<=49)
                        {
                         
                          icon.image ='images/gmapicons/yellow.png';
                          
                        }
                        if(humi>=50 && humi<=59)
                        {
                         
                          icon.image ='images/gmapicons/lightblue.png';
                          
                        }
                        if(humi>=60 && humi<=69)
                        {
                         
                          icon.image ='images/gmapicons/blue.png';
                          
                        }
                        
                         if(humi>=70 && humi<=79)
                        {
                         
                          icon.image ='images/gmapicons/orange.png';
                          
                        }
                         if(humi>=80 && humi<=89)
                        {
                         
                          icon.image ='images/gmapicons/red.png';
                          
                        }
                         if(humi>=90 && humi<=99)
                        {
                         
                          icon.image ='images/gmapicons/darkred.png';	
                          
                        }
                         if(humi>=100)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';	
                          
                        }
                       
                      
                        break;
                    case "D":
                        WV=DewPoint;                        
                        
                        // same as temperature breakdown
                        document.getElementById('lblWeatherVariable').innerText='Dew Point';
                        document.getElementById('lblWeatherVariable').textContent='Dew Point';
                          if(WV<0)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';
                          
                        }
                         if(WV>=1 && WV<=9)
                        {
                         
                          icon.image ='images/gmapicons/darkblue.png';
                          
                        }
                         if(WV>=10 && WV<=19)
                        {
                         
                          icon.image ='images/gmapicons/lightblue.png';
                          
                        }
                         if(WV>=20 && WV<=29)
                        {
                         
                          icon.image ='images/gmapicons/lightgreen.png';
                          
                        }
                         if(WV>=30 && WV<=39)
                        {
                         
                          icon.image ='images/gmapicons/green.png';
                          
                        }
                         if(WV>=40 && WV<=49)
                        {
                         
                          icon.image ='images/gmapicons/yellow.png';
                          
                        }
                        if(WV>=50 && WV<=59)
                        {
                         
                          icon.image ='images/gmapicons/lightblue.png';
                          
                        }
                        if(WV>=60 && WV<=69)
                        {
                         
                          icon.image ='images/gmapicons/blue.png';
                          
                        }
                        
                         if(WV>=70 && WV<=79)
                        {
                         
                          icon.image ='images/gmapicons/orange.png';
                          
                        }
                         if(WV>=80 && WV<=89)
                        {
                         
                          icon.image ='images/gmapicons/red.png';
                          
                        }
                         if(WV>=90 && WV<=99)
                        {
                         
                          icon.image ='images/gmapicons/darkred.png';	
                          
                        }
                         if(WV>=100)
                        {
                         
                          icon.image ='images/gmapicons/purple.png';	
                          
                        }
                        break;
                    case "R":
                        WV=RainfallSinceMidNight;
                        document.getElementById('lblWeatherVariable').innerText='Rainfall';
                        document.getElementById('lblWeatherVariable').textContent='Rainfall';
                           if(rainfall==0)
                        {
                         
                          icon.image ='images/gmapicons/white.png';
                          
                        }
                         if(rainfall>=0.01 && rainfall<=0.09)
                        {
                         
                          icon.image ='images/gmapicons/orange.png';
                          
                        }
                         if(rainfall>=0.10 && rainfall<=0.19)
                        {
                         
                          icon.image ='images/gmapicons/red.png';
                          
                        }
                         if(rainfall>=0.20 && rainfall<=0.29)
                        {
                         
                          icon.image ='images/gmapicons/darkred.png';
                          
                        }
                         if(rainfall>=0.30 )
                        {
                         
                          icon.image ='images/gmapicons/purple.png';
                          
                        }
                        
                        break;
                }
            if(WV<0)
            {
                checkSign="True";  
                WV=-(WV);              
                            
            }  
            
            if(WV=="-")
            {
                WV="";    
            }
            else
            {
                if(WeatherVariable=="T" || WeatherVariable=="D")
                {
                  WV+="<sup>0</sup>" + "F";
                } 
                if(WeatherVariable=="R" && rainfall==0)
                {
                if(checkSign=="True")
                    WV="<table style='font-size: 12px;halign:left;color:black;'><tr><td>" + "-" + "</td><td>" + WV + "</td></tr></table>"
                else                    
                    WV="<div style='font-size: 12px;halign:left;color:black;direction:ltr;display:inline-table;text-decoration:'blink';>"+WV+"</div>";
                }
                else
                {
                if(checkSign=="True")
                    WV="<table style='font-size: 12px;halign:left;color:white;'><tr><td>" + "-" + "</td><td>" + WV + "</td></tr></table>"
                else                    
                    WV="<div style='font-size: 12px;halign:left;color:white;direction:ltr;display:inline-table;text-decoration:'blink';>"+WV+"</div>";

                } 
            }              
            if(strStationName=="-")
            {
                strStationName="";    
            }
            else
            {
                strStationName= "<tr><td>" + "Station : " + strStationName + "</td></tr>";
            }       
            if(strCity=="-")
            {
                strCity="";    
            }
            else
            {
                strCity= "<tr><td>" + "City : " + strCity + "</td></tr>";
            }      
            if(strTime=="-")
            {
                strTime="";    
            }
            else
            {
                strTime= "<tr><td>" + "Latest Update : " + strTime + "</td></tr>";
            }         
            if(Temperature=="-")
            {
                Temperature="";    
            }
            else
            {
                Temperature= "<tr><td>" + "Temperature :" + Temperature + "&#176" + " F"+ "</td></tr>";
            }            
            
            if(wind=="-")
            {
                wind="";    
            }
            else
            {
                wind="<tr><td>" + "Wind : " + wind + "</td></tr>";
            }
            if(gust=="-")
            {
                gust="";    
            }
            else
            {
                gust="<tr><td>" + "Barometric Pressure : " + gust + "</td></tr>";
            }            

            if(Humidity=="-")
            {
                Humidity="";    
            }
            else
            {
                Humidity="<tr><td>" + "Humidity : " + Humidity + "</td></tr>";
            }
            
            if(DewPoint=="-")
            {
                DewPoint="";    
            }
            else
            {
                DewPoint="<tr><td>" + "Dew Point :" + DewPoint + "&#176" + " F" + "</td></tr>";
            }
            
            if(RainfallSinceMidNight=="-")
            {
                RainfallSinceMidNight="";    
            }
            else
            {
                RainfallSinceMidNight="<tr><td>" + "Rainfall Since Midnight : " + RainfallSinceMidNight + "</td></tr>"; 
            }	
								
                if(WeatherVariable=='T' || WeatherVariable=='D' || WeatherVariable=='H' || WeatherVariable=='R')
                {
                    icon.iconSize = new GSize(50, 30);
                }
                else
                {
                    icon.iconSize = new GSize(100, 30);   
                }
                icon.iconAnchor = new GPoint(16, 16);
                icon.infoWindowAnchor = new GPoint(25, 7);
                
                
               opts = { 
                  "icon": icon,
                  "clickable": true,
                  "title": strDisplayName,                  
                  "labelText": WV, 
                  "labelOffset": new GSize(-6, -10)
                };
                
                var marker = new LabeledMarker(point, opts);
                GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml("<table border='0' style='font-size:8pt;width:200pt;text-align:left;'><tr><td>" + strStationName + strCity + strTime + Temperature + wind + gust + Humidity + DewPoint + RainfallSinceMidNight + "</td></tr><tr><td>" + "<a href='" + strLink + "' target='_self' style='font-size:8pt;color:blue;'>Click Here for complete Weather Page of This Station.</a>"  + "</td></tr></table>");
                });
                return marker;
        } 
