/** 
 * JS_Comprovacions
 * todo: maf 2008-01-10 cal migrar tots els accesos a dades al format estandar getElementById
 * todo: maf 2008-01-10 cal migrar tots els accesos a estandar prototype  
 */
var nav;

function quinnavegador(){
	if (navigator.appName == "Netscape"){
		if (navigator.appVersion[0]=="5")
			nav="Netscape5";
		else
			nav="Netscape";
	}
	else{
		if (navigator.appName == "Microsoft Internet Explorer")
			  nav="Explorer";
	}
}
function NovaFinestra(NomURL,w,h){
    mywindow=window.open(NomURL,"","resizable=yes, menubar=no,toolbar=no,width="+w+",height="+h+",scrollbars=yes");
    mywindow.moveTo(5,5);
    mywindow.focus(mywindow);
}

function mostrardata(){
    DiesSetmana = new Array("Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte");
    MesosAny = new Array("Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre");
    Data = new Date();
    var dia=DiesSetmana[Data.getDay()];
    var ndia=Data.getDate();
    var mes=MesosAny[Data.getMonth()];
    var any=Data.getFullYear();
    document.write (dia+', '+ndia+' '+mes+' '+any);
}
function actualitzartextarea(nom_h,nom){
	var l;
	var i;
	
	mystring = new String(nom_h);
	l=mystring.length;
	for (i=0;i<l;i++){
		if (mystring.slice(i,i+2) == '$$'){
			document.getElementById(nom).value=document.getElementById(nom).value + '\n';
			i++;
		}else{
			document.getElementById(nom).value=document.getElementById(nom).value + mystring.slice(i,i+1);
		}
	}
}


function obtenirEdat(data){
	
	var edad;
	edad = true;
	//calculo la fecha de hoy 
    hoy=new Date();

    //calculo la fecha que recibo 
    //La descompongo en un array 
    var array_fecha = data.split("/")
    //console.log(array_fecha);
    //si el array no tiene tres partes, la fecha es incorrecta 
    if (array_fecha.length!=3) 
       edad = false

    if (edad){
        //compruebo que los ano, mes, dia son correctos 
        var ano 
        ano = parseInt(array_fecha[2]); 
        if (isNaN(ano)) 
    	{
        	edad=false;
    	}

        var mes 
        mes = parseInt(array_fecha[1]); 
        if (isNaN(mes)) 
    	{
        	edad=false; 
    	}

        var dia 
        dia = parseInt(array_fecha[0]); 
        if (isNaN(dia)) 
    	{
        	edad=false; 
    	}
        if (edad){        	
		    //si el año de la fecha que recibo solo tiene 2 cifras hay que cambiarlo a 4
		    //console.log(ano);
		    if (ano<=99) 
		       ano +=1900 
		
		    //resto los años de las dos fechas	    
		    edad=hoy.getFullYear()- ano - 1; //-1 porque no se si ha cumplido años ya este año 
		
		    //si resto los meses y me da menor que 0 entonces no ha cumplido años. Si da mayor si ha cumplido 
		    if (hoy.getMonth() + 1 - mes < 0) //+ 1 porque los meses empiezan en 0 
			{
		       edad=edad ;
			}
			else
			{
				if (hoy.getMonth() + 1 - mes > 0) 
				{
					edad=edad+1;
				}
				else
				{
					//entonces es que eran iguales. miro los dias 
					//si resto los dias y me da menor que 0 entonces no ha cumplido años. Si da mayor o igual si ha cumplido 
					if (hoy.getUTCDate() - dia >= 0) 
					{
					   edad=edad+1 ;
					}
				}
			}    
        }
    }    

    return edad	
}

