<!-- necessary for google maps polyline drawing in IE -->
$(function(){     
     $('#map').hover(function(){
          $('#banner').fadeOut(2000);
     });
     $('.dmarker').each(function(){
          var startposition = $(this).position();
          $(this).data("startTop",startposition.top);
          $(this).data("startLeft",startposition.left);
          $(this).hide();
     });
     $("a.map").toggle(function(){
               $('#banner').fadeOut(500);
               var mclass = $(this).attr("title");
               //Return the map to the center and hide the google clinic markers.
               //map.returnToSavedPosition(); 
               $("#wyomap").fadeIn(100);                             
               $(this).addClass('active');
               //This code hid the google markers, but we are overlaying a map over it so it doesn't matter.
               /*for($i=0;$i<markers.length;$i++){
                    markers[$i].closeInfoWindow();
                    markers[$i].hide();
               }*/
               /*$('.dmarker').each(function(){
                    var top = $(this).data('startTop');
                    var left = $(this).data('startLeft');
                    $(this).stop().animate({'width':'0px','height':'0px','top':top+'px','left':left+'px'},1).fadeOut(1);
               });*/
               $('.'+mclass).show().each(function(){
                         var top = $(this).data("startTop");
                         var left = $(this).data("startLeft");
                         var width = $(this).attr('id');
                         var halfwidth = width/2;
                         top = top - halfwidth;
                         left = left - halfwidth;
                         if(width != 0)
                          {
                              $(this).animate({'width':width+'px','height':width+'px','top':top+'px','left':left+'px'},100);
                          }
               });
          },function(){
               var mclass = $(this).attr("title");
               //map.returnToSavedPosition();
               $(this).removeClass('active');
               $('.'+mclass).each(function(){
                    var top = $(this).data('startTop');
                    var left = $(this).data('startLeft');
                    $(this).animate({'width':'0px','height':'0px','top':top+'px','left':left+'px'},100).fadeOut(100);                              
               });
     });
     $("#showclinics").click(function() {
          //When showclinics is clicked, hide our maps and show the google clinic markers
          //$('#banner').fadeIn(100);
          $("#wyomap").fadeOut(100);
          $("a.map").removeClass('active');
          $("div.dmarker").fadeOut(100).each(function(){
               var top = $(this).data('startTop');
               var left = $(this).data('startLeft');
               $(this).css({'width':'0px','height':'0px','top':top+'px','left':left+'px'});                          
          });
          for($i=0;$i<markers.length;$i++){
               if(markers[$i].isHidden()){
                    markers[$i].show();
               }
          }          
          return false;
     });
});
