$(document).ready(function() {
  $('.logo img').click(function() {
    $('.tab_content').hide();
    $('#widget-nav a.selected').removeClass('selected');
    $('#start').show();
  });
  $('.subpages .logo').click(function() {
    window.location = '/home/index.htm';
  }); 
  $(function() {
    theRotator();
  });
  $(function() {$('.login').toggle(
    function(){ 
    $('.myAquentSection label').labelOver('over-apply');
    $('.myAquentSection').show('slow');
    //prevent click
    event.preventDefault ? event.preventDefault() : event.returnValue = false;
            
    },
    function(){ 
    $('.myAquentSection').hide('slow');
    }
    );
  });
  $(function() {
    $('.custom-select').find('li.option:not(.selected)').hide();
    $('.custom-select').hover(
    function() {
    $(this).find('li').show();
    },
    function() {
    $(this).find('li.option:not(.selected)').hide();
    }
    );
    //check for selecting a new option
    $('.custom-select li.option').live('click', function(event) {
              //prevent click
             //event.preventDefault();
              //first traverse up to the parent container of that list.
              //then find all the lis of that list
               $(this).parents('ul').find('li').each(
                    function(){
                    //this is now each LI in the list
                    $(this).removeClass('selected');
                    });
    //last cause of order            
              $(this).addClass('selected');
    //slide up the selected option
    $('li.option:not(.selected)').hide();
            });
  });
  function agentContent() {

  //When page loads...
  $('.agent-copy').hide(); //Hide all content
  $('#agent-nav li:first').addClass('selected').show(); //Activate first tab
  $('.agent-copy:first').show(); //Show first tab content
  $('#agent-content').removeClass('hide-onload');
  $('#agent-nav').removeClass('hide-onload');

  //On Click Event
    $('#agent-nav li').click(function() {

    $('#agent-nav li').removeClass('selected'); //Remove any 'active' class
    $(this).addClass('selected'); //Add 'active' class to selected tab
    $('.agent-copy').hide(); //Hide all tab content

    var activeTab = $(this).find('a:first').attr('href'); //Find the href attribute value to identify the active tab + content
    $(activeTab).show(); //Fade in the active ID content
    return false;
  });
  }
  $(function() {
    $('.custom-select').find('li.option:not(.selected)').hide();
    $('.custom-select').hover(
    function() {
    $(this).find('li').show();
    },
    function() {
    $(this).find('li.option:not(.selected)').hide();
    }
    );
    //check for selecting a new option
    $('.custom-select li.option').live('click', function(event) {
              //prevent click
             //event.preventDefault();
              //first traverse up to the parent container of that list.
              //then find all the lis of that list
               $(this).parents('ul').find('li').each(
                    function(){
                    //this is now each LI in the list
                    $(this).removeClass('selected');
                    });
    //last cause of order            
              $(this).addClass('selected');
    //slide up the selected option
    $('li.option:not(.selected)').hide();
            });
  });
  function tabs() {

  //When page loads...
  $('.tab_content').show();
  $('.tab_content').hide(); //Hide all content
  $('#widget-nav li:first a').addClass('selected').show(); //Activate first tab
  $('.tab_content:first').show(); //Show first tab content

  //On Click Event
    $('#widget-nav li a').click(function() {

    $('#widget-nav li a').removeClass('selected'); //Remove any 'active' class
    $(this).addClass('selected'); //Add 'active' class to selected tab
    $('.tab_content').hide(); //Hide all tab content

    var activeTab = $(this).attr('href'); //Find the href attribute value to identify the active tab + content
    $(activeTab).show(); //Fade in the active ID content
    return false;
  });
  }
  $(function() {
  if ( $('#widget-body').is(':hidden') ) {    
    tabs();    
    $('#widget-nav li a').click(function(){
    $('#widget-body').show('slow');
    //prevent click
    event.preventDefault ? event.preventDefault() : event.returnValue = false;
    });
  }
  else {
    tabs();
  }
  });
  $(function(){
  $('.close').click(function(){
    $('#widget-body').hide('slow');
    $('#widget-nav a.selected').removeClass('selected');
  });
  });
  $(function(){
  $('#ticker-box ul').show();
  if ($('#ticker li').length > 1){
      $('#ticker').list_ticker({
                speed:5000,
                effect:'fade'
        });
  };
   });
  $(function(){ 
    if ($('.agents').length){ 
      agentContent();
      $( '#jobs32' ).accordion({ active: false, autoHeight: false, header: '.faux-h3', collapsible: true, navigation: true});
      if(location.hash != "") {
      var id = window.location.hash
      $("#jobs32").accordion("activate", id);
      } else {
      agentContent();
      $( '#jobs32' ).accordion({ active: false, autoHeight: false, header: '.faux-h3', collapsible: true, navigation: true});
      };
    };
  });
  $(function() {  
    if($('#find-talent').length){
    $('.hide-onload').show();
    };
  });
  $(function(){
    $('select:not(.formalize)').customStyle();
  });
 });
