function cridaAJAX_daniel(url,callback_func,loading_func,method) {
		// URL de l'aplicació AJAX
		
		//var urlAjaxGET=(typeof urlAjax == "undefined") ? "crides/getExemple.php" : urlAjax;
		
		
		var url=(typeof url == "undefined") ? "crides/getExemple.php" : url;
		var params="";

		try{
			params=url.split('?')[1];
			url=url.split('?')[0];
		}catch(e){}
		
		if(typeof method == "undefined") method = 'GET';
	
		try{
			target=params.split('target=')[1].split('&')[0];
		}catch(e){
			target="";	
		}
		
		
		// Declarem i instanciem un objecte tipus petició HTTP
		var httpRequest;
	    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
	        httpRequest = new XMLHttpRequest();
	        if (httpRequest.overrideMimeType) {
	            httpRequest.overrideMimeType('text/xml');
	        }
	    } else if (window.ActiveXObject) { // IE
	        try {
	            httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	        } catch (e) {
	            try {
	                httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	            } catch (e) {}
	        }
	    }
		
	    if (!httpRequest) {
	        alert(error_ajax);
	        return false;
	    }
    

		if(typeof callback_func == "undefined") callback_func = default_ajax_callback_func;
		if(typeof loading_func == "undefined") loading_func = default_ajax_loading_func;		

		httpRequest.onreadystatechange = function () {
											if (httpRequest.readyState <4) {
												if(target.length>0){
													loading_func(target);
												}else{
													loading_func();
												}
											}
											if (httpRequest.readyState == 4) {
												if (httpRequest.status == 200) {
													
													callback_func(httpRequest.responseXML);
										
												} else {
													alert("AJAX error");
												}
											}
										}		

    // Fem la petició
	if(method=="POST"){
		httpRequest.open('POST', url+"?nocache="+Math.random(), true)
		httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		httpRequest.setRequestHeader("Content-length", params.length);
		httpRequest.setRequestHeader("Connection", "close");
		httpRequest.send(params);
	}else{
		url = url+"?"+params+"&nocache="+Math.random();
		httpRequest.open('GET', url, true);
		httpRequest.send(null);
	}
}




function default_ajax_callback_func(xmlDoc){

	try{
	
		var	target="taula_resultats";//xmlDoc.getElementsByTagName("target")[0].firstChild.data;
		var html=xmlDoc.getElementsByTagName("html");
	
		document.getElementById(target).innerHTML="";
		for (i=0;i<html.length;i++) {
			document.getElementById(target).innerHTML+=html[i].firstChild.data;
		}
		
	}catch(e){
		alert("AJAX default callback");	
	}
}


function default_ajax_loading_func(target){

	try{
		//document.getElementById(target).innerHTML="carregant...";
	}catch(e){
		//alert("AJAX loading");
	}
}

