function AreaPrivada ()
{
	alert ('El nombre de usuario o contraseña son incorrectos.');
}


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

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


function Buscar ()
{
	if ((document.DatosFiltro.Provincia.value == 0) && (document.DatosFiltro.Tema.value == 0)) 
		Pars = Opc1 + '11';
	else
	{ Par1 = document.DatosFiltro.Provincia.value;
		Par2 = document.DatosFiltro.Tema.value;
		
		var Pars = Opc1  + '11' + '-' + Par1;
		if (Par2 != 0) Pars += '-' + Par2;
		
	}	
	window.location = '/acontina-' + Pars + '.html';		
}



function BuscarAsociado ()
{
	if (document.Datos.SelProvincia.value) window.location = '/acontina-7011-' + document.Datos.SelProvincia.value + '.html';
}


function BuscarPorServicio ()
{
	if (document.Datos.SelServicio.value)	window.location = '/acontina-20-' + document.Datos.SelServicio.value + '.html';
}


function BuscarProveedores ()
{	if ((document.Datos.Provincia.value) || (document.Datos.Servicio.value))
	{	if (! document.Datos.Provincia.value) window.location = '/acontina-6011-0-' + document.Datos.Servicio.value +'.html';
		else if (! document.Datos.Servicio.value)	window.location = '/acontina-6011-' + document.Datos.Provincia.value + '.html';
		else window.location = '/acontina-6011-' + document.Datos.Provincia.value + '-' + document.Datos.Servicio.value +'.html';
	} else alert ('Debe indicar un criterio de búsqueda.');
	
}


function InicializarControl (Control, Valor)
{ 
	var i = Control.length - 1;
	
	while (i >= 0 && Control.options [i].value != Valor) i--;
	if (i >= 0) Control.selectedIndex = i;
}


function InitMenu ()
{	$ ('idMenu-' + Opc1 + Opc2 , 'className', 'Seleccionado');
	$ ('idMenu-' + Opc1 , 'className', 'Seleccionado');
	
	if ((Opc1 >= 40) && (Opc1 < 50)) $ ('idMenu-40' , 'className', 'Seleccionado');
	if ((Opc1 >= 50) && (Opc1 < 60)) $ ('idMenu-50' , 'className', 'Seleccionado');
	if ((Opc1 >= 70) && (Opc1 < 80)) $ ('idMenu-70' , 'className', 'Seleccionado');
}


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

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


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

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


/* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
/* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
/* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */




function VerAgenda (oCalendario)
{
	var Ajax = new TAjax ();
	
	Ajax.Calendario = oCalendario;
	Ajax.Vars.Anyo  = oCalendario.getAnyo ();
	Ajax.Vars.Mes   = oCalendario.getMes ();
	Ajax.onCargar   = VerAgendaOn;
	
	Ajax.Cargar ('/fuentes/agendadias.php');
}


function VerAgendaOn (oPeticion)
{
	var Dias   = new Array ();
	var Anyo   = oPeticion.Calendario.getAnyo();
	var Mes    = oPeticion.Calendario.getMes();
	var Dia    = oPeticion.Calendario.getDia();
	var Fecha  = new Date ();
	var Hoy    = 0;
	var VerHoy = false;
	
	if (Dia) Hoy = Dia;
	else if (Fecha.getFullYear () == Anyo && Fecha.getMonth () + 1  == Mes) Hoy = Fecha.getDate ();
	
	if (oPeticion.asText ()) Dias = oPeticion.asText ().split ("\n");
	for (var i = Dias.length - 1; i > 0; i--)
	{	Celda = oPeticion.Calendario.Celda (Dias [i]);
		Celda.className = 'ConActo';
		Celda.setAttribute ('conActo', '1');
		if (Hoy && ! VerHoy) VerHoy = (oPeticion.Calendario.Fecha (Dias [i]) == oPeticion.Calendario.Fecha (Hoy));
	}	

 if (VerHoy) VerActos (Hoy, Anyo, Mes)
 else VerActos	(Dias [1], Anyo, Mes);
}


function VerActos (Dia, Anyo, Mes)
{
	var Ajax     = new TAjax ();
	var Etiqueta = null;

	Etiqueta = document.getElementById ('idTD1-' + Dia);
	if (Etiqueta) Etiqueta.style.backgroundColor = '#666666'; 

	Ajax.onCargar  = VerActosOn;
	Ajax.Vars.Anyo = Anyo;
	Ajax.Vars.Mes	 = Mes;
	Ajax.Vars.Dia	 = Dia;
	Ajax.ultimoDia = Dia;
	Ajax.Cargar ('/fuentes/informacionactos.php');	
}


function VerActosOn (oPeticion)
{
	ultimoDia = oPeticion.ultimoDia;
	var Etiqueta = document.getElementById ('InfoActos');

	if (Etiqueta) Etiqueta.innerHTML = oPeticion.asText (); 
}


function SeleccionarOn (oCalendario, oTd, iDia)
{
	var Etiqueta = null;
  var conActo  = 0;
  
	if (oTd.getAttribute ('conActo')) 
		{var conActo = oTd.getAttribute ('conActo').asInteger ();
		if (conActo == 1) VerActos (iDia, oCalendario.getAnyo(), oCalendario.getMes());
	
		oTd.style.backgroundColor = '#333333'; 
	
  	if (ultimoDia && (ultimoDia != iDia))
  	{ Etiqueta = document.getElementById ('idTD1-' + ultimoDia);
  		if (Etiqueta) Etiqueta.style.backgroundColor = '#666666'; 
  	}
  }  	
}


function AgendaDiaOn (oCalendario, oTd, iDia)
{
	oTd.setAttribute ('conActo', '0');
	oTd.innerHTML = iDia;	
}


function LimpiarEmail ()
{
	document.Datos.Email.value = '';
}



function Suscribir (oFormulario)
{
	var Ajax = new TAjax ()
	
	if (ValidarFormulario (oFormulario))
	{	if (! oFormulario.Lopd.checked)
			alert ('Tiene que aceptar la Política de Privacidad');
		else
		{	Ajax.onCargar   = function () { alert ('Se ha suscrito exitosamente.'); oFormulario.Email.value = 'Escriba su e-mail aqui'; oFormulario.Lopd.checked = false; };
			Ajax.Vars.Email = oFormulario.Email.value.Trim ();
			Ajax.Cargar ('/fuentes/suscribir.php');
		}
	}
}


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

	if (ValidarFormulario (oFormulario))
	{	if (oFormulario.Lopd.checked) {
			Ajax.onCargar = function () { $ ('idFormulario', 'style.display', 'none'); $ ('idEnvioOK', 'style.display', 'block'); }
			Ajax.Formulario (oFormulario);
			Ajax.Cargar ('/fuentes/enviar_contacto.php');
		} else alert ('Debe aceptar la política de privacidad y confidencialidad.');		
	}
}



function EnviarAsociado (oFormulario)
{
	var Ajax = new TAjax ();

	if (ValidarFormulario (oFormulario))
	{	if (oFormulario.Lopd.checked) {
			Ajax.onCargar = function () { $ ('idFormulario', 'style.display', 'none'); $ ('idEnvioOK', 'style.display', 'block'); }
			Ajax.Formulario (oFormulario);
			Ajax.Cargar ('/fuentes/enviar_asociado.php');
		} else alert ('Debe aceptar la política de privacidad y confidencialidad.');		
	}
}



function EnviarMejorar (oFormulario)
{
	var Ajax = new TAjax ();

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


