// JavaScript Document

// wait until document is fully scriptable
$(document).ready(function() {
	// select #flowplanes and make it scrollable. use circular and navigator plugins
	$("#flowpanes").scrollable({size: 1, clickable: false}).circular().navigator({
		// select #flowtabs to be used as navigator
		navi: "#flowtabs",
		// select A tags inside the navigator to work as items (not direct children)
		naviItem: 'a',
		// assign "current" class name for the active A tag inside navigator
		activeClass: 'current'
	});
});

$(function() { 
 
    // if the function argument is given to overlay, 
    // it is assumed to be the onBeforeLoad event listener 
    $("a.pageLink[rel]").overlay({ 
        effect: 'apple', 
        onBeforeLoad: function() { 
            var wrap = this.getContent().find(".contentWrap"); 
            wrap.load(this.getTrigger().attr("href")); 
        } 
    }); 
});


$(document).ready(function() {
  positionFooter();
  
  $(window)
    .scroll(positionFooter)
    .resize(positionFooter);
  
  function positionFooter() {
    var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
    if(docHeight < $(window).height()){
      var diff = $(window).height() - docHeight;
      if (!$("#sticky-footer-push").length > 0) {
        $("#footer").before('<div id="sticky-footer-push"></div>');
      }
      $("#sticky-footer-push").height(diff);
    }   
  }
});
