

Main.InitMenus = function  (aURL)
{
	if (aURL.length == 1 && aURL [0] == '') $ ('idMen_inicio', 'className', 'Seleccionado');
	for (var i = aURL.length - 1; i >= 0; i--)
	 $ ('idMen' + (i ? i : '') + '_' + aURL [i], 'className', 'Seleccionado');
}


//////////////////////////////////////////////////
//////////////////////////////////////////////////
//////////////////////////////////////////////////

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

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


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 Main (iOpc)
{
	Opc = iOpc;

	CargarPagina ();
}



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

	if (Par1) Pars += '&Par1=' + Par1;
	if (Par2) Pars += '&Par2=' + Par2;
	if (Par4) Pars += '&Par4=' + Par4;
	
	window.location = '/index.php' + Pars;
}

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

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


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

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


Main.VerSubmenu1 = function (aURL) 
{
	if (aURL [1] == 'organigrama') $('idSubmenu1', 'style.display', 'block');
	else $('idSubmenu1', 'style.display', 'none');
}

Main.RejillaOfertas = function (Pagina)
{
	var Rejilla = new TRejilla ('idRejillaOfertas');

	Rejilla.VerOferta    	= false;
	Rejilla.onActivarFila = Main.onSeleccionar;
	Rejilla.Vars.Pagina   = Pagina;
	Rejilla.Cargar ('/fuentes/ofertasempleo.php');
}


Main.onSeleccionar = function (Rejilla, Fil, Col)
{
	if (Rejilla.VerOferta)
	{	var Ajax = new TAjax ();                
	  Ajax.Vars.Oferta = Rejilla.asInteger ('Id');
		Ajax.onCargar    = function (oPeticion)
											 { $ ('idRejillaOfertas', 'style.display', 'none');
											 	 $ ('idDetalleOferta', 'innerHTML', oPeticion.asText ());
											 	 $ ('idDetalleOferta', 'style.display', 'block');
											 };          	                                        
		Ajax.Cargar ('/fuentes/veroferta.php');		
	} else Rejilla.VerOferta = true;   
}


Main.InscripcionOferta = function (iIdOferta)
{                 
	$ ('idDetalleOferta', 'style.display', 'none');
	document.Inscripcion.NombreOferta.value     = document.getElementById("idNombreOferta").innerHTML;
	document.Inscripcion.FI_Oferta.value        = iIdOferta;
	document.Inscripcion.NOferta.value					= document.getElementById("idNombreOferta").innerHTML;
	$ ('idFormularioInscripcion', 'style.display', 'block');
	
	
}

Main.EnviarCurriculum = function () 
{
	$ ('idDetalleOferta', 'style.display', 'none');
	$ ('idRejillaOfertas', 'style.display', 'none');
	$ ('idDatosOferta', 'style.display', 'none');
	$ ('idSinOfertas',  'style.display', 'none');
	$ ('idFormularioInscripcion', 'style.display', 'block');
}
   
   

Main.EnviarInscripcion = function ()
{
	if (Formulario.Validar (document.Inscripcion))	
		if (document.Inscripcion.Lopd.checked) document.Inscripcion.submit ();
		else 
		{	alert ('Debe aceptar la política de privacidad y confidencialidad.');		
			return (false);
		}	
	else return (false);
}

   
   
Main.ValidarUsuario = function (oFormulario)
{
	var Ajax = new TAjax ();

	if (Formulario.Validar (oFormulario))
	{	Ajax.onCargar = function (Peticion) 
										{	if (Peticion.asText () == 'OK') window.location = '/fuentes/areaprivadadatos.php';
											else alert ("Código de usuario o clave incorrectos.\nRecuerde que la clave es sensible\na mayúsculas y minúsculas");}
		Ajax.Vars.Usuario = oFormulario.Usuario.value.Trim ();
		Ajax.Vars.Clave   = oFormulario.Clave.value.Trim ();
		
		Ajax.Cargar ('/fuentes/identificarusuario.php', 'Cargando');
	}
}



Main.EnviarSolicitud = function (oFormulario, sTabla)
{
	var Ajax = new TAjax ();

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


Main.InscripcionCurso = function ()
{
	$ ('idDetalleCurso', 'style.display', 'none');
	$ ('idFormulario', 'style.display', 'block');
}




Main.Suscribir = function (oFormulario)
{
	var Ajax = new TAjax ()
	
	if (Formulario.Validar (oFormulario))
	{	if (oFormulario.Lopd.checked)
		{	Ajax.onCargar   = function () { alert ('Se ha suscrito exitosamente a nuestro boletín.'); oFormulario.Email.value = ''; oFormulario.Lopd.checked = false; };
			Ajax.Vars.Email = oFormulario.Email.value.Trim ();
			Ajax.Cargar ('/fuentes/suscribir.php');
		}	else alert ('Debe aceptar la política de privacidad y confidencialidad.');		
	}
}


function RollOut (oImg) 
{
oImg.src = oImg.src.substr (0, oImg.src.length - 7) + '.gif';
}


function RollOver (oImg) 
{ 
oImg.src = oImg.src.substr (0, oImg.src.length - 4) + '_on.gif';
}

