var legendCloseDisabled = false;
var closeLegend = null;
var speedLegendDiv = null;

function LakeCountyControl() {
}

LakeCountyControl.prototype = new GControl();

LakeCountyControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
  var iconTypeColumn = document.createElement("div");
  var mapLegend = document.createElement("div");
  var mapTypeColumnTitle = document.createElement("div");
  var mapTypeColumn = document.createElement("div");
  var mapType = document.createElement("div");
  
  
  /* map type control */
  mapTypeColumnTitle.innerHTML = "<img style=\"float:right;padding-right: 2px;\" src=\"images/close.png\"><b>Map Types</b>";
  mapTypeColumnTitle.style.textAlign = "center";
  mapTypeColumnTitle.style.marginTop = "2px";
  var standardMap = null;
  var satMap = null;
  var hybMap = null;
  try
  {
      standardMap = document.createElement("<input type='radio' NAME ='type' id='standard' checked / >");
      satMap = document.createElement("<input type='radio' NAME ='type' id ='satellite' />");
      hybMap = document.createElement("<input type='radio' NAME ='type' id ='hybrid' />");
  }	  
  catch (err)
  {
      standardMap = document.createElement("input");
      satMap = document.createElement("input");
      hybMap = document.createElement("input");
  }
  standardMap.type = satMap.type = hybMap.type = "radio";
  standardMap.name = satMap.name = hybMap.name = "type";
  standardMap.id = "standard";
  standardMap.value = "Standard";
  standardMap.checked = true;
  satMap.id = "satellite"; 
  satMap.value = "Satellite";
  hybMap.id = "hybrid";
  hybMap.value = "Hybrid";
  GEvent.addDomListener(standardMap, "click", function() {
  		map.setMapType(G_NORMAL_MAP);
		
  });
  GEvent.addDomListener(satMap, "click", function() {
    		map.setMapType(G_SATELLITE_MAP);
  });
  GEvent.addDomListener(hybMap, "click", function() {
  		map.setMapType(G_HYBRID_MAP);
  });  
  mapType.appendChild(mapTypeColumnTitle);
  
  var standardMapDiv = document.createElement("div");
  standardMapDiv.id = "standardMapDiv";
  standardMapDiv.appendChild(standardMap);
  standardMapDiv.appendChild(document.createTextNode("Standard"));
  mapTypeColumn.appendChild(standardMapDiv);  
  
  var satMapDiv = document.createElement("div");
  satMapDiv.id = "satMapDiv";
  satMapDiv.appendChild(satMap);
  satMapDiv.appendChild(document.createTextNode("Satellite"));  
  mapTypeColumn.appendChild(satMapDiv);
  
  var hybMapDiv = document.createElement("div");
  hybMapDiv.id = "hybMapDiv";
  hybMapDiv.appendChild(hybMap);
  hybMapDiv.appendChild(document.createTextNode("Hybrid"));
  mapTypeColumn.appendChild(hybMapDiv);
  
  mapType.appendChild(mapTypeColumn);
  this.setMapTypeStyle_(mapType);
  
  GEvent.addDomListener(mapType, "mouseover", function(){
        if(mapTypeColumn.style.display == "none") mapTypeColumn.style.display = "";

  });
  GEvent.addDomListener(mapType, "mouseout", function () {
        if(mapTypeColumn.style.display != "none") mapTypeColumn.style.display = "none";
  });

  /* map legend control */
  var iconTypeColumnTitle = document.createElement("div");
  iconTypeColumnTitle.style.width = "175px";
  iconTypeColumnTitle.style.marginTop = "2px";
  var closeImg = document.createElement("div");
  closeImg.id = "closeImg";
  closeImg.style.backgroundImage = "url(images/close.png)";
  closeImg.style.cssFloat = "right";
  closeImg.style.styleFloat = "right";
  closeImg.style.width = "15px";
  closeImg.style.height = "15px";
  closeImg.style.marginRight = "2px";
  closeImg.style.backgroundRepeat = "no-repeat";
  var title = document.createElement("div");
  title.innerHTML = "<b>Legend/Options</b>";
  title.style.cssFloat = "left";
  title.style.styleFloat = "left";
  title.style.width = "75px";
  title.style.marginLeft = "30px";
  iconTypeColumnTitle.appendChild(title);
  iconTypeColumnTitle.appendChild(closeImg);
  iconTypeColumnTitle.style.textAlign = "center";
  mapLegend.appendChild(iconTypeColumnTitle);
  
  var incidentCheckBox = document.createElement("input");
  var roadworkCheckBox = document.createElement("input");
  var congestionCheckBox = document.createElement("input");
  var cadCheckBox = document.createElement("input");
  var borderCheckBox = document.createElement("input");
  var harCheckbox = document.createElement("input");
  var cameraCheckbox = document.createElement("input");
  var tmcCheckBox = document.createElement("input");
   tmcCheckBox = document.createElement("input");

  harCheckbox.type = cameraCheckbox.type = tmcCheckBox.type = cadCheckBox.type = incidentCheckBox.type = roadworkCheckBox.type = borderCheckBox.type  = congestionCheckBox.type = "checkbox";
  tmcCheckBox.id = "tmc";
  tmcCheckBox.value = "tmc";
  GEvent.addDomListener(tmcCheckBox, "click", function (e) {
      if (tmcLayerOn)
	tmcLayerOn = false;
      else 
	tmcLayerOn = true;
      checkLayerVisibility();
      e.cancelBubble = true;
  });
  incidentCheckBox.id = "legendIncident";
  incidentCheckBox.value = "event";
  GEvent.addDomListener(incidentCheckBox, "click", function(e){
	if (incidentLayerOn)
		incidentLayerOn = false;
        else
		incidentLayerOn = true;
        checkLayerVisibility();
        e.cancelBubble = true;
  });
  roadworkCheckBox.id = "legendClosure";
  roadworkCheckBox.value = "roadworkd";
  GEvent.addDomListener(roadworkCheckBox, "click", function(e){
        if(roadworkLayerOn)
		roadworkLayerOn = false;
	else
		roadworkLayerOn = true;
        checkLayerVisibility();
        e.cancelBubble = true;
   });
  congestionCheckBox.id = "legendCongestion";
  congestionCheckBox.value = "congestion";
  GEvent.addDomListener(congestionCheckBox, "click", function(e){
   	if(congestionLayerOn)
		congestionLayerOn = false;
        else
	        congestionLayerOn = true;
	checkOverlayDisplay();
	e.cancelBubble = true;
  });
  cadCheckBox.id = "legendCad";
  cadCheckBox.value = "cad";
  GEvent.addDomListener(cadCheckBox, "click", function(e){
        if(cadLayerOn)
                cadLayerOn = false;
        else
                cadLayerOn = true;
        checkOverlayDisplay();
        e.cancelBubble = true;
  });
  borderCheckBox.id = "legendBorder";
  borderCheckBox.value = "border";
  GEvent.addDomListener(borderCheckBox, "click", function(e){
        if(borderLayerOn)
                borderLayerOn = false;
        else
                borderLayerOn = true;
        checkOverlayDisplay();
        e.cancelBubble = true;
  });
  harCheckbox.id = "legendHar";
  harCheckbox.value = "har";
  GEvent.addDomListener(harCheckbox, "click", function(e){
    	if (harLayerOn)
    		harLayerOn = false;
          else
          	harLayerOn = true;
          checkLayerVisibility();
          e.cancelBubble = true;
    });
  cameraCheckbox.id = "legendCamera";
  cameraCheckbox.value = "camera";
  GEvent.addDomListener(cameraCheckbox, "click", function(e){
    	if(cameraLayerOn)
    		cameraLayerOn = false;
    	else
    		cameraLayerOn = true;
    	checkLayerVisibility();
    	e.cancelBubble = true;
  });
  
  
  var congestionDiv = document.createElement("div");
  var congestionDiv1 = document.createElement("div");
  var congestionDiv2 = document.createElement("div");
  congestionDiv.id = "congestionDiv";
  var congestImg = document.createElement("img");
  congestImg.src="images/congestion.gif";
  //this.setButtonStyleImg_(congestImg);
  congestImg.style.marginRight = "2px";
  congestImg.style.paddingRight = "2px";
  congestionDiv1.appendChild(congestionCheckBox);
  congestionDiv1.appendChild(congestImg);
  congestionDiv2.innerHTML = "Speed";
  this.setButtonStyleFloatLeft_(congestionDiv1);
  this.setButtonStyleFloatLeft_(congestionDiv2);
  congestionDiv2.style.paddingTop = "5px"; 
  congestionDiv.appendChild(congestionDiv1);
  congestionDiv.appendChild(congestionDiv2);
  this.setButtonStyleHeight_(congestionDiv);
  iconTypeColumn.appendChild(congestionDiv);
  
  var incidentDiv = document.createElement("div");
  var incidentDiv1 = document.createElement("div");
  var incidentDiv2 = document.createElement("div");
  incidentDiv.id = "incidentDiv";
  var incidentImg = document.createElement("img");
  incidentImg.src = "images/event.png";
  this.setButtonStyleImg_(incidentImg);
  incidentDiv1.appendChild(incidentCheckBox);
  incidentDiv1.appendChild(incidentImg);
  incidentDiv2.innerHTML = "Incidents";
  this.setButtonStyleFloatLeft_(incidentDiv1);
  this.setButtonStyleFloatLeft_(incidentDiv2); 
  incidentDiv2.style.paddingTop = "5px"; 
  incidentDiv.appendChild(incidentDiv1);
  incidentDiv.appendChild(incidentDiv2);
  this.setButtonStyleHeight_(incidentDiv);
  iconTypeColumn.appendChild(incidentDiv);
  
  var roadworkDiv = document.createElement("div");
  var roadworkDiv1 = document.createElement("div");
  var roadworkDiv2 = document.createElement("div");
  roadworkDiv.id = "roadworkDiv";
  roadworkImg = document.createElement("img");
  roadworkImg.src = "images/construction.png";
  this.setButtonStyleImg_(roadworkImg);
  roadworkDiv1.appendChild(roadworkCheckBox);
  roadworkDiv1.appendChild(roadworkImg);
  roadworkDiv2.innerHTML = "Roadwork";
  this.setButtonStyleFloatLeft_(roadworkDiv1);
  this.setButtonStyleFloatLeft_(roadworkDiv2); 
  roadworkDiv2.style.paddingTop = "5px"; 
  roadworkDiv.appendChild(roadworkDiv1);
  roadworkDiv.appendChild(roadworkDiv2);
  this.setButtonStyleHeight_(roadworkDiv);
  iconTypeColumn.appendChild(roadworkDiv);
  
  var harDiv = document.createElement("div");
  var harDiv1 = document.createElement("div");
  var harDiv2 = document.createElement("div");
  harDiv.id = "harDiv";
  var harImg = document.createElement("img");
  harImg.src = "images/radiotower.png";
  this.setButtonStyleImg_(harImg);
  harDiv1.appendChild(harCheckbox);
  harDiv1.appendChild(harImg);
  harDiv2.innerHTML = "Radio 1620 AM";
  this.setButtonStyleFloatLeft_(harDiv1);
  this.setButtonStyleFloatLeft_(harDiv2); 
  harDiv2.style.paddingTop = "5px"; 
  harDiv.appendChild(harDiv1);
  harDiv.appendChild(harDiv2);
  this.setButtonStyleHeight_(harDiv);
  iconTypeColumn.appendChild(harDiv);
  
  var cameraDiv = document.createElement("div");
  var cameraDiv1 = document.createElement("div");
  var cameraDiv2 = document.createElement("div");
  cameraDiv.id = "cameraDiv";
  var cameraImg = document.createElement("img");
  cameraImg.src = "http://maps.google.com/mapfiles/kml/pal4/icon46.png";
  this.setButtonStyleImg_(cameraImg);
  cameraDiv1.appendChild(cameraCheckbox);
  cameraDiv1.appendChild(cameraImg);
  cameraDiv2.innerHTML = "Snapshots";
  this.setButtonStyleFloatLeft_(cameraDiv1);
  this.setButtonStyleFloatLeft_(cameraDiv2);
  cameraDiv2.style.paddingTop = "5px"; 
  cameraDiv.appendChild(cameraDiv1);
  cameraDiv.appendChild(cameraDiv2);
  this.setButtonStyleHeight_(cameraDiv);
  iconTypeColumn.appendChild(cameraDiv);
  
  var tmcDiv  = document.createElement("div");
  var tmcDiv1 = document.createElement("div");
  var tmcDiv2 = document.createElement("div");
  tmcDiv.id = "tmcDiv";
  tmcDiv1.appendChild(tmcCheckBox);
  var tmcImg = document.createElement("img");
  tmcImg.src = "http://maps.google.com/mapfiles/kml/pal2/icon10.png";
  this.setButtonStyleImg_(tmcImg);
  tmcDiv1.appendChild(tmcImg);
  tmcDiv2.innerHTML = "Tranportation<br>Mgmt. Center";
  this.setButtonStyleFloatLeft_(tmcDiv1);
  this.setButtonStyleFloatLeft_(tmcDiv2);
  tmcDiv.appendChild(tmcDiv1);
  tmcDiv.appendChild(tmcDiv2);
  this.setButtonStyleHeight_(tmcDiv);
  iconTypeColumn.appendChild(tmcDiv);
   
  var cadDiv = document.createElement("div");
  var cadDiv1 = document.createElement("div");
  var cadDiv2 = document.createElement("div");
  cadDiv.id = "cadDiv";
  cadDiv.style.clear = "both";
  cadDiv1.appendChild(cadCheckBox);
  cadDiv2.innerHTML = "Incident Coverage";
  this.setButtonStyleFloatLeft_(cadDiv1);
  this.setButtonStyleFloatLeft_(cadDiv2);
  cadDiv2.style.paddingTop = "5px"; 
  cadDiv.appendChild(cadDiv1);
  cadDiv.appendChild(cadDiv2);
  this.setButtonStyleHeight_(cadDiv);
  //iconTypeColumn.appendChild(cadDiv);
  
  var borderDiv = document.createElement("div");
  var borderDiv1 = document.createElement("div");
  var borderDiv2 = document.createElement("div");
  borderDiv.id = "borderDiv";
  borderDiv1.appendChild(borderCheckBox);
  borderDiv2.innerHTML = "Lake County";
  this.setButtonStyleFloatLeft_(borderDiv1);
  this.setButtonStyleFloatLeft_(borderDiv2);
  borderDiv2.style.paddingTop = "5px"; 
  borderDiv.appendChild(borderDiv1);
  borderDiv.appendChild(borderDiv2);
  this.setButtonStyleHeight_(borderDiv);
  //iconTypeColumn.appendChild(borderDiv);
  
  var linkDiv = document.createElement("div");
  linkDiv.id = "linkDiv";
  linkDiv.style.textAlign = "right";
  linkDiv.style.paddingTop = "7px";
  linkDiv.style.paddingBottom = "3px";
  linkDiv.style.paddingRight = "3px";
  linkDiv.style.width = "147px";
  linkDiv.innerHTML = "<u>More</u>";
  iconTypeColumn.appendChild(linkDiv); 
  var moreDiv = document.createElement("div");
  moreDiv.id = "moreDiv";
    moreDiv.innerHTML = "<div style='margin-top:5px; padding-left: 10px;width:147px'><p>Click on the check box to display or hide each of the options.</p><p><img src='images/event.png' style='float:left; padding-right: 3px;'><b>Incidents</b><br>Accidents and incidents which may affect road congestion.</p><p><img src='images/construction.png' style='float: left; padding-right: 3px;'><b>Roadwork</b><br>Roadwork which may affect road congestion.</p><p><img src='images/radiotower.png' style='float: left; padding-right: 3px;'><b>Radio 1620 AM</b><br>Radio towers broadcasting on 1620 AM with current information about traffic conditions, including important events and active roadwork.</p><p><img src='http://maps.google.com/mapfiles/kml/pal4/icon46.png' style='float: left; width: 16px; height: 16px; padding-right: 3px;'><b>Snapshots</b><br>Recent snapshots from traffic monitoring cameras at intersections throughout the county.<p><img src='http://maps.google.com/mapfiles/kml/pal2/icon10.png' style='float: left; width: 16px; height: 16px; padding-right: 3px;'><b>Tranportation Mgmt. Center</b><br>The hub of the Lake County transportation management system.</p></div>";  
  

  iconTypeColumn.appendChild(moreDiv);
  this.setButtonHidden_(moreDiv);
  this.setMapLegendStyle_(mapLegend);
  
  /* open and close the more panel */
  GEvent.addDomListener(linkDiv, "click", function (event) {
      var div = document.getElementById("moreDiv");
      if(div.style.display == "none")
      {
	  mapLegend.style.height = "320px";
	  iconTypeColumn.style.height = "300px";
	  iconTypeColumn.style.overflow = "auto";
          div.style.display = "";
          document.getElementById("linkDiv").innerHTML = "<u>Less</u>";
      }
      else {
          div.style.display = "none";
	  mapLegend.style.height = "200px";
	  iconTypeColumn.style.height = "";
          document.getElementById("linkDiv").innerHTML = "<u>More</u>";
       }
       event.cancelBubble = true;
   });
   
  /* open the map legend by moving mouse over the title */
  if(window.attachEvent)
  {
	    GEvent.addDomListener(mapLegend, "mouseenter", function (event){
	      if ( iconTypeColumn.style.display == "none"){
		  closeImg.style.backgroundImage = "url(images/open.png)";
		  if (moreDiv.style.display != "none")
		{
			mapLegend.style.height = "320px";
			iconTypeColumn.style.height = "300px";
			iconTypeColumn.style.overflow = "auto";
		}
		else  mapLegend.style.height = "200px";
		iconTypeColumn.style.display = "";
	      } 
	  });
  }
  else
  {
	  GEvent.addDomListener(mapLegend, "mouseover", function (event){
	    if ( iconTypeColumn.style.display == "none"){
		closeImg.style.backgroundImage = "url(images/open.png)";
		if (moreDiv.style.display != "none")
		{
			mapLegend.style.height = "320px";
			iconTypeColumn.style.height = "300px";
			iconTypeColumn.style.overflow = "auto";
		}
		else  mapLegend.style.height = "200px";
		iconTypeColumn.style.display = "";
	    } 
	  });
  }

  /* close the map legend by clicking on the closeImg */
  GEvent.addDomListener(closeImg, "click", function(){
    if ( iconTypeColumn.style.display != "none")
    { 	
	closeImg.style.backgroundImage = "url(images/close.png)";
        iconTypeColumn.style.display = "none";
        iconTypeColumn.style.overflow = "";
        iconTypeColumn.style.height = "";
        mapLegend.style.height = "auto";
        
    } 
    else 
    {
       closeImg.style.backgroundImage = "url(images/open.png)"; 
       if (moreDiv.style.display != "none")
       {
		mapLegend.style.height = "300px";
		iconTypeColumn.style.height = "300px";
		iconTypeColumn.style.overflow = "auto";
       }
       iconTypeColumn.style.display = "";
    }

  });
  
  if(window.attachEvent)
  {
  
    closeLegend = GEvent.addDomListener(mapLegend, "mouseleave", function(){
      if(iconTypeColumn.style.display != "none")
      {
      	closeImg.style.backgroundImage = "url(images/close.png)";
          iconTypeColumn.style.display = "none";
          iconTypeColumn.style.overflow = "";
          iconTypeColumn.style.height = "";
          mapLegend.style.height = "auto";
       }
    });
  }
  else
  {
    closeLegend = GEvent.addDomListener(mapLegend, "mouseout", function(){
	    if(iconTypeColumn.style.display != "none")
	    {
		closeImg.style.backgroundImage = "url(images/close.png)";
		iconTypeColumn.style.display = "none";
		iconTypeColumn.style.overflow = "";
		iconTypeColumn.style.height = "";
		mapLegend.style.height = "auto";
	     }
     });
  }
  
  GEvent.addDomListener(mapLegend, "click", function(event){
  	if(legendCloseDisabled) {
		  if(window.attachEvent)
  		{
		    closeLegend = GEvent.addDomListener(mapLegend, "mouseleave", function(){
		      if(iconTypeColumn.style.display != "none")
		      {
			closeImg.style.backgroundImage = "url(images/close.png)";
			  iconTypeColumn.style.display = "none";
			  iconTypeColumn.style.overflow = "";
			  iconTypeColumn.style.height = "";
			  mapLegend.style.height = "auto";
		       }
		    });
		  }
		  else
		  {
		    closeLegend = GEvent.addDomListener(mapLegend, "mouseout", function(){
			    if(iconTypeColumn.style.display != "none")
			    {
				closeImg.style.backgroundImage = "url(images/close.png)";
				iconTypeColumn.style.display = "none";
				iconTypeColumn.style.overflow = "";
				iconTypeColumn.style.height = "";
				mapLegend.style.height = "auto";
			     }
		     });
		  }
		  legendCloseDisabled = false;
	}
	else 
	{
		GEvent.removeListener(closeLegend)
		legendCloseDisabled = true;
	}
  });
  
  /*GEvent.addListener(map, "click", function (){
        mapLegend.style.height = "auto";  
        iconTypeColumn.style.display = "none";
        iconTypeColumn.style.height = "";
        iconTypeColumn.style.overflow = "";
	closeImg.style.backgroundImage = "url(images/close.png)";
  });*/
  
  iconTypeColumn.style.clear = "both";
  this.setLegendTypeBodyStyle_(iconTypeColumn);
  this.setLegendTypeHeaderStyle_(iconTypeColumnTitle);
  this.setLegendTypeHeaderStyle_(mapTypeColumnTitle);
  this.setMapTypeBodyStyle_(mapTypeColumn);
  
  mapLegend.appendChild(iconTypeColumn);
  this.setButtonHidden_(iconTypeColumn);
  this.setButtonHidden_(mapTypeColumn);

  var speedLegend = document.createElement("div");
  var speedLegendSlowDiv = document.createElement("div");
  speedLegendSlowDiv.appendChild(document.createTextNode("Slow"));
  this.setSlowDiv_(speedLegendSlowDiv);
  var speedLegendFastDiv = document.createElement("div");
  speedLegendFastDiv.innerHTML = "Fast";
  this.setFastDiv_(speedLegendFastDiv);

  var speedLegendBarColors = document.createElement("div");
  var speedLegendGreen = document.createElement("div");
  var speedLegendOrange = document.createElement("div");
  var speedLegendRed = document.createElement("div");

  this.setSpeedBarColorsStyle_(speedLegendBarColors);
  this.setSpeedBarRed_(speedLegendRed);
  this.setSpeedBarGreen_(speedLegendGreen);
  this.setSpeedBarOrange_(speedLegendOrange);

  speedLegendBarColors.appendChild(speedLegendFastDiv);
  speedLegendBarColors.appendChild(speedLegendGreen);
  speedLegendBarColors.appendChild(speedLegendOrange);
  speedLegendBarColors.appendChild(speedLegendRed);
  speedLegendBarColors.appendChild(speedLegendSlowDiv);
  speedLegend.appendChild(speedLegendBarColors);

  this.speedLegend = speedLegend;
  this.setSpeedLegendStyle_(speedLegend);
  container.appendChild(speedLegend);
  container.appendChild(mapType);
  container.appendChild(mapLegend);
  map.getContainer().appendChild(container);
  return container;
}

LakeCountyControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

LakeCountyControl.prototype.setButtonHidden_ = function (button) {
 button.style.display = "none";
}

LakeCountyControl.prototype.setButtonVisible_ = function (button) {
 button.style.display = "";
}


/* map type menu, width = 100*/
LakeCountyControl.prototype.setMapTypeStyle_ = function(button) {
  button.style.color = "black";
  button.style.backgroundColor = "white";
  button.style.font = "10px Verdana";
  button.style.border = "1px solid black";
  button.style.padding = "0px";
  button.style.marginTop = "0px";
  button.style.marginBottom = "0px";
  button.style.marginLeft = "0px";
  button.style.marginRight = "2px";
  button.style.paddingRight = "0px";
  button.style.textAlign = "left";
  button.style.width = "100px";
  button.style.cursor = "pointer";
  button.style.cssFloat = "left";
  button.style.styleFloat = "left";
}

/* map type menu, width = 100*/
LakeCountyControl.prototype.setMapTypeBodyStyle_ = function(button) {
  button.style.color = "black";
  button.style.backgroundColor = "white";
  button.style.font = "10px Verdana";
  button.style.marginTop = "3px";
  button.style.textAlign = "left";
  button.style.width = "98px";
  button.style.marginRight = "0px";
  button.style.paddingRight = "0px";
  button.style.cursor = "pointer";
}

