var deleteDocumentAjax = function(container) {
	 
    var params = new Array;
    var r = confirm('Czy na pewno chcesz usunąć ten dokument?');
    if (r == true) {
	    params[0] = $("#form :input[name='module']").val(); 
	    params[1] = $("input[name='record']").val();
	    jQuery.ajax({
	        type : 'POST',
	        url : 'index.php?entryPoint=HandleEcmAjax',
	        data : {
	            ecmclass : 'EcmDeleteDocument',
	            job : 'deleteDocument',
	            params : utf8_to_b64(JSON.stringifyNoSecurity(params)),
	        },
	        dataType : 'json',
	        async : false,
	        success : function(response) {
	        	if(response==1){
	        		$('#sendreturn').html('Usunięte!');
	        		$('#sendreturn').show();
	        		window.location = 'index.php?module='+params[0]+'&action=ListView';
	        	} else {
	        		$('#sendreturn').html('Błąd');
	        		$('#sendreturn').show();
	        	}
	            return;
	        },
	        error : function(xhr, ajaxOptions, thrownError) {
	            console.log(thrownError);
	        }
	    });
    }
 //   $('#div_send').hide();
}
var cancelDocumentAjax = function(container) {
	 
    var params = new Array;
    var r = confirm('Czy na pewno chcesz anulować ten dokument?');
    if (r == true) {
	    params[0] = $("#form :input[name='module']").val(); 
	    params[1] = $("input[name='record']").val();
	    jQuery.ajax({
	        type : 'POST',
	        url : 'index.php?entryPoint=HandleEcmAjax',
	        data : {
	            ecmclass : 'EcmDeleteDocument',
	            job : 'cancelDocument',
	            params : utf8_to_b64(JSON.stringifyNoSecurity(params)),
	        },
	        dataType : 'json',
	        async : false,
	        success : function(response) {
	        	if(response==1){
	        		$('#sendreturn').html('Anulowane!');
	        		$('#sendreturn').show();
	        		window.location = 'index.php?module='+params[0]+'&action=ListView';
	        	} else {
	        		$('#sendreturn').html('Błąd');
	        		$('#sendreturn').show();
	        	}
	            return;
	        },
	        error : function(xhr, ajaxOptions, thrownError) {
	            console.log(thrownError);
	        }
	    });
    }
 //   $('#div_send').hide();
}