//dynamic asides hover intent config
var config = {    
    sensitivity: 9, // number = sensitivity threshold (must be 1 or higher)    
    interval: 150, // number = milliseconds for onMouseOver polling interval    
    over: function(){
      $(this).css({cursor:'default'});
      $(this).animate({height:'183px'},200,'swing',function(){$(this).addClass('open');});
      
    }, // function = onMouseOver callback (REQUIRED)    
    timeout: 200, // number = milliseconds delay before onMouseOut    
    out: function(){
      $(this).animate({height:'0px'},400,'swing',function(){$(this).removeClass('open');$(this).css({cursor:'pointer'});});} // function = onMouseOut callback (REQUIRED)    
};

//Font replacement
Cufon.replace('h1');
    $(document).ready(function(){ 
    //setup dynamic asides
      $(".flyout").hoverIntent(config);
    //setup essential stats greybox
      $("#essential-stats-data").gbxInit({
        left:0,
        width:750
      });
      $("#essential-stats").click(function() {
        $("#essential-stats-data").gbxShow();
        return false;
      });
      $(".close-overlay").click(function() {
        $("#essential-stats-data").gbxHide();
        return false;
      });
	  //setup gallery greybox
      var GB_ROOT_DIR = "http://bsg.local/greybox/";
      if($(".gallery-list a").length > 0)
      {
        if($('#gbox_container').length == 0)
        {
          var gbox_container = document.createElement('div');
          gbox_container.id = 'gbox_container';
          document.body.appendChild(gbox_container);
          $("#gbox_container").append('<a href="#" class="close-gallery" style="color: #FFF;background-color:#000;position: absolute;top: 0px;right: 0px;">Close</a>');
        }
        $("#gbox_container").gbxInit({
          left:0,
          width:900,
          border:"1px solid #FFF",
          top:50,
          height:600,
          position: 'relative',
          display: 'none'
        });
        $(".gallery-list a").click(function() {
          $("#gbox_container").append('<img src="' + $(this).attr('href') + '" alt="" />');
          $("#gbox_container").gbxShow();
          return false;
        });
        $(".close-gallery").click(function() {
          $("#gbox_container").gbxHide();
          $("#gbox_container").remove('img');
          return false;
        });
      }
	  //setup gallery tabs
      $("#showcase").tabs({fx: { opacity: 'toggle', duration: '1000' }}).tabs( 'rotate' , 5000 );
	  
    });