/* legend & options menu, width = 166*/
LakeCountyControl.prototype.setMapLegendStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "black";
  button.style.backgroundColor = "white";
  button.style.font = "10px Verdana";
  button.style.border = "1px solid black";
  button.style.padding = "0px";
  button.style.margin = "0px";
  button.style.textAlign = "left";
  button.style.width = "175px";
  button.style.cursor = "pointer";
  button.style.cssFloat = "left";
  button.style.styleFloat = "left";
}

/* internal legend body div*/
LakeCountyControl.prototype.setLegendTypeBodyStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "black";
  button.style.backgroundColor = "white";
  button.style.font = "10px Verdana";
  //button.style.marginTop = "3px";
  button.style.textAlign = "left";
  button.style.width = "175px";
  button.style.cursor = "pointer";
}

/* internal legend header div */
LakeCountyControl.prototype.setLegendTypeHeaderStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "black";
  button.style.font = "10px Verdana";
  button.style.height = "18px";
  button.style.cursor = "pointer";
  //button.style.paddingTop = "3px";
}

/* image setup */
LakeCountyControl.prototype.setButtonStyleImg_ = function (button){
  button.style.height = "17px";
  button.style.width = "17px";
  button.style.verticalAlign = "text-bottom";
  button.style.paddingRight = "2px";
  button.style.marginRight = "2px";
  button.style.paddingTop = "2px";
}

