<!--
// Abre una ventana nueva centrada
function MuestraToolTip(bMuestra,sCadena) {
	if(bMuestra) {
		top.leftFrame.document.getElementById('ayuda').value = sCadena;
	} else {
		top.leftFrame.document.getElementById('ayuda').value = "";
	}
}

function ObreFinestra(laURL, NomFinestra, Ample, Llarg, bVScroll) {
  Esquerra = (screen.width-Ample)/2;
  Dalt = (screen.height-Llarg)/2;
  if(bVScroll) {
	  Opcions = "scrollbars=yes, toolbar=no, menubar=no, location=no, resizable=yes, status=no,left=" + Esquerra +
		        ", top=" + Dalt + ",width=" + Ample + ",height=" + Llarg ;
  } else {
	  Opcions = "scrollbars=no, toolbar=no, menubar=no, location=no, resizable=yes, status=no,left=" + Esquerra +
		        ", top=" + Dalt + ",width=" + Ample + ",height=" + Llarg ;
  }
  return window.open(laURL,NomFinestra,Opcions) ;
}

// Ordena un formulario por el campo que le pasemos
function OrdenaLista(sCampo, sFormName) {
	var oForm = document.forms[sFormName];
	oForm.ORDER.value = " ORDER BY " + sCampo;
	setTimeout("oForm.submit();", 200);
}

function MostarOcultar( Mostar, Ocultar ) {
	document.getElementById( Mostar ).style.display = "block";
	document.getElementById( Ocultar ).style.display = "none";
}

function MarcaDesmarca( nTotal, bEstado ) {
	for(n = 0; n < nTotal; n++ )
		document.getElementById( "formEstado_"+n ).checked = bEstado;
}

function PonFondo( sFichero, oObjeto, sFeatures, bMultiple ) { 
	var img = new Image();
	var bOk = true;
	if( sFichero != '' ) {
		img.onerror = function (evt) {
			alert("¡Esto no es una imagen!");
			bOk = false;
		}
		img.src = "file:///" + sFichero;
		if( bOk ) {
			if( bMultiple )
				for( n = 0; n < oObjeto.length; n++ )
					oObjeto[n].style.background = "url('file:///" + sFichero + "') "+sFeatures;
			else
				oObjeto.style.background = "url('file:///" + sFichero + "') "+sFeatures;
		}
	}
}

function RestauraFondo( sURL, nId, oObjeto, sFeatures, bMultiple, sTipo, sNom ) { 
	if( bMultiple )
		for( n = 0; n < oObjeto.length; n++ )
			oObjeto[n].style.background = "url("+ sURL + "/img.php?id=" + nId + "&tipo=" +sTipo + "&nom=" + sNom + ") " + sFeatures;
		else
			oObjeto.style.background = "url("+ sURL + "/img.php?id=" + nId + "&tipo=" + sTipo + "&nom=" + sNom  +") " + sFeatures;
}

function PonImagen( sFichero, oImatge, bMultiple ) { 
	var img = new Image();
	var bOk = true;
	if( sFichero != '' ) {
		img.onerror = function (evt) {
			alert("¡Esto no es una imagen!");
			bOk = false;
		}
		img.src = "file:///" + sFichero;
		if( bOk ) {
			if( bMultiple )
				for( n = 0; n < oImatge.length; n++ )
					oImatge[n].src = img.src;
			else
				oImatge.src = img.src;
		}
	}
}

function RestauraImagen( sURL, nId, oImatge, bMultiple, sTipo, sNom ) { 
	var img = new Image();
	img.src = sURL + "/img.php?id=" + nId + "&tipo=" +sTipo + "&nom=" + sNom;
	if( bMultiple )
		for( n = 0; n < oImatge.length; n++ )
			oImatge[n].src = img.src;
		else
			oImatge.src = img.src;
}

function validarPassword(e) {
    tecla = (document.all) ? e.keyCode : e.which;
    if( tecla == 8 | tecla == 13 ) return true;
    patron =/[A-Za-z0-9\s]/;
    te = String.fromCharCode(tecla);
	if( !patron.test(te) || tecla == 32 ) {
		alert( "¡Sólo se permiten caracteres de la A a la Z en mayúsculas y minúsculas y números del 0 al 9!" );
		return false;
	}
	return true;
} 
//-->