oMenuAct   		 = null;

function AvisoLegal (Lng)
{
	var Ventana = new TVentana ();

	Ventana.Ancho       = 550;
	Ventana.Alto        = 400;
	Ventana.Nombre      = 'AvisoLegal';
	Ventana.URL         = '/fuentes/avisolegal.php?Lng='+ Lng;
	Ventana.Open (true);
}

function Lopd (Lng)
{
	var Ventana = new TVentana ();

	Ventana.Ancho       = 550;
	Ventana.Alto        = 300;
	Ventana.Nombre      = 'AvisoLegal';
	Ventana.URL         = '/fuentes/avisolegal.php?Lopd=1&Lng=' + Lng;
	Ventana.Open (true);
}

function Mejorar (Lng)
{
	var Ventana = new TVentana ();

	Ventana.Ancho       = 550;
	Ventana.Alto        = 400;
	Ventana.Nombre      = 'Mejorar';
	Ventana.URL         = '/fuentes/mejorar.php?Lng='+ Lng;
	Ventana.Open (true);
}


function InitMenu ()
{	
	$ ('idMenu-' + Opc1 + Opc2 + Opc3 , 'className', 'Seleccionado');
	$ ('idMenu-' + Opc1 + Opc2 , 'className', 'Seleccionado');
	$ ('idMenu-' + Opc1 , 'className', 'Seleccionado');
	
	if (Opc1 == 12) InitMenuProfesionales ();
}




function InitMenuProfesionales ()
{	
	if ('idli-'+Opc != 'idli-' + Opc1 + Opc2 + Opc3)
	{ 
		var Efecto = idEfecto ('idli-' + Opc1 + Opc2);

		if (Efecto.Display () != 'block')
		{	Efecto.Vertical ();
			if (oMenuAct && oMenuAct != Efecto)
			{	oMenuAct.Vertical ();
			}
			oMenuAct = Efecto;
		}
	} else $ ('idli-'+ Opc1 + Opc2, 'style.display', 'block');
	
	$ ('idMenu-' + Opc1 + Opc2 + '-' + Par1, 'className', 'Seleccionado');
}



function MenuProfesionales (iOpc)
{
	var Efecto = idEfecto ('idli-12' + Opc2);
//	Efecto.Incremento = 2;
	Efecto.Vertical ();
}


function AreadePractica ()
{
	if (document.Datos.Areas.value != 9)	window.location = '/index.php?Opc=1110' + document.Datos.Areas.value + '&Lng=' + Lng;
	else window.location = '/index.php?Opc=1110&Lng='+Lng+'&Par1=3';
}

function AreasDePractica (Pagina)
{
  if (! Pagina)	window.location = '/index.php?Lng=' + Lng;
	else window.location = '/index.php?Opc=1110&Lng='+Lng+'&Par1=' + Pagina;
}


function SelProfesionales ()
{	                                             
	if (document.Datos.Profesionales.value)	window.location = '/index.php?Opc=121010&Lng='+Lng+'&Par1=' + document.Datos.Profesionales.value;
}



function Suscribir (oFormulario)
{
	var Ajax = new TAjax ()
	
	if (ValidarFormulario (oFormulario))
	{	Ajax.onCargar   = function () { oFormulario.Email.value = 'Escriba su e-mail aquí'; };
		Ajax.Vars.Email = oFormulario.Email.value.Trim ();
		Ajax.Cargar ('/fuentes/suscribir.php');
	}
}



function EnviarContacto (Formulario)
{
	var Ajax = new TAjax ();

	if (ValidarFormulario (Formulario))
	{	if (! Formulario.Lopd.checked) Aviso ('Tiene que aceptar la Ley de Protección de Datos', 'You have to accept the Data Protection Act', 'Vous devez accepter le Data Protection Act');
		else
		{	Ajax.onCargar = function (oPeticion) 
											{ switch (oPeticion.asText ())
												{	case 'CAPTCHA':
														Aviso ('El código de seguridad no es correcto', 'The security code is incorrect', 'Le code de sécurité est incorrect');
														CambiarImagen ();
														break;
													default:
														$ ('idFormulario', 'style.display', 'none'); 
														$ ('idEnvioOK', 'style.display', 'block');
												}
											}
			Ajax.Formulario (Formulario);
			Ajax.Cargar ('/fuentes/enviar_contacto.php');
		}
	}
}

function EnviarUnete (Formulario)
{
	var Ajax = new TAjax ();

	if (ValidarFormulario (Formulario))
	{	if (! Formulario.Lopd.checked) Aviso ('Tiene que aceptar la Ley de Protección de Datos', 'You have to accept the Data Protection Act', 'Vous devez accepter le Data Protection Act');
		else
		{	Ajax.onCargar = function (oPeticion) 
											{ switch (oPeticion.asText ())
												{	case 'CAPTCHA':
														Aviso ('El código de seguridad no es correcto', 'The security code is incorrect', 'Le code de sécurité est incorrect');
														CambiarImagen ();
														break;
													default:
														$ ('idFormulario', 'style.display', 'none'); 
														$ ('idEnvioOK', 'style.display', 'block');
												}
											}
			Ajax.Formulario (Formulario);
			Ajax.Cargar ('/fuentes/enviar_unete.php');
		}
	}
}


function AyudenosAMejorar (Formulario)
{
	var Ajax = new TAjax ();

	if (ValidarFormulario (Formulario))
	{	Ajax.onCargar = function () { $ ('idFormulario', 'style.display', 'none'); $ ('idEnvioOK', 'style.display', 'block'); };
		Ajax.Formulario (Formulario);
		Ajax.Cargar ('/fuentes/ayudenosamejorar.php');
	}
}



function CambiarIdioma (iLng)
{
	Lng = iLng;
	CargarPagina ();
}


function CargarPagina ()
{
	var Pars = '?Opc=' + Opc;

	if (Lng)  Pars += '&Lng='  + Lng;
	if (Par1) Pars += '&Par1=' + Par1;
	if (Par2) Pars += '&Par2=' + Par2;

	window.location = '/index.php' + Pars;
}



function Aviso (sEsp, sIng, sFra)
{
	if (Lng == 2) alert (sIng);
	else if (Lng == 3) alert (sFra);
	else alert (sEsp);
}

function CambiarImagen ()
{
	var Ajax = new TAjax ();
	
	Ajax.onCargar = function (oPeticion) { $ ('idCaptcha', 'src', '/fuentes/captcha.php?Id=' + new Date().getTime()); }
	Ajax.Vars.Cambiar = 1;
	Ajax.Cargar ('/fuentes/captcha.php');
}
