documentLoad = false;
var allowHover = true;
var isRightSide = false;

$(document).ready(function() {
  /* set custom fonts */
  Cufon.replace('#footer li a, .over .sidebar li a', { fontFamily: 'Avenir LT Std', hover:true });
  /* Cufon.replace('.left-content h1, .inner-right-content h2, #lightbox-form h1, .demensen-detail h1, h4, #carousel a,', { fontFamily: 'Minion Pro' }); */

  /* set fancybox */
  $("a#form").fancybox({
    'hideOnContentClick': false,
    'width': 620,
        'height' : 450,
        'titleShow': 'false',
        'overlayOpacity': 0.5,
        'overlayColor': '#000',
        'scrolling': 'auto',
        'type': 'iframe',
        'padding': 0,
        'margin': 0
  });
  initBijeenkomstBanner();
  /* Initialize umbraco custom slider for the homepage */
  initSlider();
  
  /* show next in collection on hover */
  $("#arrow-right").hover(
      function () {
      $(".volgende").fadeIn();
      $('.social').css( 'z-index', '100' );
      },
      function () {
      $(".volgende").hide();
      $('.social').css( 'z-index', '300' );
      }
  );
  /* show previous in collection on hover */
  $("#arrow-left").hover(
      function () {
      $(".vorige").fadeIn();
      },
      function () {
      $(".vorige").hide()
      }
  );
  /* image slider leftpane */
  $(".homepage .left").hover(function(){
    if (allowHover) {
        if(documentLoad==false){
          $(".left").delay(2000).animate({ width: "644px" }, 750);
          $('.quote').delay(2000).fadeIn();
          $('.quote-right').delay(2000).slideUp();
          documentLoad=true;
        } else {
          $(".left").stop().animate({ width: "644px" }, 750 ,function(){
            $('.quote').fadeIn();
            $('.quote-right').slideUp();
          });
        }
    }
  }, function(){
          $(".left").stop().animate({ width: "480px" }, 750 );
  
  });
  /* image slider rightpane */
  $(".homepage .right").hover(function(){
    isRightSide = true;
    if (allowHover) {
      if(documentLoad==false){
        // LRF next three lines > custom slider home
        $(".left").delay(2000).animate({ width: "335px" }, 750);
        $('.quote-right').delay(2000).slideDown();
        $('.quote').delay(2000).fadeOut();
        documentLoad=true;
      } else {
        $(".left").stop().animate({ width: "335px" }, 750, function(){
          $('.quote-right').slideDown();
          $('.quote').fadeOut();
        });
      }
    }
  }, function(){
        isRightSide = false;
        $(".left").stop().animate({ width: "480px" }, 750 );
  
  });
  
});
function initBijeenkomstBanner() {
  if (document.getElementById("bijeenkomstBanner") != null) {
    $("#bijeenkomstBanner").mouseenter(function() {
      // mouse-enter function
      $("#bijeenkomstBannerPush").animate({
        height: '0px'},
        500);
    });
    $("#bijeenkomstBanner").mouseleave(function() {
      // mouse-leave function
      $("#bijeenkomstBannerPush").animate({
        height: '60px'},
        500);
    });
        
  }
}



