var areas = [	new area_class("Choose your area of interest", 
				[]),
				new area_class("1. NexTReT", 
				[					
					new seccion_class("1. Who we are", "../nextret/nextret.asp"),
					new seccion_class("2. How we are", "../nextret/nextret_valores_marca.asp")
				]),
				new area_class("2. What we do", 
				[
					new seccion_class("1. Infrastructures", "../servicios/servicios_infraestructuras.asp"),
					new seccion_class("2. Business solutions", "../servicios/servicios_soluciones_empresariales.asp"),
					new seccion_class("3. Security", "../servicios/servicios_seguridad.asp"),
					new seccion_class("4. Quality of Service Management", "../servicios/servicios_gestion_calidad.asp")
				]),
				new area_class("3. Clients", 
				[
					new seccion_class("1. Public administration", "../clientes/clientes.asp?IDSector=1"),
					new seccion_class("2. Finances", "../clientes/clientes.asp?IDSector=2"),
					new seccion_class("3. Industry", "../clientes/clientes.asp?IDSector=3"),
					new seccion_class("4. Services and Utilities", "../clientes/clientes.asp?IDSector=4")
				]),
				new area_class("4. Projects", 
				[
					new seccion_class("1. Banco Sabadell", "../proyectos/proyectos.asp?IdCaso=23")
				]),
				new area_class("5. Alliances", 
				[
					new seccion_class("1. Alliances", "../alianzas/alianzas.asp")
				]),
				new area_class("6. Events", 
				[
					new seccion_class("1. Events", "../eventos/eventos_acontecimientos.asp"),
					new seccion_class("2. Seminars", "../eventos/eventos_jornadas.asp")
				]),
				new area_class("7. Downloads", 
				[
					new seccion_class("1. Documents", "../descargas/presentaciones.asp"),
					new seccion_class("2. Seminar Documents", "../descargas/jornadas.asp")
				]),
				new area_class("8. Contact",  
				[
					new seccion_class("1. Barcelona", "../contacto/contacto_bcn.asp"),
					new seccion_class("2. Madrid", "../contacto/contacto_madrid.asp"),
					new seccion_class("3. HHRR", "../contacto/contacto_rrhh.asp")
				])
			];

function area_class(nombre, secciones)
{
	this.nombre = nombre;
	this.secciones = secciones;
}

function areas_inicializar()
{
	for (i=0; i < areas.length; i++)
	{
		var area_nombre = areas[i].nombre;
		document.getElementById('area').options[i] = new Option(area_nombre, area_nombre); //(text, value)		
	}
}

function area_seccion_ir()
{
	var obj = document.getElementById("seccion");
	if (obj.selectedIndex!=-1)
		location.href = obj.options[obj.selectedIndex].value;
}

function area_secciones_cargar()
{
	var obj = document.getElementById('seccion');
	var desplegable = document.getElementById('desplegable');
	desplegable.style.border="2px solid #fe2a12";
	
	for (i = obj.length - 1; i >= 0; i--)
		obj.remove(i);

	obj.options[0] = new Option("Choose a section", "select"); 

	var area_seleccionada = document.getElementById('area').selectedIndex; 	
	for (i=0; i < areas[area_seleccionada].secciones.length; i++)
	{		
		var nombre = areas[area_seleccionada].secciones[i].nombre;
		var url = areas[area_seleccionada].secciones[i].url;
		obj.options[i+1] = new Option(nombre, url); //(text, value)			
	}
	
	if (areas[area_seleccionada].secciones.length == 1)
		location.href = obj.options[1].value;
}

function aviso_legal_abrir()
{	
	var wnd = window.open("../_common/aviso_legal.asp", "aviso", "left=5, top=5, width=650, height=250, directories=0, location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0");
	wnd.focus();
}

function CreateControl(container, objectParamsTag, paramsIn, embedParamsTag)
{
	var objContainer = document.getElementById(container);
	
	var sHtml = "<object " + objectParamsTag + ">\n";
	
	var embedParamsIn = "";
	for (i in paramsIn)
		{
		var param_name = paramsIn[i][0];
		var param_value = paramsIn[i][1];
		
		sHtml +="<param name=\"" +  param_name + "\" value=\"" +  param_value + "\">\n";
		embedParamsIn += param_name + "=\"" + param_value + "\" ";
		}
		
	sHtml += "<embed " + embedParamsTag + " " + embedParamsIn + "></embed>";	
	sHtml += "</object>\n";

	objContainer.innerHTML = sHtml;
}

function CreateFlash(container, objId, swf, w, h, params)
{
	var defaultParams = [["wmode", "transparent"],
						["bgcolor", "#ffffff"],
						["allowScriptAccess", "sameDomain"],
						["quality", "high"]];

	if (!params)					
		params = new Array();
	
	params[params.length] = ["movie", swf];	
	
	var objectParamsTag = "classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"" +
						  " width=\"" + w + "\"" + 
						  " height=\"" + h + "\"" + 
						  " align=\"middle\"" + 
						  " id=\"" + objId  +"\"" + 
						  " VIEWASTEXT";
						  
	var embedParamsTag = "type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"" +
						" src=\"" + swf + "\"" + 
						 " width=\"" + w + "\"" + 
						 " height=\"" + h + "\"" + 
						 " name=\"" + objId + "\"" + 
						 " align=\"middle\"";
	
	params = DefaultParamsAdd(params, defaultParams);			
					 
	CreateControl(container, objectParamsTag, params, embedParamsTag);						 
}

function DefaultParamsAdd(params, defaultParams)	
{
	for (i in defaultParams)
		{
		var param_name = defaultParams[i][0];
		var param_value = defaultParams[i][1];
		
		var encontrado = false;
		var j = 0;
		
		while (!encontrado && j < params.length)
			{
			if (param_name == params[j][0])
				encontrado = true;
			j++;
			}
		if (!encontrado)
			params[params.length] = [param_name, param_value];
		}
	return(params);
}

function imprimir()
{
	window.print();
}		

function ir()
{
	if (document.getElementById("seccion").selectedIndex == 0)
		alert("Choose one section from selected area.");
	else
	{	
		var obj = document.getElementById("seccion");
		if (obj.selectedIndex!=-1)
			location.href = obj.options[obj.selectedIndex].value;
	}
}

function seccion_class(nombre, url)
{
	this.nombre = nombre;
	this.url = url;
}

function texto_modificar(elementosID, accion)
{						
	for (id in elementosID)
	{
		var tamano = parseInt(document.getElementById(elementosID[id]).style.fontSize);
		if (accion == 'disminuir')
			tamano = Math.max(tamano - 1, 9);
		else
			tamano = Math.min(tamano + 1, 15);				
	
		document.getElementById(elementosID[id]).style.fontSize = eval(tamano) + "px";
	}
}		

window.onload=function()
{
	areas_inicializar();
}

function buscar()
{	
	document.frm_busqueda.submit();	
}