<!--
var formatoFecha = 'dd/mm/yyyy';	// Formato de fecha que vamos a utilizar
  
// Función de validación de fecha
function fechaValida(valor) {
	var formatoFechaReg = formatoFecha;
  	formatoFechaReg = formatoFechaReg.replace('dd','([0-1][0-9]|3[0-1])');
  	formatoFechaReg = formatoFechaReg.replace('mm','(0[0-9]|1[0-2])');
  	formatoFechaReg = formatoFechaReg.replace(/y/g,'[0-9]');
  	formatoFechaReg = "^" + formatoFechaReg + "$";
  	var ExpReg = new RegExp(formatoFechaReg);
  	var fechaOK = ExpReg.test(valor);
  	return fechaOK;
}
  
// Función de validación de email
function emailValido(valor) {
	var EmailOk = true;
	var AtSym = valor.indexOf('@');
	var Period = valor.lastIndexOf('.');
	var Space = valor.indexOf(' ');
	var Length = valor.length - 1;
	if ((AtSym < 1) || (Period <= AtSym+1) || (Period == Length ) || (Space  != -1)) {  
		  EmailOk = false;
	}
	return EmailOk;
}

// Función para validar un numero
function validarEntero(valor) { 
	valor = parseInt(valor);

	if (isNaN(valor)) { 
		return false;
	} else {
		return valor;
	}
}

//Comprueba si un código postal es correcto
function validaCodigoPostal(valor) {
	var valid = "0123456789";
	if (valor.length!=5) {
		return false;
	}
	for (var i=0; i < valor.length; i++) {
		temp = "" + valor.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") {
			return false;
		}
	}
	return true;
}

// Función que oculta o muestra un bloque de código html
function verBloque(valor,campo) {
  	if(campo.checked)
  		document.getElementById(valor).style.display = '';
  	else
  		document.getElementById(valor).style.display = 'none';
}
  
// Función que inserta valores en un select multiple
function aSelect(origen,destino) {
  	if((destino.type != "select-multiple") || (origen.value == ""))
  		return false;
  	texto = origen.value;
  	valor = origen.value;
  	opcion = new Option(texto,valor);
  	destino.options[destino.length] = opcion;
  	origen.value = "";
}

// Función que saca valores de un select multiple
function deSelect(origen,destino) {
  	if(destino.type != "select-multiple")
  		return false;
  	for(i=(destino.length - 1);i>=0;i--) {
  		if(destino.options[i].selected) {
  			destino.options[i] = null;
  		}
  	}
}

//Función para abrir ventanas
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}
//-->