$(document).ready(function(){
	$("form.ajax").submit(function(){
		return emuars.ajaxForm(this);
	});
});

var emuars = {
	ajaxForm: function(form){
		if($("#ajaxsubmit").length < 1){
			$('<iframe id="ajaxsubmit" name="ajaxsubmit" style="display: none;"></iframe>').appendTo("body");
		}
		$(form).attr("target", "ajaxsubmit");
		return true;
	},
	
	approveUser: function(id, e){
		$(e).hide();
		$.get("/emuars/ajax/users/approve.php?id="+id);
	},
	
	removeUser: function(id, e){
		if(!confirm("Tiešām vēlies dzēst šo lietotāju no autoru saraksta?")){
			return false;
		}
		$(e).parent().hide();
		$.get("/emuars/ajax/users/remove.php?id="+id);
	}
}