function calcular_edad(camp_data,camp_edat)
{ 

    //calculo la fecha de hoy 
    hoy=new Date();

    //calculo la fecha que recibo 
    //La descompongo en un array 
    var array_fecha = document.getElementById(camp_data).value.split("/") 
    //si el array no tiene tres partes, la fecha es incorrecta 
    if (array_fecha.length!=3) 
       return false 

    //compruebo que los ano, mes, dia son correctos 
    var ano 
    ano = parseInt(array_fecha[2]); 
    if (isNaN(ano)) 
	{
    	document.getElementById(camp_edat).value="" ;	
       return false 
	}

    var mes 
    mes = parseInt(array_fecha[1]); 
    if (isNaN(mes)) 
	{
    	document.getElementById(camp_edat).value="" ;
       return false 
	}

    var dia 
    dia = parseInt(array_fecha[0]); 
    if (isNaN(dia)) 
	{
    	document.getElementById(camp_edat).value="" ;
       return false 
	}


    //si el año de la fecha que recibo solo tiene 2 cifras hay que cambiarlo a 4
    //console.log(ano);
    if (ano<=99) 
       ano +=1900 

    //resto los años de las dos fechas
    
    edad=hoy.getFullYear()- ano - 1; //-1 porque no se si ha cumplido años ya este año 

    //si resto los meses y me da menor que 0 entonces no ha cumplido años. Si da mayor si ha cumplido 
    if (hoy.getMonth() + 1 - mes < 0) //+ 1 porque los meses empiezan en 0 
	{
       edad=edad ;
	}
	else
	{
		if (hoy.getMonth() + 1 - mes > 0) 
		{
		   edat=edad+1;
		}
		else
		{
			//entonces es que eran iguales. miro los dias 
			//si resto los dias y me da menor que 0 entonces no ha cumplido años. Si da mayor o igual si ha cumplido 
			if (hoy.getUTCDate() - dia >= 0) 
			{
			   edad=edad+1 ;
			}
		}
	}
	
    document.getElementById(camp_edat).value=edad ;    
} 

// Esta función permitirá validar la fecha
// En el objeto text hacemos lo Siguiente
function fechas(caja)
{
   if (caja)  
   {  
      borrar = caja;
      if ((caja.substr(2,1) == "/") && (caja.substr(5,1) == "/") && (caja.length<11))
      {      
         for (i=0; i<10; i++)
	     {	
            if (((caja.substr(i,1)<"0") || (caja.substr(i,1)>"9")) && (i != 2) && (i != 5))
			{
               borrar = '';
               break;  
			}  
         }
	     if (borrar)
	     { 
	        a = caja.substr(6,4);
		    m = caja.substr(3,2);
		    d = caja.substr(0,2);
		    if((a < 1900) || (a > 2050) || (m < 1) || (m > 12) || (d < 1) || (d > 31))
		       borrar = '';
		    else
		    {
		       if((a%4 != 0) && (m == 2) && (d > 28))	   
		          borrar = ''; // Año no viciesto y es febrero y el dia es mayor a 28
			   else	
			   {
		          if ((((m == 4) || (m == 6) || (m == 9) || (m==11)) && (d>30)) || ((m==2) && (d>29)))
			         borrar = '';	      				  	 
			   }  
		    } 
         } 
      } 			    			
	  else
	     borrar = '';
		 
	  if (borrar == '')
	  {
	     return (false)
	  }
	  else
	  {
	  	 return (true)
	  }
   }   
} 

/* maf 2007-08-09
   funcions mogudes de l'html a aquest fitxer
*/

function elimFormacio(){
	if (document.forms["form_formacio"].formacio.selectedIndex!=-1){
		NovaFinestra('form_curs.php?accio=Baixa&codi=' + document.forms["form_formacio"].formacio.options[document.forms["form_formacio"].formacio.selectedIndex].value ,600,300);
	}else{
		alert('Cal seleccionar algun curs de la llista');
	}
}
function modifFormacio(){
	if (document.forms["form_formacio"].formacio.selectedIndex!=-1){
		NovaFinestra('form_curs.php?accio=Modificacio&codi=' + document.forms["form_formacio"].formacio.options[document.forms["form_formacio"].formacio.selectedIndex].value ,600,300);
	}else{
		alert('Cal seleccionar algun curs de la llista');
	}
}
function elimExperiencia(){
	if (document.forms["form_laboral"].experiencia.selectedIndex!=-1){
		NovaFinestra('form_exp.php?accio=Baixa&codi=' + document.forms["form_laboral"].experiencia.options[document.forms["form_laboral"].experiencia.selectedIndex].value ,600,300);
	}else{
		alert('Cal seleccionar algun curs de la llista');
	}
}
function modifExperiencia(){
	if (document.forms["form_laboral"].experiencia.selectedIndex!=-1){
		NovaFinestra('form_exp.php?accio=Modificacio&codi=' + document.forms["form_laboral"].experiencia.options[document.forms["form_laboral"].experiencia.selectedIndex].value ,600,300);
	}else{
		alert('Cal seleccionar algun curs de la llista');
	}
}
/* maf 2007-05-14 
   canvia el valor dun select
  */
