/*

	Programed by: Francisco Javier Martínez.

	To: Tecknosfera DBNET.

	Date: 21/01/2006

	

	Functions to Menu section.

*/



// The Navigator Array Objects.

// Contain the Page to load and the Title of the page.

var sectionPages = new Array(

	{page:"bienvenidos.php", title:"Bienvenidos"}, 

	{page:"Informacion_Corporativa.php", title:"Información Corporativa"}, 

	{page:"servicios.php", title:"Servicios"}, 

	{page:"metodologia.php", title:"Metodología"}, 

	{page:"Objetivos.php", title:"Objetivos"}, 
	
	{page:"Foro.php", title:"Foro"}, 

	{page:"contacto.php", title:"Contacto"}, 

	{page:"TS_Capital_Management.php", title:"TS Capital Management"}, 

	{page:"Systems.php", title:"Systems"}, 

	{page:"Trading_Radar.php", title:"Trading Radar"}, 

	{page:"Funcionamiento.php", title:"Funcionamiento"},

	{page:"contratacion.php", title:"Contratación"},
 
	{page:"attetendance.php", title:"Atetendance"},

	{page:"noticias_ver.php?id=", title:"Noticias"},
	
	{page:"TS_DAI.php", title:"TS DAI"}

);



var defaultLenguaje = "es";



// Function to change the value of the INPUT navigator element and make the POST of the form to load the new section

function loadSection(idSection)

{

	// The first and the any element of the navigatorForm, is the element to determinate the section to load

	document.forms["navegacion"].elements["navegacion[seccion]"].value = idSection;

	document.forms["navegacion"].elements["navegacion[titularSeccion]"].value = getTitlePageForId(idSection);

	document.forms["navegacion"].action = getPageForId(idSection);

	document.forms["navegacion"].submit();

}



// Function to load a NEW

function loadNew(idNew)

{

	// The first and the any element of the navigatorForm, is the element to determinate the section to load

	document.forms["navegacion"].elements["navegacion[seccion]"].value = 11;

	document.forms["navegacion"].elements["navegacion[titularSeccion]"].value = getTitlePageForId(11);

	document.forms["navegacion"].action = getPageForId(11) + idNew;

	document.forms["navegacion"].submit();

}



// Function to send the New to one Friend

function sendToFriend()

{

	var idNew = document.location.href.split("id=")[1];

	// The first and the any element of the navigatorForm, is the element to determinate the section to load

	document.forms["navegacion"].elements["navegacion[seccion]"].value = 11;

	document.forms["navegacion"].elements["navegacion[titularSeccion]"].value = getTitlePageForId(11);

	document.forms["navegacion"].elements["navegacion[paginaAMandar]"].value = document.location.href;

	document.forms["navegacion"].elements["navegacion[amigoPagina]"].value = document.forms["enviarAmigo"].elements["amigoPagina"].value;

	document.forms["navegacion"].action = getPageForId(11) + idNew;

	document.forms["navegacion"].submit();

}





// Function to set into the Navigator TD the actual section loaded

function setNavigatorSection(section, actualURL)

{

	if(section != 0)

	{

		// Si es la carga de una noticia...

		if(section == 10)

		{

			document.getElementById("navigator").innerHTML = "";

			document.getElementById("navigator").appendChild(LIB_DHTML.createDynamicLink("navigator", 'javascript:loadSection(0)', 'Tsanalytics.com', 'a11_CCCCCC'));

	

			document.getElementById("navigator").appendChild(document.createTextNode(' / '));

			document.getElementById("navigator").appendChild(LIB_DHTML.createDynamicLink("navigator", 'javascript:void(null)', actualURL, 'a11_CCCCCC'));

		}

		else

		{

			document.getElementById("navigator").innerHTML = "";

			document.getElementById("navigator").appendChild(LIB_DHTML.createDynamicLink("navigator", 'javascript:loadSection(0)', 'Tsanalytics.com', 'a11_CCCCCC'));

	

			document.getElementById("navigator").appendChild(document.createTextNode(' / ' + actualURL));

		}

	}

	else

	{

		// Set on the Navigator TD the section to Load

		document.getElementById("navigator").innerHTML = "Tsanalytics.com / " + actualURL;

	}

	document.title = "TS Analytics - " + actualURL;

}



// Function to return the PHP page (url) to load with the Param Section ID

function getPageForId(idSection)

{

	var sectionToload = ""

	if(document.location.href.indexOf("/html/")!=-1)

	{

		pageToLoad = sectionPages[idSection].page;

	}

	else

	{

		pageToLoad = "html/" + defaultLenguaje + "/" + sectionPages[idSection].page;

	}

	return(pageToLoad);

}



function getTitlePageForId(idSection)

{

	return(sectionPages[idSection].title);

}

