var glbIdioma;
var glbstrOpcionMenuPrincipalActivada;
var glbLogoTenco;
var glbLogoTencoIntegracion;
var glbLogoTencoDomotics;
var glbLogoActivo;

var glbaryAregloCaracteres = new Array(); //Utilizado en el buscador

var htSecciones = new Array(); //Este es el HashTable para la creación de las secciones
var htArregloTexto = new Array(); //Este es el HashTable que contendrá los textos en todos los idiomas
var htMenuPrincipal = new Array(); //Este es el HashTable que permitirá construir el menú principal
var htMenuInferior = new Array(); //Este es el HashTable que permitirá construir el menu inferior
var htMenuInterno = new Array(); //Este es el HashTable que permitirá construir los menus internos

var enmMIntOpcionMenuPrincipal = 0;
var enmMIntidTextoOpcionMenu = 1;
var enmMIntidTextoOpcionMenuRedaccion = 2;
var enmMIntImagenPrincipalURL = 3;
var enmMIntImagenPrincipalAncho = 4;
var enmMIntImagenPrincipalAlto = 5;
var enmMIntImagenSecundariaURL = 6;
var enmMIntImagenSecundariaAncho = 7;
var enmMIntImagenSecundariaAlto = 8;
var enmMIntidTextoTitulo = 9;
var enmMIntArchivoFlash = 10;
var enmMIntFuncionPrevia = 11;
var enmMIntContinuar = 12;
var enmMIntFuncionPosterior = 13;