function canviaValor(control,valor){
	//document.all[control].value = valor;
	document.getElementById(control).value=valor;
	return true;
}

function posa_majuscules(control){
    //2008-01-17 maf pasem a getbyid
	//mystring = new String(document.all[control].value);
	mystring = new String(document.getElementById(control).value);
	//document.all[control].value = mystring.toUpperCase(); 
	document.getElementById(control).value = mystring.toUpperCase();
}

function posa_majuscules_primera(frmObj){
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	//tmpStr = frmObj.value.toLowerCase();
	//tmpStr = new String(document.all[frmObj].value);
	//2008-01-17 maf pasem a getbyid
    tmpStr  = new String(document.getElementById(frmObj).value);
	tmpStr = tmpStr.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)
	{
		for (index = 0; index < strLen; index++)
		{
			if (index == 0)
			{
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else
			{
				tmpChar = tmpStr.substring(index, index+1);
				if (tmpChar == " " && index < (strLen-1))
				{
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
				}
			}
		}
	}
	//frmObj.value = tmpStr;
	
	//2008-01-17 maf pasem a getbyid
	//document.all[frmObj].value = tmpStr;
	document.getElementById(frmObj).value = tmpStr;
}

function checkemail(correu){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(correu)){
		return true
	}
	else{
		alert("Comprova que el correu electrònic estigui correctament escrit");
		alert("Si no en tens deixa aquesta casella en blanc!");
		return false
	}
}

function checkNumber(valor,mida)
{
	var mystring = new String(valor);	
	var myint = parseInt(valor);   
	if ((mystring.length != mida) || myint!=mystring){	
	      //alert (myint);
		  //alert (valor);
		  return false 
	}
	else{
			return true
	}
}

function checkNumberInt(valor){
	var mystring = new String(valor);	
	var myint = parseInt(valor);   
	if (myint!=mystring){	
		  return false 
	}
	else{
			return true
	}
}

//comprovem format del nif persones fisiques
function check_cpostal(cadena){
	var patron = /^[0-9][0-9][0-9][0-9][0-9]$/;
	if (!cadena.match(patron)){
		return false;
	}else{
		return true;
	}
} 



