<!--
function isdate(dateStr)
{

																			// Comprueba los siguientes tipos de fecha:
																			// DD/MM/AA   DD/MM/AAAA   DD-MM-AA   DD-MM-AAAA

	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

																			// Para obligar a la introduccion de 4 dígitos en el añ, usar esta otra cadena
																			// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

	var matchArray = dateStr.match(datePat);	 // is the format ok?
	
	if (matchArray == null) 
	{
		alert("La fecha no tiene un Formato Valido.");
		return false;
	}
	
	month	= matchArray[3];									// Separamos los días mese y años
	day		= matchArray[1];
	year		= matchArray[4];
	
	
	if (month < 1 || month > 12) 
	{																			// Comprobar que sea un mes válido
		alert("El mes tiene que estar entre 1 y 12.");
		return false;
	}
	
	if (day < 1 || day > 31)										// Comprobar que sea un día válido
	{
		alert("El día tiene que estar entre 1 y 31.");
		return false;
	}
	
	if ((month==4 || month==6 || month==9 || month==11) && day==31) 
	{
		alert("El mes de "+month+" no tiene 31 días!");
		return false;
	}
	
	if (month == 2) 
	{																			// Comprueba el 29 de Febrero
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		
		if (day>29 || (day==29 && !isleap)) 
		{
			alert("Febrero del " + year + " no tiene  " + day + " dias!");
			return false;
		}
	}
return true;  // date is valid
}

					function MM_validateForm() { //v1.3 (modificada por LGI)
					  var i,objStr,field,theCheck,atPos,theNum,colonPos,min,max,errors='',title;
					  
					  for (i=0; i<(MM_validateForm.arguments.length-2); i+=4) {
					    objStr = MM_validateForm.arguments[(navigator.appName == 'Netscape')?i:i+1];
					    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) || (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
					      objStr = 'document'+objStr.substring(objStr.substring(0,objStr.lastIndexOf('.')).  lastIndexOf('.'),objStr.length);  //fix layer ref if not supp
					    field = eval(objStr);
					    field.name = (field.name)?field.name:objStr;
					    theCheck = MM_validateForm.arguments[i+2];
					    title = MM_validateForm.arguments[i+3];
					    
					    if (field.value) { //IF NOT EMPTY FIELD
							
					      if (theCheck.indexOf('isEmail') != -1) 
							{ //CHECK EMAIL
							
								atPos = field.value.indexOf('@');
								if (atPos < 1 || atPos == (field.value.length - 1))
								      errors += '- El campo '+title+' debe contener una dirección de e-mail válida.\n';
							} // FIN CHECHEO E-MAIL

							//13-11-03 Modificado por Pablo para que no se admitan comillas en los campos con ValidatorComillas
							if (theCheck =='RCom')
							{ //Inicio == RCom
							//	Compruebo que los textos no contengan comillas simples ni dobles
								atPosComSimple = field.value.indexOf(String.fromCharCode(39));
								atPosComDoble = field.value.indexOf(String.fromCharCode(34));
								if (atPosComSimple >= 0 || atPosComDoble >= 0)
								      errors += '- El campo '+title+' no debe contener comillas.\n';
							} // Fin == RCom
							//Fin de modificación de Pablo
							
							if (theCheck =='RD')
							{ //Inicio == RD
								if (!isdate(field.value))
								{ // Inicio IsDate
									errors += '- La fecha no tiene un formato válido. Ej. 16/12/1973 \n';
								} // Fin IsDate
							} // Fin == RD
							
							//08-06-04 Pablo. Separo los casos N y RN para que solo rea required el segundo
							if (theCheck =='N')
							{ //Inicio == N
								if (field.value != '')
								{
								if (isNaN(field.value)) errors += '- El campo '+title+' debe contener un numero válido.\n';
								}
							} // Fin == N
							
							if (theCheck=='RN')
							{ //Inicio == RN
								//13-01-04 Modificado por Pablo para que acepte como numérico cantidades que empiecen por cero
								//theNum = parseFloat(field.value);
								//if (field.value != ''+theNum) errors += '- El campo '+title+' debe contener un número válido.\n';
								if (isNaN(field.value)) errors += '- El campo '+title+' debe contener un numero válido.\n';
							} // Fin == RN
																																				
							if (theCheck != 'R' && theCheck != 'RD' && theCheck != 'N' && theCheck != 'RN'  && theCheck != 'RisEmail' && theCheck != 'RCom') 
							{ // COMPROBACION DE NUMEROS
								theNum = parseFloat(field.value);
								if (field.value != ''+theNum) errors += '- El campo '+title+' debe contener un número válido.\n';
								if (theCheck.indexOf('inRange') != -1) 
								{ //COMPROBACION DE RANGO DE NUMEROS
								  colonPos = theCheck.indexOf(':');
								  min = theCheck.substring(8,colonPos);
								  max = theCheck.substring(colonPos+1,theCheck.length);
								  if (theNum < min || max < theNum) // RANGO INCORRECTO
								    errors += '- El campo '+title+' debe estar comprendido entre  '+min+' y '+max+'.\n';
							    } 
							
								}	// FIN COMPROBACION NUMEROS
							}		// FIN COMPROBACION CAMPO VACIO
					    else 
							if (theCheck.charAt(0) == 'R') errors += '- El campo '+title+' debe contener datos.\n';
					  } // For
					  if (errors) alert('REVISE LOS DATOS.\n\nEl formulario no puede ser procesado porque contiene los siguientes errores:\n\n'+
					                    errors+'\nPor favor, efectúe los cambios e inténtelo de nuevo.');
					  document.MM_returnValue = (errors == '')
					}
					//-->