$(function ($) {

// Simple modal for Tee Times
    // Load dialog on page load
    //$('#basic-modal-content').modal();

    // Load dialog on click
	$('.basic-modal').click(function (e) {
		$('#basic-modal-content').modal();

		return false;
	});

// Scroller for Twiiter Feed
$("ul.marquee").marquee();

//Maps on WGG site
  var wgg = new google.maps.LatLng(45.03732, -92.8688),
  pointToMoveTo,
  first = true,
  curMarker = new google.maps.Marker({}),
  $el;

  var myOptions = {
      zoom: 10,
      center: wgg,
      mapTypeId: google.maps.MapTypeId.ROADMAP
  };

  var map = new google.maps.Map($("#map_canvas")[0], myOptions);

  $("#locations li").mouseenter(function () {

      $el = $(this);

      if (!$el.hasClass("hover")) {

          $("#locations li").removeClass("hover");
          $el.addClass("hover");

          if (!first) {

              // Clear current marker
              curMarker.setMap();

              // map.setZoom(10);
          }

          // Move (pan) map to new location
          pointToMoveTo = new google.maps.LatLng($el.attr("data-geo-lat"), $el.attr("data-geo-long"));
          map.panTo(pointToMoveTo);

          // Add new marker - icon: "http://google-maps-icons.googlecode.com/files/golf.png"

          curMarker = new google.maps.Marker({
              position: pointToMoveTo,
              map: map,
          });

          // On click, zoom map
          google.maps.event.addListener(curMarker, 'click', function () {
              map.setZoom(14);
          });

          // Fill more info area
          $("#more-info")
  .find("h2")
      .html($el.find("h3").html())
      .end()
  .find("p")
      .html($el.find(".longdesc").html());

          // No longer the first time through (re: marker clearing)        
          first = false;
      }

  });

  $("#locations li:first").trigger("mouseenter");

	
});