//Retorna: 1 = NIF ok, 2 = CIF ok, 3 = NIE ok, -1 = NIF error, -2 = CIF error, -3 = NIE error, 0 = ??? error
function valida_nif_cif_nie(a){

	var temp=a.toUpperCase();
	var cadenadni="TRWAGMYFPDXBNJZSQVHLCKE";
	if (temp!==""){
	
		// si no tiene un formato valido devuelve error
		if ((!/^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$/.test(temp) && !/^[T]{1}[A-Z0-9]{8}$/.test(temp)) && !/^[0-9]{8}[A-Z]{1}$/.test(temp))
		{
		return 0;
		}
		
		// comprobacion de NIFs estandar
		if (/^[0-9]{8}[A-Z]{1}$/.test(temp))
		{
			posicion = a.substring(8,0) % 23;
			letra = cadenadni.charAt(posicion);
			var letradni=temp.charAt(8);
			if (letra == letradni)
			{
			return 1;
			}
			else
			{
			return -1;
			}
		}
		
		// algoritmo para comprobacion de codigos tipo CIF
		suma = parseInt(a.charAt(2))+parseInt(a.charAt(4))+parseInt(a.charAt(6));
		
		for (i = 1; i < 8; i += 2)
		{
			temp1 = 2 * parseInt(a.charAt(i));
			temp1 += '';
			temp1 = temp1.substring(0,1);
			temp2 = 2 * parseInt(a.charAt(i));
			temp2 += '';
			temp2 = temp2.substring(1,2);
			if (temp2 == '')
			{
			temp2 = '0';
			}
			
			suma += (parseInt(temp1) + parseInt(temp2));
		}
		suma += '';
		n = 10 - parseInt(suma.substring(suma.length-1, suma.length));
		
		// comprobacion de NIFs especiales (se calculan como CIFs)
		if (/^[KLM]{1}/.test(temp))
		{
			if (a.charAt(8) == String.fromCharCode(64 + n))
			{
			return 1;
			}
			else
			{
			return -1;
			}
		}
		// comprobacion de CIFs
		if (/^[ABCDEFGHJNPQRSUVW]{1}/.test(temp))
		{
			temp = n + '';
			if (a.charAt(8) == String.fromCharCode(64 + n) || a.charAt(8) == parseInt(temp.substring(temp.length-1, temp.length)))
			{
			return 2;
			}
			else
			{
			return -2;
			}
		}
		
		// comprobacion de NIEs
		// T
		
		if (/^[T]{1}/.test(temp))
		{
			if (/^[T]{1}[A-Z0-9]{8}$/.test(temp)){
				return 3;
			}else{
				return -3;
			}
		}
				
		// XYZ
		if (/^[XYZ]{1}/.test(temp))
		{
			
			//temp = temp.replace('X','0')
			//temp = temp.replace('Y','1')
			//temp = temp.replace('Z','2')
			//pos = temp.substring(0, 8) % 23;	
			pos = str_replace(['X', 'Y', 'Z'], ['0','1','2'], temp).substring(0, 8) % 23;
			
			if (a.charAt(8) == cadenadni.substring(pos, pos + 1))
			{
				return 3;
			}
			else
			{
				return -3;
			}
		}
	}
	return 0;
}

function str_replace(search, replace, subject) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Gabriel Paderni
    // +   improved by: Philip Peterson
    // +   improved by: Simon Willison (http://simonwillison.net)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   bugfixed by: Anton Ongson
    // +      input by: Onno Marsman
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    tweaked by: Onno Marsman
    // *     example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
    // *     returns 1: 'Kevin.van.Zonneveld'
    // *     example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    // *     returns 2: 'hemmo, mars'
 
    var f = search, r = replace, s = subject;
    var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
 
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = s[i].split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    };
 
    return sa ? s : s[0];
}

function checkNSS(nss) {
	var result;
	result = false;
	if (!nss) result = false;
	else {
		if (nss.length != 11 && nss.length != 12) result = false;
		else
		if (nss.substr(2, 1) == 0) 
			nss = "" + nss.substr(0, 2) + nss.substr(3, nss.length-1);
		if (mod(nss.substr(0, nss.length-2), 97) == nss.substr(nss.length-2, 2)) result = true;
		else result = false;
	}
	return result;
}

function checksubmitCondicions(){
   if (!document.getElementById('check_condicions').checked)
   {
      alert("Cal marcar la casella d'acceptació de les condicions d'ús per poder continuar la inscripció a la borsa de treball");
      return false
   }

}

function checksubmitDemCanviClau(){
     //caldria comprovar la clau antiga sigui correcta ¿?     
     
     if (document.getElementById('DEM_PASSWORD').value == ""){
        alert("Si us plau, entra eln password actual");
        document.getElementById('DEM_PASSWORD').focus();
        return false
     }
     
     if (document.getElementById('DEM_NOU_PASSWORD').value == ""){
        alert("Si us plau, entra el nou password");
        document.getElementById('DEM_NOU_PASSWORD').focus();
        return false
     }
  
     if (document.getElementById('DEM_NOU_PASSWORD_2').value == ""){
        alert("Si us plau, repeteix el nou password en la casella de confirmció");
        document.getElementById('DEM_NOU_PASSWORD_2').focus();
        return false
     }
        
     if (document.getElementById('DEM_NOU_PASSWORD').value != document.getElementById('DEM_NOU_PASSWORD_2').value){
        alert("Els nous passwords introduïts no coincideixen");
        document.getElementById('DEM_NOU_PASSWORD').focus();
        return false
     }
     return true;
}


