$(function() {

  //google maps
  function initialize_google_maps() {
    // coordinates
    var LatLng = new google.maps.LatLng(52.297325, 4.703884);

    // map options
    var options= {
      zoom: 15,
      center: LatLng,
      mapTypeControl: true,
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
      mapTypeId: google.maps.MapTypeId.TERRAIN
    };

    // make map
    var map = new google.maps.Map(
      document.getElementById("map_canvas"),
      options
    );

    // Add marker to the map
    var image = new google.maps.MarkerImage(
      'images/google-maps/marker-image.png',
      new google.maps.Size(56, 40),
      new google.maps.Point(0,0),
      new google.maps.Point(11, 34)
    );
    var shadow = new google.maps.MarkerImage(
      'images/google-maps/marker-shadow.png',
      new google.maps.Size(56, 40),
      new google.maps.Point(0,0),
      new google.maps.Point(11, 34)
    );
    var shape = {
      coord: [2,  39,
              2,  8,
              15, 8,
              15, 20,
              49, 20,
              49, 27,
              15, 27,
              15, 39],
      type: 'poly'
    };
    var marker = new google.maps.Marker({
      position: LatLng,
      map: map,
      shadow: shadow,
      icon: image,
      shape: shape
    });
  }

  initialize_google_maps();

  // contact form
  $('#contact-form li').removeClass('highlight');
  $('#contact-form button').append('<span class="hover" />').each(function() {
    var $span = $('> span', this).css('opacity', 0);
    $(this).hover(function () {
      // on hover
      $span.stop().animate({
          'opacity': 1
        }, 250,'easeOutSine');
    }, function() {
      // off hover
      $span.stop().animate({
          'opacity': 0
        }, 1500,'easeOutQuad');
    });
  });

  // expand text-area
  $('textarea[class*=expand]').autogrow({
    'speedShrink':     500,
    'easeExpand':      'easeOutQuad',
    'easeShrink':      'easeOutSine',
    'extraGrowth':     48,
    'extraWhitespace': 16
  });

});
