
function Permut (flag,img) {
   if (document.images) {
        if (document.images[img].permloaded) {
            if (flag==1) document.images[img].src = document.images[img].perm.src
            else document.images[img].src = document.images[img].perm.oldsrc
        }
   }
}
function preloadPermut (img,adresse) {
   if (document.images) {
        img.onload = null;
        img.perm = new Image ();
        img.perm.oldsrc = img.src;
        img.perm.src = adresse;
        img.permloaded = true;
   }
}
function changeImage(filename)
{
   document.getElementById('mainimage').src = filename;
}

	function cambiar(valor)
	{
	    if (valor=="Madrid")
		{
		  var indice=0;
		  document.frmdatos.cursos.length = CURSOS_MADRID.length;
		  for(j=0;j<CURSOS_MADRID.length;j++)
		  {
             document.frmdatos.cursos.options[indice].value=CURSOS_MADRID[j];
             document.frmdatos.cursos.options[indice].text=CURSOS_MADRID[j];
             indice=indice+1;
		  }
		}
	    if (valor=="Barcelona")
		{
		  var indice=0;
		  document.frmdatos.cursos.length = CURSOS_BARCELONA.length;
		  for(j=0;j<CURSOS_BARCELONA.length;j++)
		  {
             document.frmdatos.cursos.options[indice].value=CURSOS_BARCELONA[j];
             document.frmdatos.cursos.options[indice].text=CURSOS_BARCELONA[j];
             indice=indice+1;
		  }
		}	
	    if (valor=="Sevilla")
		{
		  var indice=0;
		  document.frmdatos.cursos.length = CURSOS_SEVILLA.length;
		  for(j=0;j<CURSOS_SEVILLA.length;j++)
		  {
             document.frmdatos.cursos.options[indice].value=CURSOS_SEVILLA[j];
             document.frmdatos.cursos.options[indice].text=CURSOS_SEVILLA[j];
             indice=indice+1;
		  }
		}	
	    if (valor=="Valencia")
		{
		  var indice=0;
		  document.frmdatos.cursos.length = CURSOS_VALENCA.length;
		  for(j=0;j<CURSOS_VALENCA.length;j++)
		  {
             document.frmdatos.cursos.options[indice].value=CURSOS_VALENCA[j];
             document.frmdatos.cursos.options[indice].text=CURSOS_VALENCA[j];
             indice=indice+1;
		  }
		}	
	    if (valor=="Santiago")
		{
		  var indice=0;
		  document.frmdatos.cursos.length = CURSOS_SANTIAGO.length;
		  for(j=0;j<CURSOS_SANTIAGO.length;j++)
		  {
             document.frmdatos.cursos.options[indice].value=CURSOS_SANTIAGO[j];
             document.frmdatos.cursos.options[indice].text=CURSOS_SANTIAGO[j];
             indice=indice+1;
		  }
		}	
		
    }
	function activar(t)
	{
	 if (t=='A')
	 {
	 document.frmdatos.Socio_SGAE_Num.disabled=false;
	 }
	 else
	 {
	     document.frmdatos.Socio_SGAE_Num.disabled=true;
		 document.frmdatos.Socio_SGAE_Num.value="";
	 }
	}

function Comprobar(f)
{
if ((f.nombre.value!="")&&(f.mail.value!="")&&(f.telefono.value!="")&&(f.apellidos.value!="")&&(validarBotonRadio(f)))
{
	f.submit();
    return true;
}
 else 
 {
    if (f.nombre.value=="")
	{
       alert('Introduzca el nombre!');	
        f.nombre.focus();
	}
    else
    {
       if (f.apellidos.value=="")
	   {
	      alert('Introduzca los apellidos!');	
	        f.apellidos.focus();
		}
	    else
           if (f.telefono.value=="")
		   {
		   alert('Introduzca el telefono!');	
	           f.telefono.focus();
			   }
  	       else
	          if (f.mail.value=="")
			  {
			  alert('Introduzca el e-mail!');	
		          f.mail.focus();
				  }

     }	 
    return false;
 }
}

function validarBotonRadio(f) 
{
  var s = "no";
    for ( var i = 0; i < f.Cursos_Provincia.length; i++ ) 
	{
      if ( f.Cursos_Provincia[i].checked ) 
	  {
         s= "si";
		 return true;
	 }
    }
    if ( s == "no" )
	{
      alert("Debe seleccionar la sede del curso" ) ;
	  return false;
    }
} 	
