﻿var bool = false;
var holder="";
var holder2="";
function onclick1() {

          
          var img = "images/map/new_headers/disoff2.jpg";
          var img1 = "images/map/new_headers/disOver.jpg";
          
          if (bool == false) {
                    holder = document.getElementById("desc").innerHTML;
                    document.getElementById("distance").src = img;
                    document.getElementById("desc").innerHTML = "Click on the map to place waypoints <img src='images/google/distancedot.png' alt='waypoint'/>.  When two or more waypoints have been placed the total distance in miles/kilometers will be displayed in the menu bar. You may click and drag any waypoint to a new position and the mileage will automatically recalculate.  Have fun planning your next bike ride! "; 
                  
                    bool = true;
                    StartMeasure(theMap);
          }
          else {
                    document.getElementById("distance").src = img1;
                    holder2 = document.getElementById("desc").innerHTML;
                    
                    if (holder2.substring(0, 5) == "Click" && holder == "") {
                        document.getElementById("desc").innerHTML = " ";
                    }
                    else if (holder2.substring(0, 5) == "Click") {
                        document.getElementById("desc").innerHTML = holder;
                    }
                    else {

                        document.getElementById("desc").innerHTML = holder2;  
                    }
                    
                    bool = false;
                    EndMeasure();
          }

}
function onmouseout1() {
          var img = "images/map/new_headers/disoff.jpg";
          var img1 = "images/map/new_headers/dis.jpg";
          if (bool == true) {
                    document.getElementById("distance").src = img;
          }
          else {
                    document.getElementById("distance").src = img1;
          }
}
function onmouseon1() {
          var img = "images/map/new_headers/disoff2.jpg";
          var img1 = "images/map/new_headers/disOver.jpg";

          if (bool == true) {
                    document.getElementById("distance").src = img
          }
          else {
                    document.getElementById("distance").src = img1;
          }
}
function reset1() {
          document.getElementById("distance").src = "images/map/new_headers/dis.jpg";
          document.getElementById("desc").innerHTML = " ";
          bool = false;
}
function decisionHeadings(type) {
         

                    changeHeading(type);
          
}
function decisionHeadings2(type) {

          

                    changeHeading2(type);
         
} 

