﻿/**************************/
/***** FUNCION MENU *******/
/**************************/
function cambiaMenu(celda, clase){
	document.getElementById(celda).className = clase;
}


// Funcion para poner el foco del cursor
// Recibe el campo en el cual se pondra el foco
function ponerFoco(campo){
 	document.getElementById(campo).focus();
}								   


// Funcion para cambiar la clase
// Recibe el elemento y la nueva clase
function cambiaClase(elemento, clase, estado){	   
    if(estado==1)					  
	{
	 document.getElementById(elemento).className = clase;
	}
	else
	{	
 	  if(document.getElementById(elemento).value == "")
	  {
	     document.getElementById(elemento).className = clase;
	  }
	  else
	  {
	     document.getElementById(elemento).background = "#b5c2e2";
	  } 
	}
}


function CompruebaFormulario(dni) { 
	      var errorMsg = "";

		  numero = dni.substr(0,dni.length-1);
		  let = dni.substr(dni.length-1,1);
		  numero = numero % 23;
		  letra='TRWAGMYFPDXBNJZSQVHLCKET';
		  letra=letra.substring(numero,numero+1);
		  if (letra!=let) 
		    errorMsg += "\n\t - DNI ERRONEO";
		
		if (errorMsg != ""){ 
				msg = "El DNI no es correcto.\n";
				alert(msg + errorMsg + "\n\n");
				return false;
		}	
		
	return true;
	}


//Funcion para cambiar imagenes
function cambiaImg(img, foto)
{
    document.getElementById(img).src = foto;
}


//Funcion que abre el rueiro indicado
function abreRueiro(nombre)
{

    if (nombre=="tom")
		window.open('frameRueiro.aspx?s=tom','Rueiro','scrollbars=yes,resizable=no,width=867,height=700,status=no,location=no,toolbar=no');
	else if (nombre=="goi")
		window.open('frameRueiro.aspx?s=goi','Rueiro','scrollbars=yes,resizable=no,width=867,height=700,status=no,location=no,toolbar=no');
}