			// ****************** ABRIR VENTANA ***********************************
			function openWin(pag,nomVentana, ancho, alto, posx, posy, propiedades) {
				//si left y top llegan en blanco, hay que centrarlo
				
				if (posx== 99) {
					//calculo de las coordenadas para centrar el popup
					//gets top and left positions based on user's resolution so hint window is centered.
					posx = (window.screen.width/2) - (ancho/2 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
				}

				if (posy == 99)	{
					//calculo de las coordenadas para centrar el popup
					//gets top and left positions based on user's resolution so hint window is centered.
					posy = (window.screen.height/2) - (alto/2 + 30); //half the screen height minus half the new window height (plus title and status bars).
				}

				stringCaracteristicas = ""
				stringCaracteristicas += "width=" + ancho 
				stringCaracteristicas += " ,height=" + alto
				stringCaracteristicas += " ,left=" + posx
				stringCaracteristicas += " ,top=" + posy
				stringCaracteristicas += " ,screenX=" + posx
				stringCaracteristicas += " ,screenY=" + posy
				stringCaracteristicas += " ," + propiedades				
				myWin=open(pag,nomVentana,stringCaracteristicas);
			}
			// ****************** VALIDAR CADENA TEXTO **************************************
			//Comprueba que no haya dígitos
			function validar_texto(Str) {
				for(i=0;i<Str.length;i++){
					if ((Str.charAt(i)=='0') || (Str.charAt(i)=='1') || (Str.charAt(i)=='2') || (Str.charAt(i)=='3') || (Str.charAt(i)=='4') || (Str.charAt(i)=='5')  || (Str.charAt(i)=='6') || (Str.charAt(i)=='7') || (Str.charAt(i)=='8') || (Str.charAt(i)=='9')) 
					{						
						return (false);
					}
				}
				return(true);
			}
			//***************** VALIDAR LETRA **********************************************
			//Solo las letras del abecedario
			function es_letra (c)
			{   
				return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
			}
			//**************** VALIDAR DIGITO **********************************************
			//Valida que sea un dígito
			function es_digito (c)
			{   
				return ((c >= "0") && (c <= "9"))
			}
			// ****************** VALIDAR CADENA NUMEROS ***********************************
			//Sirve para validar AÑOS y TELEFONOS
			function validar_num(Str,tipo) {				
				if (tipo == 'anyo')
				{
					if (Str.length != 4)
					{
						return (false);
					}
				}
				if (tipo == 'telefono')
				{
					if (Str.length != 9)
					{
						return (false);
					}
				}
				for (i=0;i<Str.length;i++){
					j=0;
					var correcto=false;
					while ((correcto==false)&&(j<10)){
						if (Str.charAt(i)==j){
							correcto=true;
						}
						j=j+1;
					}
					if(correcto==false){
						if(tipo == 'anyo'){
							alert("Introdueixi una data vàlida");						
						}
						if(tipo == 'telefono'){
							alert("Introdueixi un telèfon vàlid");						
						}
						return (false);
					}
				}
				return (true);			
			}
			// ****************** VALIDAR E-MAILS ***********************************
			function validar_mail(Str) {		
				bArroba = false;
  				bPunto = false;
  				iArroba = 0;

  				for (i = 0;  i < Str.length;  i++){
    				ch = Str.charAt(i);
					if (ch=='@'){
						iArroba++;
						bArroba = true;
					}
					if (ch=='.'){
						bPunto = true;
					}
				}
				if (!bArroba){
					alert("L'e-mail no és correcte, falta una '@'");
					return false;
				}
				if (iArroba>1){
					alert("Només pot escriure una '@'");
					return false;
				}
				if (!bPunto){
					alert("L'e-mail no és correcte, falta un '.'");
					return false;
				}
				if (Str.length < 6){
					alert("L'e-mail no és correcte, com a mínim ha de tenir 6 caràcters");
					return false;
	  			}
				return true;
			}