$(document).ready(function(){
  $("a.delete").click(function(){
    if(confirm("Are you sure?")) {
      var url = $(this).attr("href") + ".json";
      $.post(url, {}, function(data){
          if(true == data.success){
            window.location.reload();
          }
        },
        "json"
      );
    }

    return false;
  });

  $(".date").datepicker({ dateFormat: 'yy-mm-dd' });

  $(".confirm").click(function(){
    return confirm("Are you sure?");
  });

  /* if(0 < $(".msgs").length) {
    setTimeout('$(".msgs").fadeOut();', 4000);
  } */

  $("input.chkall").click(function(){
    var chk = $(this).is(":checked");
    var cls = $(this).attr("name");
    var selector = "input." + cls;

    $(selector).attr("checked", chk);
  });

  if(0 < $(".dashboard-link").length) {
    var prev = $(".dashboard-link").prev();
    prev.css("margin-bottom", "4px");
  }
});

