var marcado=null;
function marcar(fila,c){
document.getElementById(fila).style.backgroundColor = '#ffe680';
  if(marcado!=null)
    document.getElementById(marcado).style.backgroundColor = color;
    marcado = fila;
    color = c;
}

function resaltar_1(fila){
  if(marcado!=fila) {
     document.getElementById(fila).style.backgroundColor='#ffff80';
  }
}

function resaltar_2(fila,c){
  if(marcado!=fila) {
     document.getElementById(fila).style.backgroundColor=c;
    }
}

function validar_contactos(){
 var op=0;
 if(document.myform.email.value=='' || document.myform.nombre.value==''|| document.myform.edad.selectedIndex==0 || document.myform.pais.selectedIndex==0 || document.myform.telefono.value==''){
   if(document.myform.email.value==''&&op==0){
     alert('Debe introducir su email');
     op=1;
   }
   if(document.myform.nombre.value==''&&op==0){
     alert('Debe introducir su nombre completo');
     op=1;
   }
   if(document.myform.edad.selectedIndex==0&&op==0){
     alert('Debe seleccionar su edad');
     op=1;
   }
   
   if(document.myform.pais.selectedIndex==0&&op==0){
     alert('Debe seleccionar su país');
     op=1;
   }
   
   if(document.myform.telefono.value==''&&op==0){
     alert('Debe introducir un numero de telefono de referencia');
     op=1;
   }
 }
 else {
     document.myform.boton.value='guardar';
     document.myform.submit();
 }
}

function imprSelec(nombre)
{
  var ficha = document.getElementById(nombre);
  var ventimp = window.open(' ', 'popimpr');
  ventimp.document.write( ficha.innerHTML );
  ventimp.document.close();
  ventimp.print( );
  ventimp.close();
}

function enviar_post(){
  document.myform.enviar.value='enviar';
  document.myform.submit();
}

function valEmail(){
    var valor;
    valor=document.myform.correo.value;
    re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
    if(!re.exec(valor))    {
       alert('Debe introducir una dirección de Email valido');
    }else{
        document.myform.enviar.value="enviar";
        document.myform.submit();
    }
}


