function InitMenu ()
{	
	var Aux = '';
	Aux = String (Opc).substr(0,2);
	
	$$ ('idMenuArea-' + Aux , 'className', 'Seleccionado');
}

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

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

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

	Ventana.Ancho       = 550;
	Ventana.Alto        = 300;
	Ventana.Nombre      = 'Lopd';
	Ventana.URL         = '/plantillas/lopd.html';
	Ventana.Open (true);
}





function VerNoticia (id)
{
	var Ventana = new TVentana ();
	
	Ventana.Ancho      = 580;
	Ventana.Alto       = 500;
	Ventana.Nombre     = 'Noticia';
	Ventana.URL        = '/fuentes/noticia.php?Id=' + id;
	Ventana.Open (true);
}



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

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



//==================================================================================
//==================================================================================
//==================================================================================

function SugerenciaCompra ()
{
	var Ajax = new TAjax ();

	if (CadenaVacia (document.Sugerencia.Nombre.value)) alert ('Tiene que indicar un nombre.');
	else if (CadenaVacia (document.Sugerencia.Numero.value)) alert ('Tiene que indicar un número de lector.');
	else if (CadenaVacia (document.Sugerencia.Titulo.value)) alert ('Tiene que indicar un titulo.');
	else
	{	Ajax.AddFormulario (document.Sugerencia);
		Ajax.OnCompletar (onSugerenciaCompra);
		Ajax.Open ('/areas/cultura/sugerenciacompra.php');
	}
}

function onSugerenciaCompra (Peticion)
{
	alert ('Su petición ha sido enviada.');
	document.Sugerencia.reset ();
}



function VerPostal (Postal)
{
	var Ventana = new TVentana ();
	
	Ventana.Ancho      = 10;
	Ventana.Alto       = 10;
	Ventana.SetTop (10);
	Ventana.ScrollBars = false;
	Ventana.Nombre     = 'Postales';
	Ventana.URL        = '../../fuentes/postal.php?Codigo=' + Postal;
	Ventana.Open (true);
}

function onClickArticulo (Ident)
{
	TEfectos.prototype.Incremento  = 10;
	
	idEfecto ('idArticulo' + Ident).Vertical();
}

function RollOut(Ident) {
	var Aux = document.getElementById("Articulo" + Ident);
	if (Aux) Aux.style.color= "#666666";
}

function RollOver(Ident) 
{ 
	var Aux = document.getElementById("Articulo" + Ident);
	if (Aux) Aux.style.color= "#7696B7";
}



function VerCalendario (oCalendario)
{
	var Ajax = new TAjax ();

	Ajax.Calendario = oCalendario;
	Ajax.Vars.Anyo  = oCalendario.getAnyo ();
	Ajax.Vars.Mes   = oCalendario.getMes ();
	Ajax.onCargar   = VerCalendarioOn;
	
	Ajax.Cargar ('/fuentes/calendariofarmacias.php');
}


function VerCalendarioOn (oPeticion)
{
	var Dias = new Array ();
	var Dia  = new Array ();


	if (oPeticion.asText ()) Dias = oPeticion.asText ().split ("\n");
	for (var i = Dias.length - 1; i > 0; i--)
	{ Dia   = Dias [i].split (";");
		Celda = oPeticion.Calendario.Celda (Dia [0]);
		Celda.style.backgroundColor = Dia [1];
	}
}




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

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

function VerOferta (Oferta)
{
	var Ventana = new TVentana ();

	Ventana.Ancho = 515;
	Ventana.Alto  = 550;
	Ventana.ScrollBars = true;
	Ventana.Nombre     = 'Empleo';
	Ventana.URL        = '/fuentes/empleopublico.php?Id=' + Oferta;
	Ventana.Open (true);
}