function checksubmitOfeFeina()
{

   if (document.getElementById('OFE_ESP_OCUPACIO').value == "")
   {
      alert("Si us plau, introdueix l'especialitat de l'oferta de treball");
      document.getElementById('OFE_ESP_OCUPACIO').focus();
      return false
   }

   if (document.getElementById('OFE_TASQUES').value == "")
   {
      alert("Si us plau, indica les principals tasques a desenvolupar");
      document.getElementById('OFE_TASQUES').focus();
      return false
   }

   return true	

}

function checksubmitOfeCondicions()
{

   if (document.getElementById('OFE_DATA_INC').value == "")
   {
      alert("Si us plau, indica la data aproximada d'inici del contracte");
      document.getElementById('OFE_DATA_INC').focus();
      return false
   }

   if (document.getElementById('OFE_HORARI_TREB').value == "")
   {
      alert("Si us plau, indica l'horari de treball");
      document.getElementById('OFE_HORARI_TREB').focus();
      return false
   }

   if (document.getElementById('OFE_TIPUS_CONT').value == "")
   {
      alert("Si us plau, indica el tipus de contracte que es vol realitzar");
      document.getElementById('OFE_TIPUS_CONT').focus();
      return false
   }

   if (document.getElementById('OFE_DURADA_CONT').value == "")
   {
      alert("Si us plau, indica la durada aproximada del contracte inicial");
      document.getElementById('OFE_DURADA_CONT').focus();
      return false
   }

   if (document.getElementById('OFE_LOCALITAT_TREB').value == "")
   {
      alert("Si us plau, indica el municipi on es treballarà.");
      document.getElementById('OFE_LOCALITAT_TREB').focus();
      return false
   }

   return true	

}
/*
todo: cal comprovar si es un cop posat un nivell d'estudis amb opcions ha selecttionat alguna de les opcions
		ara no s'esta comprovant, unicament es mira si ha seleccionat un nivell d'estudis.
*/
function checksubmitOfePerfil()
{
   if (document.getElementById('OFE_EXPERIENCIA').value == "")
   {
      alert("Si us plau, indica si és necessària experiència i en cas afirmatiu el temps mínim d'experiència");
      document.getElementById('OFE_EXPERIENCIA').focus();
      return false
   }
   /** #1 maf 2007-08-08 
   	* afegit check per nivell i especialitat si es selecciona un nivell amb especilitats
   	* dependents 
   	* #2 maf 2007-11-12
   	* pi : 2007000436. es demana que el nivell d'estudis sigui sempre requisit. 
   	*/
   if (document.getElementById('OFE_NIV_ESTUDIS').value != ""){	//ha seleccionat algun nivell d'estudis
   		if (taulaNivells[document.getElementById('OFE_NIV_ESTUDIS').value]==true){	//te especialitats?
			if (document.getElementById('OFE_ESPECIALITAT').value==""){	//no ha marcat cap especialitat
				alert("Si us plau, introdueix la especialitat per al nivell d'estudis indicat.");
				document.getElementById('OFE_ESPECIALITAT').focus();
				return false
			}
	    }
   }else{
		alert("Si us plau, introdueix el nivell d'estudis mínim.");
		document.getElementById('OFE_NIV_ESTUDIS').focus();
		return false   
   }
   if (document.getElementById('OFE_CONEIXEMENTS').value == "")
   {
      alert("Si us plau, indica els coneixements i/o habilitats que es requereixen per al candidat.");
      document.getElementById('OFE_CONEIXEMENTS').focus();
      return false
   }   
   return true	
}

function checksubmitOfeSel()
{
   if (document.getElementById('OFE_NOM_RESP').value == "")
   {
      alert("Si us plau, introdueix el nom del responsable de la selecció");
      document.getElementById('OFE_NOM_RESP').focus();
      return false
   }
   if (document.getElementById('OFE_COGNOMS_RESP').value == "")
   {
      alert("Si us plau, introdueix el cognom del responsable de la selecció");
      document.getElementById('OFE_COGNOMS_RESP').focus();
      return false
   }
   
   if (!checkNumberInt(document.getElementById('OFE_PLACES').value)){
		alert("Si us plau, introdueix un número de places a cobrir");
		document.getElementById('OFE_PLACES').focus();
		return false;
   }
   return true	
}

