////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
// esta es de otro lado y recoge y valida TODO EL FORMULARIO
//
//

function validarTodos(form) {
	for (i = 0; i < form.elements.length; i++) {
	  
	  // recorre todo los campos del formulario y si alguno de tipo TEXT no tiene valor no deja continuar;
		if (form.elements[i].type == "text" && form.elements[i].value == "") {  
			alert("Tot requerit"); 
			form.elements[i].focus(); 
			return false; 
		}
	}
	// si todos los campos tipo TEXT están rellenados submit el formulario
	
	form.submit();
}


////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
// esta es de otro lado y recoge y valida UN CAMPO DEL FORMULARIO hemos de sustituir NOM por el
// campo que queremso validar
//
function validarUno(form) {

	
		if (form.nom.type == "text" && form.nom.value == "") {  
			alert("falta el nom"); 
			return false; 
		}else{
	// si todos los campos tipo TEXT están rellenados submit el formulario
	
		form.submit();
		}
}




////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
// ELIMINA EL TEXTO DE UN CQAMPO AL PASARLE EL FOCO
// 


// El siguiente código te permite poner texto por defecto en los textbox, que desaparece al pinchar en el textbox para introducir datos.

// Pon el siguiente código entre las cabeceras <head> de tu pagina :
// Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development

function clear_textbox()
{
if (document.form1.text1.value == "Enter Your Text Here")
document.form1.text1.value = "";
}


//Pon tu código de formulario así:

// <form name="form1" action="url_de_destino.html" method=post>
// <input name=text1 onFocus=clear_textbox() value="Enter Your Text Here">
// <input type=submit value=Submit>
// </form>






// FUNCIÓN PARA CONTAR LOS CARACTERES DE UNA TEXAREA MIENTRAS SE ESTÁ ESCRIBIENDO
// Original: Ronnie T. Moore -->
// Begin
//
//<textarea name="PRIMERO" wrap="physical" cols="28" rows="4"
//onKeyDown="textCounter(this.form.PRIMERO,this.form.SEGUNDO,125);"
//onKeyUp="textCounter(this.form.PRIMERO,this.form.SEGUNDO,125);"></textarea> 
//<br>
//<input readonly type="text" name="SEGUNDO" size="3" maxlength="3" value="125"> caracteres</font> </p>


function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);




// otherwise, update 'characters left' counter



else
countfield.value = maxlimit - field.value.length;
}

// ABRIR UNA VENTANA NUEVA CENTRADA

function AbrirCentrado(Url,NombreVentana) {
var largo = 750;
var altura = 700;
var adicionales= "";
var top = (screen.height-altura)/2;
var izquierda = (screen.width-largo)/2; nuevaVentana=window.open(''+ Url + '',''+ NombreVentana + '','width=' + largo + ',height=' + altura + ',top=' + top + ',left=' + izquierda + ',features=' + adicionales + '');
nuevaVentana.focus();
}
   
///////////////////////////////////  
//////////////////////////////////
// definiciones basicas
OCULTO="none";
VISIBLE="block";
	
function mostrar(blo) {
  document.getElementById(blo).style.display=VISIBLE;
  document.getElementById('ver_off').style.display=VISIBLE;
  document.getElementById('ver_on').style.display=OCULTO;
}
 
function ocultar(blo) {
  document.getElementById(blo).style.display=OCULTO;
  document.getElementById('ver_off').style.display=OCULTO;
  document.getElementById('ver_on').style.display=VISIBLE;
}

// 
// <div id="ver_on"><a href="#" onclick="mostrar('bloque')">Ver más</a></div>
// <div id="ver_off" style="display: none"><a href="#" onclick="ocultar('bloque')">Ver menos</a></div>
// <div id="bloque" style="display: none">Texto a mostrar u ocultar</div>     


