  function ShowHideLayer(oItems,show){
	  oItems.style.display = show;
  }

	function openWindow(url,W,H,target) {
  	if (!url) url = "";
    if (!W) W=200;
    if (!H) H=200;
    if (!target) target="_new";

    var X = (screen.width/2)-(W/2);
    var Y = (screen.height/2)-(H/2);

    var winPref = "width=" + W + ",height=" + H
                + ",innerWidth=" + W + ",innerHeight=" + H
                + ",left=" + X + ",top=" + Y
                + ",screenX=" + X + ",screenY=" + Y
                + ",dependent=yes,titlebar=no,scrollbars=yes,resizable=yes";

    openWindow.popup = window.open( url, target, winPref );
    openWindow.popup.resizeTo(1*W,1*H);
    openWindow.popup.focus();
	}

	function openHelpWindow(url,W,H,target) {
  	if (!url) url = "";
    if (!W) W=200;
    if (!H) H=200;
    if (!target) target="_new";

    var X = (screen.width/2)-(W/2);
    var Y = (screen.height/2)-(H/2);

    var winPref = "width=" + W + ",height=" + H
                + ",innerWidth=" + W + ",innerHeight=" + H
                + ",left=" + X + ",top=" + Y
                + ",screenX=" + X + ",screenY=" + Y
                + ",dependent=yes,titlebar=no,scrollbars=yes,resizable=yes";

    openWindow.popup = window.open( url, target, winPref );
    openWindow.popup.resizeTo(1*W,1*H);
    openWindow.popup.focus();
	}

	function sinHacer() {
		alert("Opción NO disponible");
	}

  function showLayer(oItems){
	  oItems.style.display = "block";
  }

  function hideLayer(oItems){
	  oItems.style.display = "none";
  }

  function logout(url) {
    if (window.confirm("¿Desea cerrar la sesión actual?")) {
      location.href = url;
    }
  }

	function ShowHideLayer2(oItems){
		if ((oItems.style.display =="") || (oItems.style.display == 'none')){
	    oItems.style.display = "block";
		}else{
	    oItems.style.display = "none";
		}
  }

	function cambia(srcImagen, capa) {
/* 		imagen = document.getElementById(srcImagen);
		if ((capa.style.display =="") || (capa.style.display == 'none')){
				imagen.src = "images/arrow_down.gif"
		}else{
				imagen.src = "images/arrow_up.gif"
		}*/
 }

	function mostrarMenu() {
		capaMenu.style.display = "block";
		capaBotonMostrarMenu.style.visibility = "hidden";
	}

	function ocultarMenu() {
		capaMenu.style.display = "none";
		capaBotonMostrarMenu.style.visibility = "visible";
	}

	function processing(capaID) {
		capa = document.getElementById(capaID);
	  var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement &&
				( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		capaWidth = getStyle(capaID, 'width').substr(0, getStyle(capaID, 'width').length-2);
		capaHeight= getStyle(capaID, 'height').substr(0, getStyle(capaID, 'height').length-2);
    var X = (myWidth/2)-(capaWidth/2);
    var Y = (myHeight/2)-(capaHeight/2);
		Y += document.documentElement.scrollTop;
		capa.style.top = Y + "px";
		capa.style.left = X + "px";
		capa.style.visibility = 'visible';
		capa.style.display = 'block'; //Solo para IFRAMES, quitar si es para DIV's
	}

	function getStyle(el,styleProp) {
		var x = document.getElementById(el);
		if (window.getComputedStyle)
			var y = window.getComputedStyle(x,null).getPropertyValue(styleProp);
		else if (x.currentStyle)
			var y = eval('x.currentStyle.' + styleProp);
		return y;
	}

	//FORMATO: X-00000000
  function isValidNIF(cadena) {
    dni=cadena.substring(2,cadena.length);
    let=cadena.charAt(0);
    if (!isNaN(let) || let == ' ') {
//      alert('Falta la letra');
      return false;
    }
    if (dni.length == 0) {
//      alert('Falta nºDNI');
      return false;
    }
    for (i=0; i<dni.length; i++) {
      num = dni.charAt(i);
      if (isNaN(num) || num == ' ') {
//        alert('Letra encontrada se esperaba nº');
        return false;
      }
    }
    return true;
  }

  function isValidDNI(cadena) {
    dni=cadena;
    if (dni.length == 0) {
//      alert('Falta nºDNI');
      return false;
    }
    for (i=0; i<dni.length; i++) {
      num = dni.charAt(i);
      if (isNaN(num) || num == ' ') {
//        alert('Letra encontrada se esperaba nº');
        return false;
      }
    }
    return true;
  }

  function isValidCodPostal(cadena) {
    if (cadena.length != 5) {
//      alert("long. no valida");
      return false;
    }
    for (i=0; i<cadena.length; i++) {
      num = cadena.charAt(i);
      if (isNaN(num) || num == ' ') {
//        alert('Faltan nº');
        return false;
      }
    }
    return true;
  }

  function isValidTelefono(cadena) {
    if (cadena.length != 9) {
//      alert("long. no valida");
      return false;
    }
    for (i=0; i<cadena.length; i++) {
      num = cadena.charAt(i);
      if (isNaN(num) || num == ' ') {
//        alert('Faltan nº');
        return false;
      }
    }
    return true;
  }







