// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function(){
//  $("ul#tabs").tabs();

  $("div.border ul:last-child").addClass("bottom");
  $("div.border p:last-child").addClass("bottom");
  $("div.border ol:last-child").addClass("bottom");

  $('#quotes').cycle({
    prev:   '#prev',
    next:   '#next',
    timeout: 0
  });

  $('#state').change(stateSelected);
});

function sortOptions(expr) {
  $(expr + '>option').tsort();
}

function stateSelected() {
  var state = $("#state option:selected").val();
  if (state != '') {
    $("div.career_fair").fadeOut("slow");
    $('div#advertisement').remove();
    jQuery.each(state.split(","), function() {
      $('.' + this).fadeIn("slow");
    });
    var career_fair_link = "<p>http://careerfairs.recruitmilitary.com/"
    $("#share_url").html(career_fair_link + "?states=" + state + "</p>")
  } else {
    $('div.career_fair').fadeIn("slow");
    $("#share_url").html("http://careerfairs.recruitmilitary.com" + "</p>")
  }
}