$(document).ready(function(){
  
  // Homepage Slideshow
  $("body.home header ul").cycle({
    height: '500px',
    width: '1020px',
    fx:     'scrollHorz',
    // cssBefore: {
    //         left: '1010px', 
    //         display: 'block' 
    //     }, 
    //     animIn:  { 
    //         left: 0
    //     }, 
    //     animOut: {  
    //         left: '-1020px' 
    //     },
    next: 'body.home header .next',
    prev: 'body.home header .previous',
    speed: 1200,
    timeout:0
  });
  
  // Infield Labels
  $("label").inFieldLabels();
    
  // Tabs
  $("#tabs").tabs("#tabs-content > div > div", {
    effect: 'slide'
  });
  
  // Coming Soon Message
  // $(".message > p a").fancybox({"padding":0, "overlayOpacity":.7,"overlayColor":"#333","autoDimensions":false,"width":900,"height":"auto","iframe":true});
  
  // Bio Popups
  $("#team a").fancybox({"padding":40, "overlayOpacity":.7,"overlayColor":"#333","autoDimensions":false,"width":600,"height":"auto"});
  
  // Social Hovers
  $("a.social").hover(function() {
      var thumbOver = $(this).find("img").attr("src");
      $(this).css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
      $(this).find("img").stop().fadeTo(200, 0 , function() {
        $(this).hide()
      });
    } , function() {
      $(this).find("img").stop().fadeTo(200, 1).show();
  });
  
  $('a.social').qtip({
    content: {
      text: false // Use each elements title attribute
    },
    show: {
      delay: 0
    },
    position: {
      target: 'mouse',
      corner: {
        target: 'topRight',
        tooltip: 'topRight'
      }
    },
    style: {
      background: '#000',
      border: {
        width: 1,
        radius: 4,
        color: '#000'
      },
      tip: {
        corner: 'topRight',
        size: {
          x: 10,
          y : 8
        }
      },
      padding: 2,
      color: '#ccc',
      name: 'dark'
    }
  });
  
  // Open Links in New Window
  $("a[rel=external]").click(function() {
    window.open( $(this).attr('href') );
    return false;
  });
  
  // Old Browsers Team Hovers
  $(".no-opacity #team li a div").hide();
  $(".no-opacity #team li").mouseenter(function() {
  	$(this).find("a div").show();
  }).mouseleave(function() {
  	$(this).find("a div").hide();
  });
  
});
