$(document).ready(function(){
  if($.browser.msie && $.browser.version < 7){
    $('#navigation').supersleight();
  }
  
  $("a.fancybox").fancybox({
    'speedIn'    :  600, 
    'speedOut'    :  200, 
    'overlayShow'  :  true,
    'hideOnContentClick' : false,
    'overlayOpacity' : 0.7,
    'width' : 400,
    'height' : 230
  });

  if($('.subnavigation ul li').length > 0){
    $('.subnavigation ul li ul').each(function(){
      if(!$(this).parent().hasClass('current')){
        $(this).css('display','none');
      }
    })
  }
  
  $('a.peopleClick').click(function(){
    ShowNavigation($(this));
  });
  
});

function ShowNavigation(ClickedElement){
  ClickedElement.next('ul').slideToggle();
}

var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;

function initialize() {
  directionsDisplay = new google.maps.DirectionsRenderer();
  var myOptions = {
    zoom: 13,
    disableDefaultUI: true,
    navigationControl: true,
    center: new google.maps.LatLng(50.849847,5.701574),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map"),
                                myOptions);

  var image = new google.maps.MarkerImage('/pics/logo_maps.png', 
                                          new google.maps.Size(108,48), 
                                          new google.maps.Point(0,0),
                                          new google.maps.Point(52,47));
  var myLatLng = new google.maps.LatLng(50.849847,5.701574);
  var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image
  });
  directionsDisplay.setMap(map);
  directionsDisplay.setPanel(document.getElementById("directions"));
}

function calcRoute(StartLocation) {
  var start = StartLocation; 
  var end = "Wilhelminasingel 45, Maastricht, Nederland";
  var request = {
      origin:start, 
      destination:end,
      travelMode: google.maps.DirectionsTravelMode.DRIVING,
      unitSystem: google.maps.DirectionsUnitSystem.METRIC
  };
  directionsService.route(request, function(response, status) {
    if (status == google.maps.DirectionsStatus.OK) {
      directionsDisplay.setDirections(response);
    }
  });
  return false;
}

