<!-- 
/*
Funcions:

	- EsNumerico (obj) :  bool
	- NumDigitos (obj,lon) : bool
	- esta_ple (obj) : bool
	- mira_email (obj) : bool
	- testeja_check(obj,lon) : bool

*/




function EsNumerico(idobj){
/* Torna
	0: no és numèric
	1: és numèric
*/
   var chr;
   if (idobj.value==null || idobj.value.length==0) { return false; }
   for (var i=0;i<idobj.value.length;i++){
     chr=idobj.value.substring(i,i+1);
     if (chr<"0"||chr>"9") return 0;
   }
   return 1;
}


function NumDigitos(idobj,longitud){
/* Torna
	0: no té 9 dígits
	1: té 9 dígits
*/
   var chr;
   if (idobj.value.length != longitud) { return 0; }
   else { return 1; }
}


function alerta_1 (str)
{
	alert("Faltan sus datos en el campo " + str + " ...");
}


function alerta_ct (str)
{
	alert("Revisa el camp " + str + " ...");
}


function alerta_es (str)
{
	alert("Revisa el campo " + str + " ...");
}


function alerta_en (str)
{
	alert("Please the form is not complete. Please supply the following information:" + str + " ...");
}


function alerta_fr (str)
{
	alert("Contrôlez le champ " + str + " ...");
}


function esta_ple(d1)
{
/* Torna
	0: Camp Buit
	1: Camp Ple
*/
	if (d1.value=='')
		return 0;
	else
		return 1;
}




function mira_email(adrecaemail)
{
/* Torna
	0: no hi ha res
	1: si es correcte
	9: email incorrecte
*/
	result=esta_ple(adrecaemail);
	if(result == 1)
	{
		if(adrecaemail.value.indexOf('@', 0) == -1)
		{
			return 9;
		}
		else
		{
        return 1;
		}
	}
	else
	{ 
		return 0;
    }
}

function comprova_radio(que,longitud)
{

/*
        Retorna 0 si no hi ha cap seleccio
        Retorna el numero d'ordre de la seleccionada (començant per 1)
*/
                value=0;
                for(i=0;i<longitud;i++)
                {

                        if(que[i].checked == true)
                        {
                                value=i+1;
                        }
                }
                return value;
}

function comprova_checkbox(que,longitud)
{

/*
Retorna un array value[]

value[0] = 0 si no hi ha cap seleccionat
value[0] = 1 si hi ha res seleccionat
la resta del array son els numero d'ordre dels valors seleccionats
(començant per 0)
*/
		valor=new Array();
                valor[0]=0;
		j=1
                for(i=0;i<longitud;i++)
                {

                        if(que[i].checked == true)
                        {
				valor[j] = i;
                                valor[0]++;
				j++ ;
                        }
                }
                return valor;
}



