$(document).ready(function()
{
  $(".calendar ul li a").click(function()
  {
    $(".calendar ul li").each(function()
    {
      $(this).removeClass("selected");
    });

    $(this).parent().addClass("selected");

    $("input[name='date']").attr("value", $(this).attr('rel'));
    return false;
  });

  $(".music li span a").click(function()
  {
    $(this).parent().children().each(function()
    {
      $(this).removeClass("selected");
    });

    $(this).addClass("selected");

    var rel = $(this).parent().attr("rel");
    $("input[name='" + rel + "']").attr("value", $(this).text());

    return false;
  });

  $("select#emplacement-select").change(function()
  {
    $("#emplacement").html("");

    if($(this).attr("value") != -2)
    {
      var url = "http://www.beat-mobile.com/soumission/emplacement/" + $(this).attr("value");
      $.get(url, function(data)
      {
        $("#emplacement").html(data);
      });

      if($(this).attr("value") != -1)
      {
        $("textarea#emplacement-infos").focus();
      }
    }
  });
});