WebFontConfig = {
  google: { families: [ 'Droid Sans','Droid Sans Mono','Arvo','Arimo','Cantarell','Crimson Text' ] }
};
(function() {
  var wf = document.createElement('script');
  wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  wf.type = 'text/javascript';
  wf.async = 'true';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(wf, s);
})();

$(document).ready(function() {
// MEGAMENU
  function addMega(){
    $(this).addClass("hovering");
    }
  function removeMega(){
    $(this).removeClass("hovering");
  }
  var megaConfig = {    
    interval: 100,
    sensitivity: 4, 
    over: addMega,
    timeout: 300,
    out: removeMega
  };
  $("#nav li.main").hoverIntent(megaConfig);
  
  var ntFirst = 0;
  var ntSpeed = 700;
  var ntPause = 7000;
    function removeFirst(){
      ntFirst = $('ul.news-ticker li:first').html();
      $('ul.news-ticker li:first')
        .animate({opacity: 0, height: '0px', marginTop: '-9px'}, ntSpeed)
      .fadeOut('slow', function() {$(this).remove();});
      addLast(ntFirst);
    }
    function addLast(ntSpeed){
      var ntLast = '<li style="display:none">'+ntFirst+'</li>';
      $('ul.news-ticker').append(ntLast)
      $('ul.news-ticker li:last')
        .animate({opacity: 1}, ntSpeed)
      .fadeIn('slow')
    }
  interval = setInterval(removeFirst, ntPause);
      
  $('ul.slideshow').cycle({
    fx:'fade',timeout:7000,speed:1000
  });
      
      $("a[rel=gallery]").fancybox({
        'transitionIn'    : 'none',
        'transitionOut'    : 'none',
        'titlePosition'   : 'over',
        'titleFormat'    : function(title, currentArray, currentIndex, currentOpts) {
          return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }
      });
});