/* float div left */
LakeCountyControl.prototype.setButtonStyleFloatLeft_ = function (button){
   button.style.cssFloat = "left";
   button.style.styleFloat = "left";
}   

LakeCountyControl.prototype.setButtonStyleHeight_ = function (button){
   button.style.height = "25px";
}   

/* speed control related functions */
LakeCountyControl.prototype.hideSpeedControl = function() {
  this.speedLegend.style.display = "none";
}

LakeCountyControl.prototype.displaySpeedControl = function() {
  if (congestionLayerOn)
  	this.speedLegend.style.display = "";
}

LakeCountyControl.prototype.setSpeedLegendStyle_ = function(button) {
  button.style.font = "10px Verdana";
  button.style.width = "130px";
  button.style.backgroundColor = "white";
  button.style.border = "1px solid black";
  button.style.cssFloat = "left";
  button.style.styleFloat = "left";
  button.style.height = "22px";
  button.style.marginRight = "2px";
 button.style.verticalAlign = "text-bottom";
}

LakeCountyControl.prototype.setSlowDiv_ = function (button){
   button.style.cssFloat = "right";
   button.style.styleFloat = "right";
   button.style.paddingRight = "10px";
}   

LakeCountyControl.prototype.setFastDiv_ = function (button){
   //button.style.textAlign = "right";
   button.style.paddingLeft = "10px";
   button.style.cssFloat = "right";
   button.style.styleFloat = "right";

}   

LakeCountyControl.prototype.setSpeedBarColorsStyle_ = function(button) {
  button.style.marginRight = "13px";
  button.style.paddingTop = "3px";
}

LakeCountyControl.prototype.setSpeedBarRed_ = function(button) {
  button.style.width = "12px";
  button.style.backgroundColor = "#FF0000";
  button.style.cssFloat = "right";
  button.style.styleFloat = "right";
  button.style.height = "8px";
  button.style.border = "1px solid black";
}

LakeCountyControl.prototype.setSpeedBarGreen_ = function(button) {
  button.style.width = "12px";
  button.style.backgroundColor = "#00FF00";
  button.style.cssFloat = "right";
  button.style.styleFloat = "right";
  button.style.height = "8px";
  button.style.border = "1px solid black";
}

LakeCountyControl.prototype.setSpeedBarOrange_ = function(button) {
  button.style.width = "12px";
  button.style.backgroundColor = "#ff9900";
  button.style.cssFloat = "right";
  button.style.styleFloat = "right";
  button.style.height = "8px";
  button.style.border = "1px solid black";
  button.style.marginLeft = "1px";
  button.style.marginRight = "1px";
}