function changeMapType(htmlPlaceName, type) {
          switch (type) {
              case 'terrain':
                  theMap.setMapTypeId(google.maps.MapTypeId.TERRAIN);
                  
                  break;
                    case 'satellite':
                              theMap.setMapTypeId(google.maps.MapTypeId.SATELLITE);
                              break;
                              
                    case 'roadmap':
                              theMap.setMapTypeId(google.maps.MapTypeId.ROADMAP);
                              break;
                              
                    default:
                              break;
          }
}
function getHeight() 
{
          var myWidth;
          var myHeight;

          if (typeof (window.innerWidth) == 'number') {

                    //Non-IE
                    var h = document.getElementById("table1").clientHeight;
                    var w = document.getElementById("table2").clientHeight;
                    
                    myWidth = document.documentElement.clientWidth;
                    myHeight = document.documentElement.clientHeight;

                    //scroll menu
                   document.getElementById("menu_scroll").style.height = myHeight - h - w - 20 + 'px';
                   document.getElementById("menu_scroll").style.width = 185 + 'px';
                   document.getElementById("menu_scroll").style.overflow = 'auto';
                    
                    
                    
                    document.getElementById("map_canvas").style.height = myHeight - h -w - 20+ 'px';

          } else if (document.documentElement &&

                    (document.documentElement.clientWidth || document.documentElement.clientHeight)) {

                    //IE 6+ in 'standards compliant mode'
                    var h = document.getElementById("table1").clientHeight;
                    var w = document.getElementById("table2").clientHeight;
                     
                    myWidth = document.documentElement.clientWidth;
                    myHeight = document.documentElement.clientHeight;

                    //scroll menu
                    document.getElementById("menu_scroll").style.height = myHeight - h - w - 20 + 'px';
                    document.getElementById("menu_scroll").style.width = 185 + 'px';
                    document.getElementById("menu_scroll").style.overflow = 'auto';
                    
                    
                    document.getElementById("map_canvas").style.height = myHeight - h -w - 20  + 'px';

                    
          } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {

                    //IE 4 compatible
                    var h = document.getElementById("table1").clientHeight;
                    var w = document.getElementById("table2").clientHeight;
                     
                    myWidth = document.body.clientWidth;
                    myHeight = document.body.clientHeight;

                    //scroll menu
                    document.getElementById("menu_scroll").style.height = myHeight - h - w - 20 + 'px';
                    document.getElementById("menu_scroll").style.width = 185 + 'px';
                    document.getElementById("menu_scroll").style.overflow = 'auto';
                    
                    
                    
                    
                    document.getElementById("map_canvas").style.height = myHeight - h - w -20  + 'px';

          }
}
function changeHeading(type) {
          switch (type) {
                    case '10Mile':
                        document.getElementById("desc").innerHTML = '10.1-Mile Loop';
                        
                              break;
                    case '15Mile':
                              document.getElementById("desc").innerHTML = '15.3-Mile Loop';
                              break;
                    case '17Mile':
                              document.getElementById("desc").innerHTML = '17.6-Mile Loop';
                              break;
                    case '22Mile':
                              document.getElementById("desc").innerHTML = '22.9-Mile Loop';
                              break;
                    case '25Mile':
                              document.getElementById("desc").innerHTML = '25.7-Mile Loop';
                              break;
                    case '26Mile':
                              document.getElementById("desc").innerHTML = '26.1-Mile Loop';
                              break;
                    case '31Mile':
                              document.getElementById("desc").innerHTML = '31.1-Mile Loop';
                              break;
                    default:
                              break;
                             
          }
}
function changeHeading2(type) {
          switch (type) {
                              case 'Bluff':
                                        document.getElementById("desc").innerHTML = 'MCT Bluff Trail is a 2-mile asphalt trail that runs parallel to Stadium Drive on the SIUE campus. ';
                                        break;
                              case 'Confluence':
                                        document.getElementById("desc").innerHTML = 'MCT Confluence Trail is an 18.6-mile asphalt and oil & chip trail that runs atop the Mississippi River levees from Granite City to Alton, offering panoramic views of the canal, the river and Downtown Alton. The Confluence Trail connects to the McKinley Bridge and the Old Chain of Rocks Bridge, linking the trails to Downtown St. Louis.';
                                        break;
                              case 'Goshen':
                                        document.getElementById("desc").innerHTML = 'MCT Goshen Trail is an 8.5-mile asphalt trail runs from Troy, through Maryville and Glen Carbon into Edwardsville.';
                                        break;
                              case 'Heritage':
                                        document.getElementById("desc").innerHTML = 'MCT Heritage Trail is a 4.8-mile asphalt trail that runs through rural Madison County from Glen Carbon to Marine. ';
                                        break;
                              case 'Nature':
                                        document.getElementById("desc").innerHTML = 'MCT Nature Trail is a 13.5-mile asphalt trail that runs from the Leclaire neighborhood of Edwardsville, through the Esic neighborhood, to the SIUE campus and across the American Bottoms to Granite City. ';
                                        break;
                              case 'Nickel':
                                        document.getElementById("desc").innerHTML = 'MCT Nickel Plate Trail is a 13.4-mile asphalt and limestone trail that runs from rural Edwardsville into the historic Leclaire neighborhood and through the woods into Glen Carbon, connecting to Miner’s Park, the Edwardsville Township Park and the N.O. Nelson campus of Lewis & Clark Community College. ';
                                        break;
                              case 'Quercus':
                                        document.getElementById("desc").innerHTML = 'MCT Quercus Grove Trail is an 18.4-mile asphalt and limestone trail that runs from Downtown Edwardsville through rural Madison County connecting to Hamel, Worden and Staunton. ';
                                        break;
                              case 'Schoolhouse':
                                        document.getElementById("desc").innerHTML = 'MCT Schoolhouse Trail is a 15.9-mile asphalt trail that runs from Maryville through Collinsville to Horseshoe Lake State Park in Granite City. The Schoolhouse Trail also connects to Drost Park.';
                                        break;
                              case 'Watershed':
                                        document.getElementById("desc").innerHTML = 'MCT Watershed Trail runs from Downtown Edwardsville, past the Watershed Nature Center to rural Wanda.';
                                        break;
                              case 'Eagle':
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;
                              case 'Morris':
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;
                              case 'River':
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;
                              case 'Connector':
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;
                              case 'WAlton':
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;
                              case 'gcHeritage':
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;
                              default:
                                        document.getElementById("desc").innerHTML = ' ';
                                        break;

                    }


}

function mapHighlight() 
{
    document.getElementById("mapInterface").src = "images/gmi.jpg";
    document.getElementById("mapIcon").src = "images/gmiMap.jpg";

}

function mapHighlightOver() 
{
    document.getElementById("mapIcon").src = "images/gmiMapOver.jpg";
    document.getElementById("mapInterface").src = "images/gmiOver.jpg";
}
