         function checkNumberTextBox(evt, objeto) {
         
            /*IE*/
	        if (document.all && document.getElementById)
	        {
	            var valorCampo = window.event.srcElement.value;
	            var valorKeyCode = window.event.keyCode;
	            
	            //Carácteres no imprimibles
	            if (valorKeyCode < 32) {
	                return true;
	            }
	            
	            //"." -> ","
	            if (valorKeyCode == 46) {
                    valorKeyCode = 44;
                }           
                if (valorKeyCode == 44) {
                    if (valorCampo.indexOf(",") == -1) {
	                    window.event.srcElement.value += ",";
                    }
                    window.event.returnValue = false;
                    return false;                    
                }
                else
                {
                    //[0..9]
                    if (valorKeyCode < 48 || 
                        valorKeyCode > 57) {         

                        window.event.returnValue = false;
                        return false;
                    }        
                }                              
	        }
	        else /*ES FIREFOX*/
	        {
	            var valorCampo = evt.target.value;
	            var valorKeyCode = evt.which;
	            
	            //Carácteres no imprimibles
	            if (valorKeyCode < 32) {
	                return true;
	            }
	            
	            //"." -> ","
	            if (valorKeyCode == 46) {
                    valorKeyCode = 44;
                }           
                if (valorKeyCode == 44) {
                    if (valorCampo.indexOf(",") == -1) {
	                    evt.target.value += ",";
                    }
                    evt.preventDefault();
                    return false;
                }    
                else 
                {
                    //[0..9]
                    if (valorKeyCode < 48 || 
                        valorKeyCode > 57) { 

                        evt.preventDefault();
                        return false;
                    }
                }                                                          
	        }
            return true;            
        }                
        
        function checkIntegerTextBox(evt, objeto) {
        
            /*IE*/
	        if (document.all && document.getElementById)
	        {
	            var valorKeyCode = window.event.keyCode;
	            
	            //Carácteres no imprimibles
	            if (valorKeyCode < 32) {
	                return true;
	            }
	            
	            //[0..9]
	            if (valorKeyCode < 48 || 
	                valorKeyCode > 57) {         

                    window.event.returnValue = false;
                    return false;
                }
	        }
	        else/*ES FIREFOX*/
	        {
	            var valorKeyCode = evt.which;
	            
	            //Carácteres no imprimibles
	            if (valorKeyCode < 32) {
	                return true;
	            }
	            
	            //[0..9]
	            if (valorKeyCode < 48 || 
	                valorKeyCode > 57) { 

                    evt.preventDefault();
                    return false;
                }
	        }
            return true;
        } 
        
        function startListSecteWrapper(){
            try{
                //debugger;
                startListSecte();
                RoundedTop("div#modalPopUpContainerBody", "Transparent",  "#996633");
                RoundedBottom("div#modalPopUpContainerBody", "Transparent", "#996633");
            }catch(err){
                try{
                   //expose(err, document.getElementById("mensajesErrorJavascript"));
                   expose(err, "popup");
                }catch(err2){
                    alert(err2.description);
                }
            }
        }
        
        function ActivarTab(tab, enable)
        {
            if (tab != null && tab != undefined && tab.className != undefined && tab.className!="separadorActiu")
            {
                if (enable)
                {
			        tab.className+="pintat";
                }
                else
                {
			        tab.className = tab.className.replace("pintat","");
                }
            }
        }
        
        function startListSecte(){
	        /*Treiem separadors tema actiu*/
            
	        /*IE*/
	        if (document.all&&document.getElementById){
	            
		        /*POSEM ELS HOVERS DE LA SELECCIO DE LA SEGONA LLISTA SUB-SUBTEMES I PINTEM SEPARADORS*/
		        navRoot = document.getElementById("navlist");
		        for (i=0; i<navRoot.childNodes.length; i++) 
		        {
			        node = navRoot.childNodes[i];
			        if (node.nodeName=="LI" && node.className=="element") 
			        {	
        						
				        node.onmouseover=function()
					        {
						        this.className+=" sobre";
						        ActivarTab(this.nextSibling, true);
						        ActivarTab(this.previousSibling, true);
					        }
					        node.onmouseout=function() 
					        {
						        this.className = this.className.replace(" sobre","");
						        ActivarTab(this.nextSibling, false);
						        ActivarTab(this.previousSibling, false);
					        }
			        }
			        else if(node.nodeName=="LI" && node.className=="active2")
			        {
				        if(node.nextSibling != null && node.nextSibling != undefined)
				        {
					        node.nextSibling.className = "separadorActiu";
				        }
				        if(node.previousSibling != null && node.previousSibling != undefined)
				        {
					        node.previousSibling.className = "separadorActiu";					
				        }
			        }
		        }
	        }
	        else/*ES FIREFOX*/
	        {
		        /*POSEM ELS HOVERS DE LA SELECCIO DE LA SEGONA LLISTA SUB-SUBTEMES I PINTEM SEPARADORS*/
		        navRoot = document.getElementById("navlist");
        		
		        for (i=0; i<navRoot.childNodes.length; i++) 
		        {
			        node = navRoot.childNodes[i];
			        if (node.nodeName=="LI" && node.className=="element") 
			        {			
        			    
				        node.onmouseover=function()
					        {
						        ActivarTab(this.nextSibling, true);
						        ActivarTab(this.previousSibling, true);
					        }
					        node.onmouseout=function() 
					        {
						        ActivarTab(this.nextSibling, false);
						        ActivarTab(this.previousSibling, false);
					        }
			        }
			        else if(node.nodeName=="LI" && node.className=="active2")
			        {
				        if(node.nextSibling != null && node.nextSibling != undefined)
				        {
					        node.nextSibling.className = "separadorActiu";
				        }
				        if(node.previousSibling != null && node.previousSibling != undefined)
				        {
					        node.previousSibling.className = "separadorActiu";
				        }
			        }
		        }
	        }
    	    //posicionaSecte();
        }
        
        function posicionaSecte(){ 
	        if(document.all){
		        ample = document.body.offsetWidth;
		        alt = document.body.offsetHeight;
		        
		        if(ample == 0){
		            ample = document.documentElement.offsetWidth;
		        }
		        if(alt==0){
		            //debugger;
		            var data = getWindowData();
		            alt = document.documentElement.offsetHeight;
		        }
		        
	        }
	        else{
		        ample = innerWidth;
		        alt = innerHeight;
	        }
	       ample = 921;
	        // Dimensions i Posició capçalera
	        document.getElementById("bodyDiv").style.left = "20px"; 
	        document.getElementById("bodyDiv").style.position = "absolute";
	        document.getElementById("bodyDiv").style.top = "0px";
	         document.getElementById("bodyDiv").style.marginLeft = "0px";
	        document.getElementById("bodyDiv").style.marginTop = "0px";
	        document.getElementById("bodyDiv").style.left = ((document.body.offsetWidth - ample) /2) + "px";
	        
	        var objcontent = getElement("content");
	        if(objcontent != null)objcontent.style.background = "";
	        
	        
	        //document.getElementById("idiomes").style.left = (ample - (339 + 20)) + "px";
	        //document.getElementById("fonsMenu").style.width = (ample - (20 + 75 + 264)) + 'px' ;
	        document.getElementById("navlist").style.width =  document.getElementById("Contingut").style.width = (ample) + 'px' ;
	        
            // alçada formulari
	        altForm = alt - 190;
	        if(altForm < 0) altForm = (altForm * -1) ;
	        
	        var objinteriorFormulari = getElement("interiorFormulari");
	        if(objinteriorFormulari != null) objinteriorFormulari.style.height = altForm + "px";
	        
	        
	        altSuperior = document.getElementById("partSuperior").offsetHeight;
	        if(!document.all){
	            // 24 = paddings de la part superior
	            altSuperior = altSuperior + 24
	        }
	       
	        var altura = altForm - altSuperior;
	        if(altura < 0) altura = altura * -1;
	        document.getElementById("SeparadorVertical").style.height = altura +  "px";
	        
	        document.getElementById("ZonaPestanyes").style.top = altSuperior + 10 + "px";
	        document.getElementById("ZonaPestanyes").style.width = document.getElementById("quadre").style.width = ample - 375 + "px";
	        document.getElementById("quadre").style.height = altura - 40 + "px";
	         
	        // Visibilitat document
	        document.getElementById("bodyDiv").style.visibility = "visible";
	        //document.getElementById("iFrameTxiTxa").src = "../Pages/GoogleMapsV3.aspx";
        }
        
        function mCoordinades(divid){
            if(document.getElementById(divid).style.display!="block"){
                document.getElementById(divid).style.display="block";
                document.getElementById("imgLatituds").src = "../Resources/icons/minus.gif";
            }else{
               document.getElementById(divid).style.display="none";
               document.getElementById("imgLatituds").src = "../Resources/icons/plusik.gif";
            }
        }
        
        
