jQuery(document).ready(function($) {
    $(".main-nav li").hover(
            function() {
                $(this).children("ul").show();
                $(this).children("a").addClass("open");
            },
            function() {
                $(this).children("ul").hide();
                $(this).children("a").removeClass("open");
            }
            );
    if ($(".message").length){
      animateMessage();
    }
    $(".sitemap .toggler").click(function(event) {
        event.preventDefault();
        $(".sitemap ul.sitenav, .toggler .plus, .toggler .minus").toggle();
    });

    if ($("#map_canvas").length) {
        mapInitialize();
    }
    if ($('.notification').html()){
      if ($('.notification').html().replace(/\s*/, '').length > 0) {
          $('.notification').fadeIn();
      }
    }

});
var gmap = null;
var openmarker = null;
function mapInitialize() {
    var myLatlng = new google.maps.LatLng(52.135511, 5.26062);
    var myOptions = {
        zoom: 7,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    gmap = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);
}

function animateMessage(){
  $(".message").addClass("hold");
  $(".message").first().animate({
    right: '75'
  }, 4000, function() {
    $(".message").first().delay(10000).animate({
      right: '1000'
    }, 4000, function(){
      $(this).css("right","-830px");
      $(".message-animator").append($(this));
      animateMessage();
    });
  });
}
