$(document).ready(function(){
  clientsPanel.init();
  careersPanel.init();

  fixExternalLinks();
  initNav();
});


function fixExternalLinks() {
  $("a:not([href*='65.181.165.4'])").not("[href*='lextant.com']").not("[href^='#']").not("[href^='/']").not("[href*='javascript']").attr('target', '_blank');
}


function initNav() {
	if (section.length) {
		$("#nav-"+section).addClass('current');
	}
}

function haveSection() {
	return (section != "{embed:section}");
}

var clientsPanel = new function() {
  this.init = function() {
    $(".clients-panel-trigger").colorbox({
      returnFocus: false,
      width:"668px", 
      height: "458px",
      top: "92px",
      inline:true, 
      scrolling: false,
      transition: "none",
      href:"#clients-panel",
      onComplete:function(){ 
        $('<a href="#" id="colorbox-close">Close</a>').appendTo('#colorbox');
      }
    });
    $('#colorbox-close').live('click', function(e) {
      e.preventDefault();
      $.colorbox.close();
    });
  }
};

var careersPanel = new function() {
  this.init = function() {
    $(".careers-panel-trigger").colorbox({
      returnFocus: false,
      width:"668px", 
      height: "437px",
      top: "92px",
      inline:true, 
      scrolling: false,
      transition: "none",
      href:"#careers-panel",
      onComplete:function(){ 
        $('<a href="#" id="colorbox-close">Close</a>').appendTo('#colorbox');
      }
    });
    $('#colorbox-close').live('click', function(e) {
      e.preventDefault();
      $.colorbox.close();
    });
  }
};

// interior page carousels
$('.news-slider').nivoSlider({
  effect: 'fade',
  directionNavHide: false,
  controlNav: false,
  manualAdvance: true
});

// interior page carousels
$('.sidebar-slider').nivoSlider({
  effect: 'fade',
  directionNavHide: false,
  manualAdvance: true,
  captionOpacity: 1
});