var globalElement = null;        
var globalResponse = null;
var globalParentPosition = null;
function marcaAcordio(element){
    globalElement = element;
    var pE = document.getElementById("PannellEsquerre");
    var Elems = pE.getElementsByTagName("div");
    for(x=0;x<Elems.length;x++){
          if(Elems[x] == element){
            globalParentPosition = x;
            break;
       }
    }
}

function OnUpdatedElement(){
var pE = document.getElementById("PannellEsquerre");
 var Elems = pE.getElementsByTagName("div");
 for(x=0;x<Elems.length;x++){
     if(Elems[x].className != "TituloAcordeon" && Elems[x].className != "SECTEAcordeon"){
        if(Elems[x].getElementsByTagName("a")[0]){
            Elems[x].getElementsByTagName("a")[0].style.color = "rgb(22,10,190)";
            Elems[x].getElementsByTagName("a")[0].style.cursor = "pointer";
            Elems[x].getElementsByTagName("a")[0].style.cursor = "hand";
            
        }
     }
 }
   /* Elems[globalParentPosition].style.backgroundColor = "#996633";*/
 if(globalParentPosition != null){
     Elems[globalParentPosition].getElementsByTagName("a")[0].style.color = "#ccc";
     Elems[globalParentPosition].getElementsByTagName("a")[0].style.cursor = "default";
    }
 globalParentPosition = null;

}

