function addFormEvent(func) {
  if (!document.getElementById | !document.getElementsByTagName) return
  var oldonload=window.onload
  if (typeof window.onload != 'function') { window.onload=func }
  else {
    window.onload=function() { oldonload(); func() }
  }
}

// --------------------- borders for text type inputs ------------------------------ //
function attachBorderAndSelect(id){
  var obj0 = document.getElementById(id)
  obj0.onfocus= function() {this.style.border="2px solid #F2016C"; this.select();}
  obj0.onblur = function() {
                  this.style.border="2px inset #ccc"
                  if (this.value=="") {this.value=this.defaultValue}
                  this.value=this.value
                }
}
// ----------------------------------------------------------------------------- //



// -------------------------- borders for radio and checkboxes ------------------------- //
function attachBorderToRadio(id){
  var obj0 = document.getElementById(id)
  obj0.onfocus= function() {this.style.border="2px solid #f00"}
  obj0.onblur = function() {this.style.border="2px solid #fff"}
}
// ----------------------------------------------------------------------------- //



// ------------------------------ border for submit buttons --------------------------- //
function attachBorderToButton(id){
  var obj0 = document.getElementById(id)
  obj0.onfocus= function() {this.style.border="2px solid #f00"}
  obj0.onblur = function() {this.style.border="2px outset #fff"}
}
// ----------------------------------------------------------------------------- //

function initContact(){

  if (!document.getElementsByTagName) return

 attachBorderAndSelect('Referencia_Anuncio');
 attachBorderAndSelect('Nombre');
 attachBorderAndSelect('Apellidos');
 attachBorderAndSelect('Nacionalidad');
 attachBorderAndSelect('Fecha_Nacimiento');
// attachBorderAndSelect('fnacimiento_mes');
// attachBorderAndSelect('fnacimiento_year');

// attachBorderAndSelect('nacionalidad');
 attachBorderAndSelect('NIF');
 attachBorderAndSelect('Domicilio');
 attachBorderAndSelect('CP');
 attachBorderAndSelect('Provincia');
 attachBorderAndSelect('Poblacion');
 attachBorderAndSelect('EMail');
 attachBorderAndSelect('Telefono');
 attachBorderAndSelect('Movil');

 attachBorderAndSelect('Nivel_Estudios');
 attachBorderAndSelect('Especialidad');
 attachBorderAndSelect('Postgrado');
// attachBorderAndSelect('nivel_estudios');
 attachBorderAndSelect('Idioma_Otros');
 attachBorderAndSelect('Empresa_Nombre_0');
 attachBorderAndSelect('Empresa_Cargo_0');
 attachBorderAndSelect('Empresa_Nombre_1');
 attachBorderAndSelect('Empresa_Cargo_1');

 attachBorderAndSelect('Empresa_Desde_0');
// attachBorderAndSelect('empresa_desde_mes0');
// attachBorderAndSelect('empresa_desde_year0');
 attachBorderAndSelect('Empresa_Hasta_0');
// attachBorderAndSelect('empresa_hasta_mes0');
// attachBorderAndSelect('empresa_hasta_year0');

 attachBorderAndSelect('Contrato_0_CDD');
 attachBorderAndSelect('Contrato_0_CDI');
 attachBorderAndSelect('Contrato_0_Practicas');

 attachBorderAndSelect('Empresa_Desde_1');
// attachBorderAndSelect('empresa_desde_mes1');
// attachBorderAndSelect('empresa_desde_year1');
 attachBorderAndSelect('Empresa_Hasta_1');
// attachBorderAndSelect('empresa_hasta_mes1');
// attachBorderAndSelect('empresa_hasta_year1');

 attachBorderAndSelect('Contrato_1_CDD');
 attachBorderAndSelect('Contrato_1_CDI');
 attachBorderAndSelect('Contrato_1_Practicas');

 attachBorderAndSelect('Mas_Informacion');

attachBorderToRadio('Puesto_Asistencia_Viaje');
attachBorderToRadio('Puesto_Asistencia_Hogar');
attachBorderToRadio('Puesto_Financiero_Contable');
attachBorderToRadio('Puesto_Recursos_Humanos');
attachBorderToRadio('Puesto_Depto_Comercial');
attachBorderToRadio('Puesto_Otros');
attachBorderToRadio('Puesto_Asistencia_Salud');
attachBorderToRadio('Puesto_Asistencia_Tecnica');
attachBorderToRadio('Puesto_IT');
attachBorderToRadio('Puesto_Servicios_Generales');
attachBorderToRadio('Puesto_Marketing');

attachBorderToRadio('Disponibilidad_Intensivo_Maniana');
attachBorderToRadio('Disponibilidad_Intensivo_Tarde');
attachBorderToRadio('Disponibilidad_Intensivo_Noche');
attachBorderToRadio('Disponibilidad_Completa');
attachBorderToRadio('Disponibilidad_Jornada_Manianas');
attachBorderToRadio('Disponibilidad_Jornada_Tardes');
attachBorderToRadio('Disponibilidad_Jornada_Partida');

attachBorderToRadio('Idioma_Catalan');
attachBorderToRadio('Idioma_Espaniol');
attachBorderToRadio('Idioma_Ingles');
attachBorderToRadio('Idioma_Frances');

/*
attachBorderToRadio('disponibilidad_chk4');
attachBorderToRadio('disponibilidad_chk5');
attachBorderToRadio('disponibilidad_chk6');
*/
 attachBorderToRadio('Nivel_Estudios');

// submit
attachBorderToButton('enviar');
}


addFormEvent(initContact)