function fnLlenaHashTables()
{

	// HashTable para la creación de secciones
	htSecciones['Seccion_Integracion'] = Array('mnusupopIntegracion');
	htSecciones['Seccion_Domotics'] = Array('mnusupopDomotics');
	htSecciones['Seccion_Soporte'] = Array('mnusupopSoporte');
	htSecciones['Seccion_Clientes'] = Array('mnusupopClientes');
	htSecciones['Seccion_Contacto'] = Array('mnusupopContacto');
	htSecciones['Seccion_Nosotros'] = Array('mnusupopNosotros');

	// HashTable para el menú principal
	htMenuPrincipal['mnusupopIntegracion'] = Array('opmnuint_Integracion_','txtht_opmnusupIntegracion');
	htMenuPrincipal['mnusupopDomotics'] = Array('opmnuint_Domotics_','txtht_opmnusupDomotics');
	htMenuPrincipal['mnusupopSoporte'] = Array('opmnuint_Soporte_','txtht_opmnusupSoporte');
	htMenuPrincipal['mnusupopClientes'] = Array('opmnuint_Clientes_','txtht_opmnusupRelacion_con_los_clientes');
	htMenuPrincipal['mnusupopContacto'] = Array('opmnuint_Contacto_','txtht_opmnusupContacto');
	htMenuPrincipal['mnusupopNosotros'] = Array('opmnuint_Nosotros_','txtht_opmnusupNosotros');

	// HashTable para el menú inferior
	htMenuInferior['opmnuinfMapa'] = Array('opmnuinfMapa_','txtht_opmnuinfMapa','fnArmaMapaSitio();');
	htMenuInferior['opmnuinfPoliticasPrivacidad'] = Array('opmnuinfPoliticasPrivacidad_','txtht_opmnuinfPoliticasPrivacidad','fnMuestraPoliticasDePrivacidad();');
	htMenuInferior['opmnuinfContacto'] = Array('opmnuinfContacto_','txtht_opmnuinfContacto','fnMuestraContacto();');
	htMenuInferior['opmnuinfSoporte'] = Array('opmnuinfSoporte_','txtht_opmnuinfSoporte','fnMuestraSoporte();');
	htMenuInferior['opmnuinfMiCuenta'] = Array('opmnuinfMiCuenta_','txtht_opmnuinfMiCuenta','fnOpcionMiCuenta();');




/*
	Indices del htMenuInterno
	var enmMIntOpcionMenuPrincipal = 0;
	var enmMIntidTextoOpcionMenu = 1;
	var enmMIntidTextoOpcionMenuRedaccion = 2;
	var enmMIntImagenPrincipalURL = 3;
	var enmMIntImagenPrincipalAncho = 4;
	var enmMIntImagenPrincipalAlto = 5;
	var enmMIntImagenSecundariaURL = 6;
	var enmMIntImagenSecundariaAncho = 7;
	var enmMIntImagenSecundariaAlto = 8;
	var enmMIntidTextoTitulo = 9;
	var enmMIntArchivoFlash = 10;
	var enmMIntFuncionPrevia = 11;
	var enmMIntContinuar = 12;
	var enmMIntFuncionPosterior = 13;

*/

	//HashTable para los menus internos
	htMenuInterno['opmnuint_Integracion_Integracion'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Integracion','txtht_opmnuint_Integracion_Integracion_Redaccion','Imagenes/Principales/opmnuint_Integracion_Integracion_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Integracion_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Integracion_TituloImagen','flash/opmnuint_Integracion_Integracion_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_CCTV'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_CCTV','txtht_opmnuint_Integracion_CCTV_Redaccion','Imagenes/Principales/opmnuint_Integracion_CCTV_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_CCTV_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_CCTV_TituloImagen','flash/opmnuint_Integracion_CCTV_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Control_de_acceso'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Control_de_acceso','txtht_opmnuint_Integracion_Control_de_acceso_Redaccion','Imagenes/Principales/opmnuint_Integracion_Control_de_acceso_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Control_de_acceso_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Control_de_acceso_TituloImagen','flash/opmnuint_Integracion_Control_de_acceso_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_FAS'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_FAS','txtht_opmnuint_Integracion_FAS_Redaccion','Imagenes/Principales/opmnuint_Integracion_FAS_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_FAS_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_FAS_TituloImagen','flash/opmnuint_Integracion_FAS_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Seguridad_Estrategica'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Seguridad_Estrategica','txtht_opmnuint_Integracion_Seguridad_Estrategica_Redaccion','Imagenes/Principales/opmnuint_Integracion_Seguridad_Estrategica_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Seguridad_Estrategica_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Seguridad_Estrategica_TituloImagen','flash/opmnuint_Integracion_Seguridad_Estrategica_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Cableado_estructurado'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Cableado_estructurado','txtht_opmnuint_Integracion_Cableado_estructurado_Redaccion','Imagenes/Principales/opmnuint_Integracion_Cableado_estructurado_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Cableado_estructurado_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Cableado_estructurado_TituloImagen','flash/opmnuint_Integracion_Cableado_estructurado_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Automatizacion'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Automatizacion','txtht_opmnuint_Integracion_Automatizacion_Redaccion','Imagenes/Principales/opmnuint_Integracion_Automatizacion_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Automatizacion_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Automatizacion_TituloImagen','flash/opmnuint_Integracion_Automatizacion_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Intrusion'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Intrusion','txtht_opmnuint_Integracion_Intrusion_Redaccion','Imagenes/Principales/opmnuint_Integracion_Intrusion_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Intrusion_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Intrusion_TituloImagen','flash/opmnuint_Integracion_Intrusion_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Desarrollos_a_la_medida'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Desarrollos_a_la_medida','txtht_opmnuint_Integracion_Desarrollos_a_la_medida_Redaccion','Imagenes/Principales/opmnuint_Integracion_Desarrollos_a_la_medida_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Desarrollos_a_la_medida_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Desarrollos_a_la_medida_TituloImagen','flash/opmnuint_Integracion_Desarrollos_a_la_medida_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Integracion_Sistemas_especiales'] = Array('mnusupopIntegracion','txtht_opmnuint_Integracion_Sistemas_especiales','txtht_opmnuint_Integracion_Sistemas_especiales_Redaccion','Imagenes/Principales/opmnuint_Integracion_Sistemas_especiales_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Integracion_Sistemas_especiales_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Integracion_Sistemas_especiales_TituloImagen','flash/opmnuint_Integracion_Sistemas_especiales_Flash.swf','NINGUNA',true,'NINGUNA');

	htMenuInterno['opmnuint_Domotics_Automatizacion'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Automatizacion','txtht_opmnuint_Domotics_Automatizacion_Redaccion','Imagenes/Principales/opmnuint_Domotics_Automatizacion_ImagenPrincipal.jpg',780,312,'SINIMAGEN',106,153,'txtht_opmnuint_Domotics_Automatizacion_TituloImagen','flash/opmnuint_Domotics_Automatizacion_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Domotics_Teatro_En_Casa'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Teatro_En_Casa','txtht_opmnuint_Domotics_Teatro_En_Casa_Redaccion','Imagenes/Principales/opmnuint_Domotics_Teatro_En_Casa_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Domotics_Teatro_En_Casa_TituloImagen','flash/opmnuint_Domotics_Teatro_En_Casa_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Domotics_Multiroom'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Multiroom','txtht_opmnuint_Domotics_Multiroom_Redaccion','Imagenes/Principales/opmnuint_Domotics_Multiroom_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Domotics_Multiroom_TituloImagen','flash/opmnuint_Domotics_Multiroom_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Domotics_Iluminacion'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Iluminacion','txtht_opmnuint_Domotics_Iluminacion_Redaccion','Imagenes/Principales/opmnuint_Domotics_Iluminacion_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Domotics_Iluminacion_TituloImagen','flash/opmnuint_Domotics_Iluminacion_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Domotics_Infraestructura'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Infraestructura','txtht_opmnuint_Domotics_Infraestructura_Redaccion','Imagenes/Principales/opmnuint_Domotics_Infraestructura_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Domotics_Infraestructura_TituloImagen','flash/opmnuint_Domotics_Infraestructura_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Domotics_Seguridad'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Seguridad','txtht_opmnuint_Domotics_Seguridad_Redaccion','Imagenes/Principales/opmnuint_Domotics_Seguridad_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Domotics_Seguridad_TituloImagen','flash/opmnuint_Domotics_Seguridad_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Domotics_Institucional'] = Array('mnusupopDomotics','txtht_opmnuint_Domotics_Institucional','txtht_opmnuint_Domotics_Institucional_Redaccion','Imagenes/Principales/opmnuint_Domotics_Institucional_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Domotics_Institucional_TituloImagen','flash/opmnuint_Domotics_Institucional_Flash.swf','NINGUNA',true,'NINGUNA');

	htMenuInterno['opmnuint_Soporte_Soporte'] = Array('mnusupopSoporte','txtht_opmnuint_Soporte_Soporte','txtht_opmnuint_Soporte_Soporte_Redaccion','Imagenes/Principales/opmnuint_Soporte_Soporte_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Soporte_Soporte_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Soporte_Soporte_TituloImagen','flash/opmnuint_Soporte_Soporte_Flash.swf','NINGUNA',true,'NINGUNA');

	//htMenuInterno['opmnuint_Clientes_Clientes'] = Array('mnusupopClientes','txtht_opmnuint_Clientes_Clientes','txtht_opmnuint_Clientes_Clientes_Redaccion','Imagenes/Integracion.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Clientes_Clientes_TituloImagen','flash/opmnuint_Clientes_Clientes_Flash.swf','fnSeccionPersonalizada_Clientes()',false,'NINGUNA');
	htMenuInterno['opmnuint_Clientes_Clientes'] = Array('mnusupopClientes','txtht_opmnuint_Clientes_Clientes','txtht_opmnuint_Clientes_Clientes_Redaccion','Imagenes/Principales/opmnuint_HelpDesk_HelpDesk_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Clientes_Clientes_TituloImagen','flash/opmnuint_Clientes_Clientes_Flash.swf','NINGUNA',false,'NINGUNA');


	htMenuInterno['opmnuint_Contacto_Contacto'] = Array('mnusupopContacto','txtht_opmnuint_Contacto_Contacto','PERSONALIZADO','Imagenes/Principales/opmnuint_Contacto_Contacto_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Contacto_Contacto_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Contacto_Contacto_TituloImagen','flash/opmnuint_Contacto_Contacto_Flash.swf','fnSeccionPersonalizada_Contacto()',false,'NINGUNA');

	htMenuInterno['opmnuint_Nosotros_Tenco'] = Array('mnusupopNosotros','txtht_opmnuint_Nosotros_Tenco','txtht_opmnuint_Nosotros_Tenco_Redaccion','Imagenes/Principales/opmnuint_Nosotros_Tenco_ImagenPrincipal.jpg',780,312,'Imagenes/Secundarias/opmnuint_Nosotros_Tenco_ImagenSecundaria.jpg',160,160,'txtht_opmnuint_Nosotros_Tenco_TituloImagen','flash/opmnuint_Nosotros_Tenco_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Nosotros_Reconocimientos'] = Array('mnusupopNosotros','txtht_opmnuint_Nosotros_Reconocimientos','txtht_opmnuint_Nosotros_Reconocimientos_Redaccion','Imagenes/Principales/opmnuint_Nosotros_Reconocimientos_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Nosotros_Reconocimientos_TituloImagen','flash/opmnuint_Nosotros_Reconocimientos_Flash.swf','NINGUNA',true,'NINGUNA');
	htMenuInterno['opmnuint_Nosotros_PoliticasPrivacidad'] = Array('mnusupopNosotros','txtht_opmnuint_Nosotros_PoliticasPrivacidad','txtht_opmnuint_Nosotros_PoliticasPrivacidad_Redaccion','Imagenes/Principales/opmnuint_Nosotros_PoliticasPrivacidad_ImagenPrincipal.jpg',780,312,'SINIMAGEN',107,153,'txtht_opmnuint_Nosotros_PoliticasPrivacidad_TituloImagen','flash/opmnuint_Nosotros_PoliticasPrivacidad_Flash.swf','NINGUNA',true,'NINGUNA');

	

}

function fnInicializar()
{

	fnCargaArregloTexto();
	fnLlenaHashTables();
	fnLlenaArregloCaracteresEspeciales();
	var strIdioma;
	//fnObjeto('CeldaMenuPrincipal').innerHTML = fnCreaMenuPrincipal();


	fnCreaSecciones();

	fnObjeto('CeldaMenuInferior').innerHTML = fnCreaMenuInferior('_Home');


	strIdioma = fnObtieneCookie("ckiIdiomaSeleccionado");
	if ((strIdioma)&&(strIdioma!=undefined)&&(strIdioma!='undefined'))
	{
		//fnObjeto("lbxIdioma").value = strIdioma;
		glbIdioma = strIdioma;
	}
	else
	{
		//fnObjeto("lbxIdioma").value = 0;
		glbIdioma = 0;
	}

	//fnAcomodaTextos();		
//alert(glbIdioma);
	fnCambiaIdioma(glbIdioma);
	fnCambiaLogo('');
	
	fnLimpiaMenuSuperior();
	//fnAcomodaMenuSuperior();
	
}

function fnLlenaArregloCaracteresEspeciales()
{
	//var glbaryAregloCaracteres = new Array();

	glbaryAregloCaracteres[0] = Array('á','a');
	glbaryAregloCaracteres[1] = Array('é','e');
	glbaryAregloCaracteres[2] = Array('í','i');
	glbaryAregloCaracteres[3] = Array('ó','o');
	glbaryAregloCaracteres[4] = Array('ú','u');
	glbaryAregloCaracteres[5] = Array('\u00e1','a');
	glbaryAregloCaracteres[6] = Array('\u00e9','e');
	glbaryAregloCaracteres[7] = Array('\u00ed','i');
	glbaryAregloCaracteres[8] = Array('\u00f3','o');
	glbaryAregloCaracteres[9] = Array('\u00fa','u');
	glbaryAregloCaracteres[10] = Array('&aacute;','a');
	glbaryAregloCaracteres[11] = Array('&eacute;','e');
	glbaryAregloCaracteres[12] = Array('&iacute;','i');
	glbaryAregloCaracteres[13] = Array('&oacute;','o');
	glbaryAregloCaracteres[14] = Array('&uacute;','u');
	glbaryAregloCaracteres[15] = Array('Á','A');
	glbaryAregloCaracteres[16] = Array('É','E');
	glbaryAregloCaracteres[17] = Array('Í','I');
	glbaryAregloCaracteres[18] = Array('Ó','O');
	glbaryAregloCaracteres[19] = Array('Ú','U');
	glbaryAregloCaracteres[20] = Array('\u00c1','A');
	glbaryAregloCaracteres[21] = Array('\u00c9','E');
	glbaryAregloCaracteres[22] = Array('\u00cd','I');
	glbaryAregloCaracteres[23] = Array('\u00d3','O');
	glbaryAregloCaracteres[24] = Array('\u00da','U');
	glbaryAregloCaracteres[25] = Array('&Aacute;','A');
	glbaryAregloCaracteres[26] = Array('&Eacute;','E');
	glbaryAregloCaracteres[27] = Array('&Iacute;','I');
	glbaryAregloCaracteres[28] = Array('&Oacute;','O');
	glbaryAregloCaracteres[29] = Array('&Uacute;','U');
	glbaryAregloCaracteres[30] = Array('ñ','n');
	glbaryAregloCaracteres[31] = Array('\u00f1','n');
	glbaryAregloCaracteres[32] = Array('&ntilde;','n');
	glbaryAregloCaracteres[33] = Array('Ñ','N');
	glbaryAregloCaracteres[34] = Array('\u00d1','N');
	glbaryAregloCaracteres[35] = Array('&Ntilde;','N');
	glbaryAregloCaracteres[36] = Array('ç','c');
	glbaryAregloCaracteres[37] = Array('\u00E7','c');
	glbaryAregloCaracteres[38] = Array('&ccedil;','c');
	glbaryAregloCaracteres[39] = Array('Ç','C');
	glbaryAregloCaracteres[40] = Array('\u00C7','C');
	glbaryAregloCaracteres[41] = Array('&Ccedil;','C');


	//return glbaryAregloCaracteres;
}

function fnEntra(objObjeto)
{

	fnLimpiaMenuSuperior();
	fnObjeto('CeldaDivContenido').className = 'DivContenido';
	fnLimpiaSeccionPersonalizada();
	fnMarcaOpcionMenuPrincipalSeleccionada(objObjeto);
	fnCambiaLogo(objObjeto.id);
	fnCargaDivInformacion(objObjeto, false);
	fnCambiaMenuInferior('');
	fnDesactivaBanners();
	//fnCargaDivInformacion(Objeto);
}

function fnMuestraHome()
{
	fnLimpiaMenuSuperior();
	fnCierraResultadosBuscador();
	fnCambiaMenuInferior('_Home');

	fnObjeto('CeldaDivContenido').className = 'DivContenido_Home';
	fnObjeto('DivContenidoHome').className = 'clsDivContenidoHome';
	fnObjeto('DivContenidoPlantilla').className = 'clsDivContenido_Oculto';
	fnCambiaLogo('_Home');
	fnDesactivaBanners();
}

function fnMarcaOpcionMenuPrincipalSeleccionada(objObjeto)
{

	fnObjeto('DivContenidoHome').className = 'clsDivContenidoHome_Oculto';
	fnObjeto('DivContenidoPlantilla').className = 'DivContenido';


	fnObjeto(objObjeto.id + '_OrejaIzquierda').className = 'BotonMenuSuperiorSeleccionado_OrejaIzquierda';
	fnObjeto(objObjeto.id + '_OrejaDerecha').className = 'BotonMenuSuperiorSeleccionado_OrejaDerecha';
	fnObjeto(objObjeto.id).className = 'BotonMenuSuperiorSeleccionado_Contenido';
	fnObjeto(htMenuPrincipal[objObjeto.id][1]).className = 'BotonMenuSuperiorSeleccionado_Contenido';
}


function fnSale(Objeto)
{
	//document.getElementById("Espacio").innerHTML = "Se Salio"
	//Objeto.setAttribute("class", "BotonMenuSuperior");
	//Objeto.className = "BotonMenuSuperior"
}

function fnClick(Objeto)
{

}


function fnSeleccionaOpcionInterna(objObjeto, blnActivaOpcionMenuPrincipal)
{
	var strLlaveMenuInterno;
	var strFuncionPrevia;
	var blnContinuar;
	var strFuncionPosterior;
	var strOpcionMenuPrincipal;

	if (blnActivaOpcionMenuPrincipal == null)
	{
		blnActivaOpcionMenuPrincipal = false;
	}

	strLlaveMenuInterno = objObjeto.id;

	fnLimpiaMenuInterno();
	fnLimpiaContenido();
	fnCierraResultadosBuscador();

	if (blnActivaOpcionMenuPrincipal)
	{
		strOpcionMenuPrincipal = htMenuInterno[strLlaveMenuInterno][enmMIntOpcionMenuPrincipal];
		fnEntra(fnObjeto(strOpcionMenuPrincipal));
		fnLimpiaMenuInterno();
		fnLimpiaContenido();
	}


	strFuncionPrevia = htMenuInterno[strLlaveMenuInterno][enmMIntFuncionPrevia];
	blnContinuar = htMenuInterno[strLlaveMenuInterno][enmMIntContinuar];
	strFuncionPosterior = htMenuInterno[strLlaveMenuInterno][enmMIntFuncionPosterior];

	if (strFuncionPrevia.toUpperCase() != 'NINGUNA')
	{
		eval(strFuncionPrevia);
	}



	if (fnObjeto(strLlaveMenuInterno))
	{
		fnObjeto(strLlaveMenuInterno).className = 'DivOpcionMenuInterno_Seleccionada';

		if (fnObjeto(strLlaveMenuInterno+'_Redaccion'))
		{
			fnObjeto(strLlaveMenuInterno+'_Redaccion').className = 'SeccionRedaccion_Mostrada';
		}
		if (fnObjeto(strLlaveMenuInterno+'_ImagenPrincipal'))
		{
			fnObjeto(strLlaveMenuInterno+'_ImagenPrincipal').className = 'SeccionImagenPrincipal_Mostrada';
		}
		if (fnObjeto(strLlaveMenuInterno+'_TituloImagen'))
		{
			fnObjeto(strLlaveMenuInterno+'_TituloImagen').className = 'SeccionImagenPrincipalTexto_Mostrada';
		}
		if (fnObjeto(strLlaveMenuInterno+'_ImagenSecundaria'))
		{
			fnObjeto(strLlaveMenuInterno+'_ImagenSecundaria').className = 'SeccionImagenSecundaria_Mostrada';
		}
	}

	if (!blnContinuar)
	{
		return;
	}

	if (strFuncionPosterior.toUpperCase() != 'NINGUNA')
	{
		eval(strFuncionPosterior);
	}
}

function fnLimpiaMenuInterno()
{
	for (var strLlaveMenuInterno in htMenuInterno) 
	{
		if (fnObjeto(strLlaveMenuInterno).className == 'DivOpcionMenuInterno_Seleccionada')
		{
			fnObjeto(strLlaveMenuInterno).className = 'DivOpcionMenuInterno';
		}
	}
}


function fnAcomodaTextos()
{
	var objColeccionElementos;
	var intIdioma;

	//intIdioma = parseInt(fnObjeto("lbxIdioma").value);
	intIdioma = glbIdioma;

	for (var strLlave in htArregloTexto) 
	{

		if (fnObjeto(strLlave))
		{
			fnObjeto(strLlave).innerHTML = htArregloTexto[strLlave][intIdioma];
		}
	}
} 


function fnCambiaIdioma(intIdioma)
{

	glbIdioma = intIdioma;
	fnAcomodaTextos();
	//fnCreaCookie("ckiIdiomaSeleccionado",fnObjeto("lbxIdioma").value);
	fnCreaCookie("ckiIdiomaSeleccionado",glbIdioma);
	if (glbIdioma == 1) //Inglés
	{
		glbLogoTenco = 'Imagenes/logo_tenco.jpg';
		glbLogoTencoIntegracion = 'Imagenes/logo_integration.jpg';
		glbLogoTencoDomotics = 'Imagenes/logo_domotics.jpg';
	}
	else //Español
	{
		glbLogoTenco = 'Imagenes/logo_tenco.jpg';
		glbLogoTencoIntegracion = 'Imagenes/logo_integracion.jpg';
		glbLogoTencoDomotics = 'Imagenes/logo_domotics.jpg';
	}
	fnCambiaLogo('');
}

function fnCambiaLogo(strCual)
{
	if (strCual == '')
	{
		strCual = glbstrOpcionMenuPrincipalActivada;
	}
	if (strCual=="mnusupopIntegracion")
	{
		glbLogoActivo = glbLogoTencoIntegracion
	}
	else if (strCual=="mnusupopDomotics")
	{
		glbLogoActivo = glbLogoTencoDomotics
	}
	else
	{
		glbLogoActivo = glbLogoTenco
	}
	fnActivaLogo();
	glbstrOpcionMenuPrincipalActivada = strCual ;
}

function fnActivaLogo()
{
	fnObjeto('ImagenLogo').src = glbLogoActivo;
}

function fnLimpiaMenuSuperior()
{

	for (var strLlave in htMenuPrincipal) 
	{
		fnObjeto(strLlave + '_OrejaIzquierda').className = 'BotonMenuSuperiorNoSeleccionado_OrejaIzquierda';
		fnObjeto(strLlave + '_OrejaDerecha').className = 'BotonMenuSuperiorNoSeleccionado_OrejaDerecha';
		fnObjeto(strLlave).className = 'BotonMenuSuperiorNoSeleccionado_Contenido';
		fnObjeto(htMenuPrincipal[strLlave][1]).className = 'BotonMenuSuperiorNoSeleccionado_Contenido';
		fnObjeto(htMenuPrincipal[strLlave][0]).className = 'DivMenuInterno_Oculto';
	} 

}

function fnLimpiaContenido()
{

	for (var strLlaveMenuInterno in htMenuInterno) 
	{
		if (fnObjeto(strLlaveMenuInterno))
		{
			//fnObjeto(strLlaveMenuInterno).className = 'DivMenuInterno_Oculto';
			if (fnObjeto(strLlaveMenuInterno+'_Redaccion'))
			{
				fnObjeto(strLlaveMenuInterno+'_Redaccion').className = 'SeccionRedaccion_Oculta';
			}
			if (fnObjeto(strLlaveMenuInterno+'_ImagenPrincipal'))
			{
				fnObjeto(strLlaveMenuInterno+'_ImagenPrincipal').className = 'SeccionImagenPrincipal_Oculta';
			}
			if (fnObjeto(strLlaveMenuInterno+'_TituloImagen'))
			{
				fnObjeto(strLlaveMenuInterno+'_TituloImagen').className = 'SeccionImagenPrincipalTexto_Oculta';
			}
			if (fnObjeto(strLlaveMenuInterno+'_ImagenSecundaria'))
			{
				fnObjeto(strLlaveMenuInterno+'_ImagenSecundaria').className = 'SeccionImagenSecundaria_Oculta';
			}
		}

	}
}

function fnMuestraContenidoSeccion(objObjeto)
{
	var strLlaveMenuInterno;

	fnLimpiaContenido();

	if (fnObjeto(strLlaveMenuInterno+'_Redaccion'))
	{
		fnObjeto(strLlaveMenuInterno+'_Redaccion').className = 'SeccionRedaccion_Mostrada';
	}
	if (fnObjeto(strLlaveMenuInterno+'_ImagenPrincipal'))
	{
		fnObjeto(strLlaveMenuInterno+'_ImagenPrincipal').className = 'SeccionImagenPrincipal_Mostrada';
	}
	if (fnObjeto(strLlaveMenuInterno+'_ImagenSecundaria'))
	{
		fnObjeto(strLlaveMenuInterno+'_ImagenSecundaria').className = 'SeccionImagenSecundaria_Mostrada';
	}

}

function fnCargaDivInformacion(objObjeto, blnCorreEntra)
{
	var strOpcionMenuPrincipal;
	strOpcionMenuPrincipal = htMenuPrincipal[objObjeto.id][0]
	fnObjeto(strOpcionMenuPrincipal).className = 'DivMenuInterno_Mostrado';

	if (blnCorreEntra == null)
	{
		blnCorreEntra = true;
	}

	for (var strLlaveMenuInterno in htMenuInterno) 
	{
		if (strLlaveMenuInterno.substring(0,strOpcionMenuPrincipal.length) == strOpcionMenuPrincipal)
		{
			//Activa la primera opcion del menu interno de la seccion seleccionada
			//fnMuestraContenidoSeccion(fnObjeto(strLlaveMenuInterno));
			fnSeleccionaOpcionInterna(fnObjeto(strLlaveMenuInterno), blnCorreEntra);
			break;
		}
	}
}


function fnCreaMenuPrincipal()
{


	//Esta funcion regresa el html del menú principal
	var strResultado;

	strResultado = '<table cellspacing=0 cellpadding=0 align=left><tr>';

	for (var strLlave in htMenuPrincipal) 
	{
		//strResultado += '<div style="width:30px;"><table border=1 width="100%" class="RedondoNoSeleccionado" cellspacing = 0 cellpadding=0 id="' + strLlave +'" onmouseover="fnEntra(this)" onmouseout="fnSale(this)"><tr><td style="width:15px"><ul style="width:15px"></ul></td><td><div id="' + htMenuPrincipal[strLlave][1] + '" nowrap></div></td><td><li></li></td></tr></table></div>\n'
		//strResultado += '<div style="width:30px;"><table border=1 width="100%" class="RedondoNoSeleccionado" cellspacing = 0 cellpadding=0 id="' + strLlave +'" onmouseover="fnEntra(this)" onmouseout="fnSale(this)"><tr><td style="width:15px"><p style="width:15px"></p></td><td><div id="' + htMenuPrincipal[strLlave][1] + '" nowrap></div></td><td><li></li></td></tr></table></div>\n'
		//strResultado += '<td><table border=1 width="100%" class="RedondoNoSeleccionado" cellspacing = 0 cellpadding=0 id="' + strLlave +'" onmouseover="fnEntra(this)" onmouseout="fnSale(this)"><tr><td><ul></ul></td><td><div id="' + htMenuPrincipal[strLlave][0] + '" nowrap></div></td><td><li></li></td></tr></table></td>\n'

		strResultado += '<td><div class="BotonMenuSuperior"><table cellspacing=0 cellpadding=0 id="' + strLlave +'" onmouseover="fnEntra(this)" onmouseout="fnSale(this)"><tr><td class="BotonMenuSuperiorNoSeleccionado_OrejaIzquierda" id="' + strLlave + '_OrejaIzquierda"></td><td class="BotonMenuSuperiorNoSeleccionado_Contenido" style="vertical-align:middle" valign="middle"><div id="' + htMenuPrincipal[strLlave][1] + '" nowrap></div></td><td class="BotonMenuSuperiorNoSeleccionado_OrejaDerecha"  id="' + strLlave + '_OrejaDerecha"></td></tr></table></div></td>';


		//Construye el Menú Interno

		if (fnObjeto(htMenuPrincipal[strLlave][0]))
		{
			//alert(htMenuPrincipal[strLlave][0])
			fnObjeto(htMenuPrincipal[strLlave][0]).innerHTML = fnCreaMenuInterno(htMenuPrincipal[strLlave][0]);
		}

	} 
	 strResultado += "</td></tr></table>";
	return strResultado;
}


function fnCreaMenuInterno(strCual)
{

	
	//Esta funcion regresa el html del Menú Interno seleccionado
	var strResultado = '';
	var blnPonerLinea = false;

	for (var strLlave in htMenuInterno) 
	{
//alert(strCual + " = " + strLlave.substring(0,strCual.length));
		if (strLlave.substring(0,strCual.length) == strCual)
		{
			if (blnPonerLinea)
			{
				strResultado += '<div class="DivLineaMenuInterno"></div>\n';
			}
			strResultado += '<div class="DivOpcionMenuInterno" id="' + strLlave + '"><div id="' + htMenuInterno[strLlave][enmMIntidTextoOpcionMenu] + '"></div></div>';
			blnPonerLinea = true;
		}
	} 
	return strResultado;

}

function fnCreaMenuInferior(strSufijoClase)
{
	//Esta funcion regresa el html del menú principal
	var strResultado;
	var dtHoy = new Date();
	var blnPoneDivision = false;
	//strResultado = '<table><tr><td>&copy; ' + dtHoy.getYear() + ' Tenco.</td><td>&nbsp;</td>';
	//strResultado = '<table><tr><td>&copy; ' + dtHoy.format("yyyy") + ' Tenco.</td><td>&nbsp;</td>';

	fnObjeto('CeldaMenuInferior').className='clsEspacioGeneralMenuInferior'+strSufijoClase;


	strResultado = '<div id="MenuInferior_RenglonEnBlanco_Superior" class="clsMenuInferior_RenglonEnBlanco'+strSufijoClase+'"></div>';
	strResultado += '<div id="DivMenuInferior" class="DivMenuInferior'+strSufijoClase+'" width="100%"><table><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&copy; ' + dateFormat(dtHoy,"yyyy") + ' Tenco.</td><td>&nbsp;</td>';

	for (var strLlave in htMenuInferior) 
	{
		if (blnPoneDivision)
		{
			strResultado += '<td>|</td>';
		}
		blnPoneDivision = true;
		strResultado += '<td id="' + strLlave +'"><div class="BotonMenuInferior'+strSufijoClase+'" id="' + htMenuInferior[strLlave][1] + '" onclick="' + htMenuInferior[strLlave][2] + '" nowrap></div></td>'
	} 
	strResultado += '</tr></table></div><div id="MenuInferior_RenglonEnBlanco_Inferior" class="clsMenuInferior_RenglonEnBlanco'+strSufijoClase+'"></div>';
	return strResultado;
}

function fnCambiaMenuInferior(strSufijoClase)
{
	fnObjeto('CeldaMenuInferior').className='clsEspacioGeneralMenuInferior'+strSufijoClase;
	fnObjeto('MenuInferior_RenglonEnBlanco_Superior').className = 'clsMenuInferior_RenglonEnBlanco'+strSufijoClase
	fnObjeto('DivMenuInferior').className = 'DivMenuInferior'+strSufijoClase
	for (var strLlave in htMenuInferior) 
	{
		fnObjeto(htMenuInferior[strLlave][1]).className = 'BotonMenuInferior'+strSufijoClase
	} 
	fnObjeto('MenuInferior_RenglonEnBlanco_Inferior').className = 'clsMenuInferior_RenglonEnBlanco'+strSufijoClase
}

function fnSinAccion()
{
}

function fnMuestraPoliticasDePrivacidad()
{
	fnEntra(fnObjeto('mnusupopNosotros'));
	fnSeleccionaOpcionInterna(fnObjeto('opmnuint_Nosotros_PoliticasPrivacidad'));
}

function fnMuestraContacto()
{
	fnEntra(fnObjeto('mnusupopContacto'));
	fnSeleccionaOpcionInterna(fnObjeto('opmnuint_Contacto_Contacto'));
}

function fnMuestraSoporte()
{
	fnEntra(fnObjeto('mnusupopSoporte'));
	fnSeleccionaOpcionInterna(fnObjeto('opmnuint_Soporte_Soporte'));
}

function fnMuestraReconocimientos()
{
	fnEntra(fnObjeto('mnusupopNosotros'));
	fnSeleccionaOpcionInterna(fnObjeto('opmnuint_Nosotros_Reconocimientos'));
}

function fnMuestraNosotros()
{
	fnEntra(fnObjeto('mnusupopNosotros'));
	fnSeleccionaOpcionInterna(fnObjeto('opmnuint_Nosotros_Nosotros'));
}

function fnOpcionMiCuenta()
{
	window.navigate("http://tenco.dyndns.info/HelpDesk/Administracion");
}

function fnLink_Maximizar()
	{
		fnObjeto('LinkExterno_Div').className = 'clsLinkExterno_Maximizado';
	}
function fnLink_Restaurar()
	{
		fnObjeto('LinkExterno_Div').className = 'clsLinkExterno_Restaurado';
	}

function fnCambiaVariableFlash()
{
	//document.all("txtElTexto").value = (hometheatre_textovariable.GetVariable('fvTextoOpcion'));
	hometheatre_textovariable.SetVariable('fvTextoOpcion', escape(document.all("txtElTexto").value)) 
}

function fnDesactivaBanners()
{
	fnObjeto('Banner20Anos_Grande').className = 'clsDivBannerGrande_Oculto'
	fnObjeto('BannerExperiencias_Grande').className = 'clsDivBannerGrande_Oculto'
	fnObjeto('BannerReconocimientos_Grande').className = 'clsDivBannerGrande_Oculto'
}

function fnActivaBanner(objBannerChico)
{
	var strIdBanner;
	fnDesactivaBanners();
	strIdBanner = objBannerChico.id.replace('_Chico','');
	fnObjeto(strIdBanner+'_Grande').className = 'clsDivBannerGrande_Activado'
}

function fnEventoKeyPressBuscador()
{
	if (window.event.keyCode ==13) //Tecla Enter
	{
		if (fnObjeto('txtBuscar').value.length > 0)
		{
			fnBuscar();
		}

	}
	if (window.event.keyCode ==27) //Tecla Escape
	{
		fnCierraResultadosBuscador();
	}
}
function fnActivaTextboxBuscador()
{
	fnObjeto('ControlBuscador').className = 'clsBuscador_activo';
}
function fnDesactivaTextboxBuscador()
{
	fnObjeto('ControlBuscador').className = 'clsBuscador_inactivo';
}