function checksubmitEmpresaRegistre(){
       if (document.getElementById('EMP_PASSWORD').value == ""){
           alert("Si us plau, introdueix un password");
           document.getElementById('EMP_PASSWORD').focus();
           return false;
       }
       if (document.getElementById('EMP_PASSWORD_2').value == ""){
           alert("Si us plau, introdueix un password");
           document.getElementById('EMP_PASSWORD_2').focus();
           return false;
        }   
       if (document.getElementById('EMP_PASSWORD').value != document.getElementById('EMP_PASSWORD_2').value){
           alert("Si us plau, les claus d'accés introduïdes han de ser iguals");
           document.getElementById('EMP_PASSWORD').focus();
           return false; 
        }
        return true;
}

/* maf 208-01-17 s'han canviat tots els accessos a document.getElementById() enlloc de document.all[] */
function checksubmitEmpresa(mode){
    if(mode=='registre'){
        if (!checksubmitEmpresaRegistre()){
            return false;
        }
	}

   if (!check_NIF(document.getElementById('EMP_NIF').value)){
        alert("Error, el NIF es incorrecte. El NIF es de la forma 12345678K, A1234567J O A12345670");
        return false;
   }
   if (document.getElementById('EMP_NOM').value == ""){
      alert("Si us plau, introdueix el nom de l'empresa");
      document.getElementById('EMP_NOM').focus();
      return false;
   }
   if (document.getElementById('EMP_DOMICILI').value == ""){
      alert("Si us plau, introdueix el domicili de l'empresa");
      document.getElementById('EMP_DOMICILI').focus();
      return false;
   }
   if (!check_cpostal(document.getElementById('EMP_CP').value)){
        alert("Si us plau, introdueix el codi postal de l'empresa correctament");
        alert("Recorda que has d'introduir un CP vàlid del tipus 12345");
        return false;
   }
   if (document.getElementById('EMP_MUNICIPI').value == ""){
      alert("Si us plau, introdueix el municipi de l'empresa");
      document.getElementById('EMP_MUNICIPI').focus();
      return false;
   }
   if (!checkNumber((document.getElementById('EMP_TELF').value),9)){
      alert("Si us plau, introdueix el telèfon de l'empresa correctament");
      alert("Recorda que has d'introduir un telefon vàlid del tipus 977112233, només números!!");
      document.getElementById('EMP_TELF').focus();
      return false;
   }
   if (document.getElementById('EMP_TELF_2').value != ""){
       if (!checkNumber((document.getElementById('EMP_TELF_2').value),9)){
          alert("Si us plau, introdueix el telèfon 2 de l'empresa correctament");
          alert("Recorda que has d'introduir un telefon vàlid del tipus 977112233, només números!!");
          document.getElementById('EMP_TELF_2').focus();
          return false;
       }
   }
   if (document.getElementById('EMP_MAIL').value != ""){
        if (!checkemail(document.getElementById('EMP_MAIL').value)){
            document.getElementById('EMP_MAIL').focus();
            return false;
        }
   }   
   if (document.getElementById('EMP_CODI_SECTOR').value == ""){
      alert("Si us plau, introdueix el sector d'activitat de l'empresa");
      document.getElementById('EMP_CODI_SECTOR').focus();
      return false;
        
   }
   
   //maf 2008-01-17 com que no es guarda ja aquesta dada es treu el check()
   //maf 2009-08-18 com que no queda clar si es guarda o no i en algnues pagines
   //               apareixen referencies encara a aquest camp el reactivo.
   if (document.getElementById('EMP_ACTIVITAT').value == ""){
      alert("Si us plau, introdueix la explicació d'activitat de l'empresa");
      document.getElementById('EMP_ACTIVITAT').focus();
      return false;
        
   }
    
   return true;
}
