$(document).ready(function(){

  //make external links & pdf files open in a new window
  $("a").each(function(){
    if( $(this).attr('href') ){
      href = $(this).attr('href');
      base = basedir.split('http://').join('').split('https://').join('');
      if( (href.match('http://') || href.match('https://') ) && (!href.match(base) || href.match(/\.pdf|.jpg|.gif|.doc/i)) ){
        $(this).click(function(){
          window.open($(this).attr('href'));
          return false;
        });
      }
    }
  });
  
  //set navigation
  $("#content_67 li ul li.selected, #content_60 .links li ul li.selected").parent().parent().addClass("selected");
  $("#content_67 li.selected:has('ul')").css({ margin: '0 0 5px 0' });
  
  //button events
  $("button")
    .mouseover(function(){ $(this).addClass("hover") })
    .mouseout(function(){ $(this).removeClass("hover") });
  $("button:disabled").addClass("disabled");
  
  //fix checkbox/radio/file inputs
  $("input[type='checkbox'], input[type='radio'], input[type='file']").css({ width: 'auto' });
  $("input[type='file']").css({ color: 'black' });
  
  //confirmation alerts
  $(".confirm").click(function(){
    action = $(this).attr("title").substr(0,1).toLowerCase() + $(this).attr("title").substr(1);
    if( !confirm("Are you sure you want to "+action+"?") ){ return false; }
  });
  
});
