// sprawdzanie notyfikacji odpalamy po każdym załadowaniu strony
$(document).ready(function() {
	$(document).getNotifications();
});

$(document).ready(function() {
  $("a[rel='colorbox']").colorbox();
});

// galerie
$(document).ready(function() {
  $("img.galleryItem").each(function(i, e) {
    $(e).attr("src", $(e).attr("rel"));
  });
  $("a[rel='gallery']").colorbox({width:"75%", height:"75%"});
});

$(document).ready(function() {
  $("a.delete").click(function(e) {
    var answer = confirm("Czy jesteś pewien, że chcesz to usunąć?");
    if (!answer) {
      e.preventDefault();
    }
  });
});


// tabele
//tabele
$(document).ready(function() {
  $("table.sortable").tablesorter();
});

// edytor
$(document).ready(function() {
  $('#articleEditor').rte({media_url: "img/system/editor/", content_css_url: "css/css.css"});
});

// form z input type=file
// form musi mieć id=fileUpload
// wiadomośc jest zwracana do #notifArea przez notify()
$(document).ready(function() { 
    var options = { 
        target:        '#notifArea',   // target element(s) to be updated with server response 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#fileUpload').ajaxForm(options); 
}); 
 
// pre-submit callback 
function showRequest(formData, jqForm, options) { 
    $("#notifArea").notify("<div class='information'>Wysyłanie pliku</div>");  
    // here we could return false to prevent the form from being submitted; 
    // returning anything other than false will allow the form submit to continue 
    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText, xhr, $form)  { 
  $("#notifArea").notify("<div class='notification'>Zapisano plik</div>'");
} 