function BtFinalitzar(que){ 
    if(!document.getElementById("FinalDiv")){
        document.getElementById("modalPopUpContainer").className = "modalPopUpCapaON";
        document.getElementById("modalPopUpContainer").style.height = document.documentElement.clientHeight;
        var Final = document.createElement("div");
        Final.setAttribute("id","FinalDiv");
        Final.style.border = "1px solid #996633";
        Final.style.position = "absolute";
        Final.style.zIndex = "10000";
        Final.innerHTML = "<iframe src='../Pages/FideFinalizar.aspx' frameborder=0 style='width:160px;height:110px'></iframe>";      
        Final.style.left = getX(document.getElementById("ImgFi")) + "px"; //(getY(que) + 140) + "px";
        Final.style.top = (getY(document.getElementById("ImgFi")) - 115) + "px"; //(getX(que)-254) + "px";        
        document.getElementsByTagName("body")[0].appendChild(Final);
    }
    else{
        document.getElementById("modalPopUpContainer").className = "modalPopUpCapaOFF";
        document.getElementById("FinalDiv").style.display = (document.getElementById("FinalDiv").style.display == "none")? "block":"none";
        document.getElementsByTagName("body")[0].removeChild(document.getElementById("FinalDiv"))
        
    }
}

function BtGuardar(){
    if(window.parent.location.href.indexOf("DatosGenerales")!=-1){
        window.parent.GuardarDatosFormulario();
    }
    //Ojo, este if está para la pantalla de datos generales ya que desde la capa FinalDiv se hace la llamada a GuardarFide.aspx
    //y es necesesario esconderla justo después.
    if (document.getElementById("FinalDiv")!= null){
        document.getElementById("FinalDiv").style.display = "none";
        document.getElementsByTagName("body")[0].removeChild(document.getElementById("FinalDiv"))
    }
    ShowModalDialogWithNewWidthAndHeight('', '../Pages/GuardarFide.aspx', 420, 180, 'BtConfirmar');
}

function getY( oElement )
{
    var iReturnValue = 0;
    while( oElement != null ) {
    iReturnValue += oElement.offsetTop;
    oElement = oElement.offsetParent;
    }
    return iReturnValue;
}

function getX( oElement )
{
    var iReturnValue = 0;
    while( oElement != null ) {
    iReturnValue += oElement.offsetLeft;
    oElement = oElement.offsetParent;
    }
    return iReturnValue;
}

