<!--
var historial = [0];
var nH = 0;
var actual = 0;

window.onbeforeunload = null;/*function () {
	actual = actual - 1;
	var pag = historial[actual];
	obrir(111);
   //return "Esteu segurs que voleu abandonar la pàgina."
  // return;
}
*/

function obrir(par){

	//alert(document.getElementById('pagina1').value);
	nh = historial.push(par);
	actual = nH;
	//alert(nh+" "+historial[nh-1]);
	//alert(par);
	//FAjax('lib/getPaginaAJAX.php','capaprincipal','pagina='+par,'POST');
	location.href = "./index.php?pagina="+par;
	//document.write(location.href);
}

function actualitzaIncidencies(par){
    FAjax('lib/getPaginaAJAX.php','capaincidencies','pagina='+par,'POST');
}

function setMenu(par,pag){
	//alert(document.getElementById('pagina1').value);
	nh = historial.push(pag);
	//FAjax('lib/responseAJAX.php','menus','pagina='+ par,'POST');
	//alert('Hola');
	nh = historial.push(par);
	//alert(nh+" "+historial[nh-1]);
	
	//FAjax('lib/getPaginaAJAX.php','capaprincipal','pagina='+ pag,'POST');
	location.href = "./index.php?pagina="+pag+"&menu="+par;
}

function setIdioma(idioma, par){
	//FAjax('setIdioma.php','capabandera','idioma='+idioma,'POST');
	//Carregar pestanyes
	//FAjax('lib/setPestanyes.php','tabsF','pagina=' + par,'POST');
	//Carregar menus en el nou idioma
	//FAjax('lib/responseAJAX.php','menus','pagina=' + par,'POST');
	//Carregar la pàgina actual en el nou idioma
	//FAjax('lib/getPaginaAJAX.php','capaprincipal','ultima=actual','POST');
	var pagina = document.getElementById('idPagina');
	
	location.href = "./index.php?idioma="+idioma+"&pagina="+pagina.value;
}

function creaAjax(){
         var objetoAjax=false;
         try {
          /*Para navegadores distintos a internet explorer*/
          objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
          try {
                   /*Para explorer*/
                   objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
                   }
                   catch (E) {
                   objetoAjax = false;
          }
         }

         if (!objetoAjax && typeof XMLHttpRequest!='undefined') {
          objetoAjax = new XMLHttpRequest();
         }
         return objetoAjax;
}

function FAjax (url,capa,valores,metodo){
          var ajax=creaAjax();
          var capaContenedora = document.getElementById(capa);

/*Creamos y ejecutamos la instancia si el metodo elegido es POST*/
if(metodo.toUpperCase()=='POST'){
         ajax.open ('POST', url, true);
         ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                          capaContenedora.innerHTML="Carregant.......";
         }
         else if (ajax.readyState==4){
                   if(ajax.status==200)
                   {
                        document.getElementById(capa).innerHTML=ajax.responseText;
                   }
                   else if(ajax.status==404)
                                             {

                            capaContenedora.innerHTML = "No s'ha trobat l'adre�a";
                                             }
                           else
                                             {
                            capaContenedora.innerHTML = "Error: ".ajax.status;
                                             }
                                    }
                  }
         ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
         ajax.send(valores);
         return;
}
/*Creamos y ejecutamos la instancia si el metodo elegido es GET*/
if (metodo.toUpperCase()=='GET'){

         ajax.open ('GET', url, true);
         ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                                      capaContenedora.innerHTML="Carregant.......";
         }
         else if (ajax.readyState==4){
                   if(ajax.status==200){
                                             document.getElementById(capa).innerHTML=ajax.responseText;
                   }
                   else if(ajax.status==404)
                                             {

                            capaContenedora.innerHTML = "No s'ha trobat l'adre�a";
                                             }
                                             else
                                             {
                            capaContenedora.innerHTML = "Error: ".ajax.status;
                                             }
                                    }
                  }
         ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
         ajax.send(null);
         return
}
}
-->
