/**
 * Wil Wazka (syscomware) - 2010-02-19 Bogotá, Colombia
 */
function AddEventHandler (elem, evt, func) {
    if (elem == undefined) return;
    if (! elem ) return;
	try {
		if (elem.addEventListener)  // W3C DOM
			elem.addEventListener(evt, func, false);
		else if (elem.attachEvent) { // IE DOM
			 var r = elem.attachEvent("on"+evt, func);
		return r;
		}
		else throw 'No es posible agregar observador de evento.';
	}
	catch (ex)
	{
		if (console && console.error)
			console.error("Error adding event Handler: "+ex);
		else
			alert("Error adding event Handler: "+ex);
	}
}	
	
//Rota Imagenes Con Resumen
//function muestra_imagen(archivo,Titulo,sigla,resumen,link1){ 
 
 //xInnerHtml(sigla+'c1','' + archivo);
 //xInnerHtml(sigla+'Label3','' + link1+Titulo+'</a>');
 //xInnerHtml('Label4','' + sigla);
 //xInnerHtml(sigla+'Label5','' + resumen);
//} 
//Fin Rota Imagenes Con Resumen

function muestra_imagen(archivo,ancho,alto,resumen,link1){ 
try {
 xInnerHtml('id_img_pub0','' + archivo);
 xInnerHtml('Label1','' + ancho+alto+'</a>');
 xInnerHtml('Label2','' + link1);
 xInnerHtml('Label3','' + resumen);
 //xInnerHtml('Label6','' + link1);
 //init(ancho,alto,resumen)
}
    catch (e) {
}
} 

/***************************FUNCIONES DE DETECCION DE BROWSER*********************************/
var BrowserDetect = {
	init: function () {
	try {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
    }
    catch (e) {
    }
	},
	searchString: function (data) {
	try {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	}
    catch (e) {
    }
	},
	searchVersion: function (dataString) {
	try {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	}
    catch (e) {
    }
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
};
/***************************FIN FUNCIONES DE DETECCION DE BROWSER*********************************/
//FUNCION DE VALIDACION DE EMAIL
function ValidaEstructuraEmail(addr,man,db) 
{
    if (addr == '' && man) {if (db) alert('El email es obligatorio.');return false;}
    if (addr == '') return true;
    var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
    for (i=0; i<invalidChars.length; i++) {
        if (addr.indexOf(invalidChars.charAt(i),0) > -1) {if (db) alert('El email contiene caracteres invalidos.');return false;}
    }
    for (i=0; i<addr.length; i++) {
        if (addr.charCodeAt(i)>127){if (db) alert("El email contiene caracteres no ascii.");return false;}
    }
    var atPos = addr.indexOf('@',0);
    if (atPos == -1){if (db) alert('El email debe contener el simbolo @');return false;}
    if (atPos == 0){if (db) alert('El email no debe iniciar con @');return false;}
    if (addr.indexOf('@', atPos + 1) > - 1) {if (db) alert('El email solo debe contener un simbolo @');return false;}
    if (addr.indexOf('.', atPos) == -1) {if (db) alert('El dominio del email es invalido.');return false;}
    if (addr.indexOf('@.',0) != -1) {if (db) alert('El simbolo \'@.\' no es valido.');return false;}
    if (addr.indexOf('.@',0) != -1){if (db) alert('El simbolo \'.@\' no es valido.');return false;}
    if (addr.indexOf('..',0) != -1) {if (db) alert('El simbolo \'..\' no es valido.');return false;}
    var suffix = addr.substring(addr.lastIndexOf('.')+1);
    if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
        if (db) alert('El dominio del email es invalido.');return false;}
    return true;
}


//VARIABLES DE DETECCION DE POSICION DEL MOUSE EN LA PANTALLA
var xMousePos = 0; // Horizontal position of the mouse on the screen
var yMousePos = 0; // Vertical position of the mouse on the screen
var xMousePosMax = 0; // Width of the page
var yMousePosMax = 0; // Height of the page

/*************************FUNCION MUESTRA POPUP************************/
/***************
 * Modificacion: Agregar una función de auto-redimensionado al iframe, 
 *   para adoptar las dimensiones de su contenido.
 * @Author: Wilson Guasca (syscomware) - 2010-02-17
 //*************/
if (window.addEventListener)
	window.addEventListener('load', AddIFrameOnload, false );
else if (window.attachEvent)
	window.attachEvent('onload', AddIFrameOnload );
function AddIFrameOnload()
{
    var iFramePopUp = document.getElementById('imgCapa');
	if (iFramePopUp == null)
	{
		return;
	}
	
	if (iFramePopUp.addEventListener) iFramePopUp.addEventListener('load', redimFrame, false);
	else if (iFramePopUp.attachEvent) iFramePopUp.attachEvent("onload", redimFrame);
}
/***************
 * Fin Modificacion
 ***************/

function Mostrar(UrlAbrir,AnchoVentana,AltoVentana)
{
    var iframeMostrar;
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA IFRAME A MOSTRAR
    iframeMostrar = document.getElementById('imgCapa');
    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner');
    if(iframeMostrar != null && divImagenBig != null && divImagenBigInner != null)
    {
        //CAPTURA DISTANCIA Y DE LA VENTANA
        var dsoctop = document.all? iecompattest().scrollTop : pageYOffset

        //ASIGNA PROPIEDADES AL IFRAME    
        iframeMostrar.style.width = AnchoVentana + 'px';
        iframeMostrar.style.height = AltoVentana + 'px';
		//alert("Abrir documento en iFrame");
        iframeMostrar.src = UrlAbrir;
       	//iframeMostrar.onload = alert(iframeMostrar.contentWindow.document.body.clientHeight);alert(iframeMostrar.contentWindow.document.body.offsetHeight);

        //ASIGNA PROPIEDADES A DIV DE EFECTOS
        divImagenBig.style.visibility = "";
        divImagenBig.style.display='block';
        divImagenBig.style.height = (window.document.body.scrollHeight) + 150+ 'px';
		//alert("ok");
        divImagenBig.style.overflow = 'auto';

        divImagenBigInner.style.visibility = "";
	    divImagenBigInner.style.display='block';

	    //ASIGNA POSICION DEL IFRAME
	    divImagenBigInner.style.left = ((document.body.clientWidth/2) - (AnchoVentana/2))+'px';	    
	    divImagenBigInner.style.top = (dsoctop + 50) + 'px';
    }
}

function MostrarGaleria(UrlAbrir,AnchoVentana,AltoVentana)
{
    var iframeMostrar;
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA IFRAME A MOSTRAR
    iframeMostrar = document.getElementById('imgCapa');
    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner');
    if(iframeMostrar != null && divImagenBig != null && divImagenBigInner != null)
    {
        //CAPTURA DISTANCIA Y DE LA VENTANA
        var dsoctop = document.all? iecompattest().scrollTop : pageYOffset

        //ASIGNA PROPIEDADES AL IFRAME    
        iframeMostrar.style.width = AnchoVentana + 'px';
        iframeMostrar.style.height = AltoVentana + 'px';
		//alert("Abrir documento en iFrame");
        iframeMostrar.src = UrlAbrir;
       	//iframeMostrar.onload = alert(iframeMostrar.contentWindow.document.body.clientHeight);alert(iframeMostrar.contentWindow.document.body.offsetHeight);

        //ASIGNA PROPIEDADES A DIV DE EFECTOS
        divImagenBig.style.visibility = "";
        divImagenBig.style.display='block';
        divImagenBig.style.height = (window.document.body.scrollHeight) + 150+ 'px';
		//alert("ok");
        divImagenBig.style.overflow = 'auto';

        divImagenBigInner.style.visibility = "";
	    divImagenBigInner.style.display='block';

	    //ASIGNA POSICION DEL IFRAME
	    divImagenBigInner.style.left = ((document.body.clientWidth/2) - (AnchoVentana/2))+'px';	    
	    divImagenBigInner.style.top = ('20px');
    }
}
/*************************FIN FUNCION MUESTRA POPUP************************/

/*************************FUNCION PARA CAMBIAR EL TAMAÑO DEL POPUP ************************/
function redimFrame()
{
	var alturaPagina;
	var AnchoPagina;
	var divImagenBig;
	var iframeMostrar = document.getElementById('imgCapa');
	divImagenBig = document.getElementById('ImagenBig');
	alturaPagina = iframeMostrar.contentWindow.document.body.scrollHeight ;
	AnchoPagina = iframeMostrar.contentWindow.document.body.scrollWidth ;
	
	//alert('alturaPagina: '+alturaPagina);
	if ( parseInt(iframeMostrar.style.height, 10) < alturaPagina )
	{
		iframeMostrar.style.height = alturaPagina + 'px';
		if ( parseInt(window.document.body.scrollHeight, 10) < alturaPagina )
	  { 
		divImagenBig.style.height = (alturaPagina) + 100 + 'px';
		 //iframeMostrar.style.width = AnchoPagina + 'px';
	  }  	
	}	
}
/*************************FIN FUNCION PARA CAMBIAR EL TAMAÑO DEL POPUP ************************/

/*************************FUNCION OCULTA POPUP************************/
function Ocultar()
{
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner');

	iframeMostrar = document.getElementById('imgCapa');
    if(divImagenBig != null && divImagenBigInner != null)
    {
        divImagenBig.style.display = 'none';
	    divImagenBigInner.style.display = 'none';
		iframeMostrar.src = 'about:blank';
    }
}

function OcultarGaleria()
{
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBigCarrusel');
    divImagenBigInner = document.getElementById('ImagenBigInnerCarrusel');

	iframeMostrar = document.getElementById('imgCapaCarrusel');
    if(divImagenBig != null && divImagenBigInner != null)
    {
        divImagenBig.style.display = 'none';
	    divImagenBigInner.style.display = 'none';
		//iframeMostrar.src = 'about:blank';
    }
}
/*************************FIN FUNCION OCULTA POPUP************************/

/*************************FUNCION CAPTURA ALTO DE VENTANA************************/
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
/*************************FIN FUNCION CAPTURA ALTO DE VENTANA************************/


/*************************FUNCION DE CAMBIO PROPIEDAD DE CONTROL************************/

function FuncionCambioPropiedadControl(idControl, Propiedad, NuevoValor)
{
    var ctrl;
    //CAPTURA CONTROL
    ctrl = document.getElementById(idControl);
    if(ctrl != null && ctrl.attributes[Propiedad] != null)
    {
        //ASIGNA NUEVO VALOR A LA PROPIEDAD
        ctrl.attributes[Propiedad].nodeValue = NuevoValor;
    }
}
/*************************FIN FUNCION DE CAMBIO PROPIEDAD DE CONTROL************************/

/*************************FUNCION DE CAMBIO ESTILO DE CONTROL************************/

function FuncionCambioEstiloControl(idControl, Estilo, NuevoValor)
{
    var ctrl;
    //CAPTURA CONTROL
    ctrl = document.getElementById(idControl);
    if(ctrl != null)
    {
        //ASIGNA NUEVO VALOR AL ESTILO
        ctrl.style[Estilo] = NuevoValor;
    }
}
/*************************FIN FUNCION DE CAMBIO ESTILO DE CONTROL************************/





/*******Leonardo Guerrero************/

function OcultarAvatar(pImagen,Pimagenoriginal)
{
	var x = document.getElementById('ImagenBig')
	x.style.visibility = "hidden"
	var x = document.getElementById('ImagenBigInner');
	x.style.visibility = "hidden";
	//window.location.reload();
	var lImagen = document.getElementById('Avatar1');
	lImagen.src = pImagen;
	lImagen.width = 100;
  lImagen.height = 100;

	var lImagen = document.getElementById('Avatar');
	lImagen.value = Pimagenoriginal;
}

function fImprime()
{	
	window.print();
}

function VotarArticulo(idobj, possel)
{	
	 if(!isNaN(possel))
                    {
                        var i;
                        for(i = 1; i < 6; i++)
                        {
                            var objDiv = document.getElementById(idobj + i);
                            if(objDiv != null)
                            {
                                if(i <= possel)
                                {
                                    objDiv.className = 'btn_star_zoN';
                                }
                                else
                                {
                                    objDiv.className = 'btn_star_zPro';
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
}

function VotarArticuloout(idobj, possel)
{	
	 if(!isNaN(possel))
                    {
                        var i;
                        for(i = 1; i < 6; i++)
                        {
                            var objDiv = document.getElementById(idobj + i);
                            if(objDiv != null)
                            {
                                if(i <= possel)
                                {
                                    objDiv.className = 'btn_staron';
                                }
                                else
                                {
                                    objDiv.className = 'btn_starof';
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
}



function cerrar()
	{
		window.parent.Ocultar();
	}
	
function Redireccionar(codpais,codciudad,nompais)
{
	  window.parent.navigate('home'+ nompais +'.asp?slctpis=' + codpais + '&NomPais='+nompais+'&slctcdad=' + window.document.getElementById(codciudad).value);
}

/************************************FUNCIONES BASICAS DE AJAX**********************************************/
//VARIABLES GLOBALES FUNCIONAMIENTO DEL COMPONENTE AJAX
var objXmlHttpPostBack;
var objRespuestaPostback;
var objTemporizadorPostback;
var objFuncionFinalizacionPostBack;
var objTipoRespuestaPostBack = 0;

//INICIA LAS VARIABLES GLOBALES DEL COMPONENTE AJAX
objXmlHttpPostBack = CreaObjetoAjax();

//FUNCION CREA EL OBJETO AJAX QUE REALIZA EL POSTBACK
function CreaObjetoAjax() 
{ 
    var _xmlhttp;
    /*@cc_on @*//*@if (@_jscript_version >= 5)
    var idAX = ["Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];
    for(var i=0; !_xmlhttp && i<idAX.length; i++)
    {   try{_xmlhttp = new ActiveXObject(idAX[i]);}
        catch(ex) { _xmlhttp = false; }
    }@end @*/
    if (!_xmlhttp && typeof XMLHttpRequest!='undefined') 
    {
        _xmlhttp = new XMLHttpRequest();
    }

    return _xmlhttp;
} 
//FUNCION QUE REALIZA EL LLAMADO ASINCRONICO
function RealizaPostBackAsincronico(UrlLlamado, MetodoLlamado, FuncionFinalizacion, TipoRespuesta, Parametros)
{
	  //LIMPIA Y DETIENE EL TEMPORIZADOR
    clearTimeout(objTemporizadorPostback);
    if(objXmlHttpPostBack)
    {
        
        if(objXmlHttpPostBack.readyState == 0 || objXmlHttpPostBack.readyState == 4)
        { 
        	  
            objFuncionFinalizacionPostBack = FuncionFinalizacion;
            objTipoRespuestaPostBack = TipoRespuesta;
            objRespuestaPostback = '';
           
            objXmlHttpPostBack.onreadystatechange = CambioEstadoRequest;
            // alert('aqui');
            objXmlHttpPostBack.open(MetodoLlamado,UrlLlamado,true);
            if(MetodoLlamado == 'POST')
            {
                objXmlHttpPostBack.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                objXmlHttpPostBack.setRequestHeader("Content-length", Parametros.length);
                objXmlHttpPostBack.setRequestHeader("Connection", "close");            
                objXmlHttpPostBack.send(Parametros);                
            }
            else
            objXmlHttpPostBack.send(null);
        }
        else
        {
            //alert('Procesando solicitud...');
        }
    }
}
//FUNCION QUE ATIENDE EL LLAMADO ASINCRONICO
function CambioEstadoRequest()
{
    //if(objXmlhttp.readyState == 1){CARGANDO}
    //else if(objXmlhttp.readyState == 2){SIN CONTENIDO}
    //else if(objXmlhttp.readyState == 3){INGRESANDO OBJETOS}
    //else if(objXmlhttp.readyState == 4){COMPLETA}
    if(objXmlHttpPostBack.readyState == 4)
    {
        if(objXmlHttpPostBack.status == 200)
        {
            if(objTipoRespuestaPostBack == 0)
            {
                objRespuestaPostback = objXmlHttpPostBack.responseXML;
            }
            else
            {
                objRespuestaPostback = objXmlHttpPostBack.responseText;
            }
            objTemporizadorPostback = setTimeout(objFuncionFinalizacionPostBack, 1);
        }
        else
        {
            alert('Error de Servidor Respuesta de la peticion : ' + objXmlHttpPostBack.status);
            //alert(objXmlHttpPostBack.responseText);
        }
    }
    else
    {
        //EJECUTA FUNCION DE ESPERA DE LA RESPUESTA
        //alert(objXmlHttpPostBack.readyState)
    }
}

/************************************FIN FUNCIONES BASICAS DE AJAX**********************************************/
/************************************IMPLEMENTACION AJAX**********************************************/

function fnLlamarInfoPresupuesto(iddropdown)
{
    var objDdlCambiar = document.getElementById(iddropdown);
    if(objDdlCambiar != null)
    {  
        if(navigator.appName == "Microsoft Internet Explorer")
        {
            //alert(objRespuestaPostback);
            objDdlCambiar.innerHTML = objRespuestaPostback;
        }
        else
        {
            //alert('explorer no');
            objDdlCambiar.innerHTML = objRespuestaPostback;
        }
    }
}

/************************************FIN IMPLLEMENTACION AJAX**********************************************/

function Ajax2Niveles(idcontrolevaluar, url,parametros)
{
    
	RealizaPostBackAsincronico(url, "POST", "fnLlamarInfoPresupuesto('" + idcontrolevaluar + "')", 1, parametros)
	
}

/******************************METODOS DE ACORDEON**********************************************/

var AcordeonModificado=function()
{
	var tm=sp=3;
	
	function slider(n)
	{
	    this.nm=n; 
	    this.arr=[]; 
	    this.classdespliega=[]; 
	    this.classoculta=[];
	}
	
	slider.prototype.init=function(t, c)
	{
		var a,h,s,l,i; 
		a = document.getElementById(t); 
		h = a.getElementsByTagName('dt'); 
		s = a.getElementsByTagName('dd'); 
		
		this.l=h.length;
		
		for(i=0; i<this.l; i++)
		{
		    var d = h[i]; 
		    this.arr[i] = d; 
		    
		    var valdespliega = d.getAttribute("classdespliega");
		    var valoculta = d.getAttribute("classoculta");

		    this.classdespliega[i] = valdespliega?valdespliega:'';
		    this.classoculta[i] = valoculta?valoculta:'';
		    
		    d.onclick = new Function(this.nm+'.pro(this)'); 
		    if(c == i)
		    {
		        d.className = this.classdespliega[i];
		    }
		    else
		    {
		        d.className = this.classoculta[i];
		    }
		}
		l=s.length;
		for(i=0;i<l;i++)
		{
		    var d = s[i]; 
		    d.mh = d.offsetHeight; 
		    if(c!=i)
		    {
		        d.style.height=0; 
		        d.style.display='none'
		    }
		}
	}
	
	slider.prototype.pro=function(d)
	{
		for(var i=0;i<this.l;i++)
		{
			var h=this.arr[i], s=h.nextSibling; 
			s=s.nodeType!=1?s.nextSibling:s; 
			clearInterval(s.tm);
			if(h==d && s.style.display == 'none')
			{
			    s.style.display=''; 
			    su(s,1); 
			    h.className = this.classdespliega[i];
			}
			else if(s.style.display == '')
			{
			    su(s,-1); 
			    h.className = this.classoculta[i];
			}
		}
	}
	
	function su(c,f){c.tm=setInterval(function(){sl(c,f)},tm)}
	
	function sl(c,f)
	{
		var h=c.offsetHeight, m=c.mh, d=f==1?m-h:h; 
		c.style.height=h+(Math.ceil(d/sp)*f)+'px';
		c.style.opacity=h/m; 
		c.style.filter='alpha(opacity='+h*100/m+')';
		if(f==1&&h>=m)
		{
		    clearInterval(c.tm)
		}
		else if(f!=1&&h==1)
		{
		    c.style.display='none'; 
		    clearInterval(c.tm)
		}
	}
	return{slider:slider}
}();

/******************************FIN METODOS DE ACORDEON**********************************************/

/*****************************METODOS DE MENU PRINCIPAL*********************************************/

var ClaseMenuPrincipal = function()
{
    //ATRIBUTOS
    var Temporizador;
    function MenuPrincipal(oNombreVariable)
    {
        this.NombreVariable = oNombreVariable;
        this.idDivContenedor = '';
        this.ItemsMenu = [];
        this.objdtSeleccionado;
        this.NumeroItems = 0;
        this.intItemSel = 0;
        this.intSubItemSel = 0;
    }
    MenuPrincipal.prototype.IniciaMenuPrincipal = function(oidDivContenedor,ointItemSel,ointSubItemSel)
    {
        //CAPTURA DIV CONTENEDOR DEL MENU
        this.idDivContenedor = oidDivContenedor;
        var objDiv = document.getElementById(this.idDivContenedor);
        var i, j, objdl;
        
        //CAPTURA ITEM SELECCIONADO
        if(!isNaN(ointItemSel))
            this.intItemSel = ointItemSel;
        if(!isNaN(ointSubItemSel))
            this.intSubItemSel = ointSubItemSel;
        
        if(objDiv != null)
        {
            //CATURA TODOS LOS ITEMS DEL MENU
            objdl = objDiv.getElementsByTagName('dl');
            
            this.NumeroItems = objdl.length;
            
            for(i = 0; i < this.NumeroItems; i++)
            {
                //OBTIENE ITEM PRINCIPAL
                this.ItemsMenu[i] = objdl[i];
                
                //OBTIENE TAG DESCRIPTIVOS DEL MENU
                var objdt = objdl[i].getElementsByTagName('dt');
                if(objdt.length > 0)
                {
                    //OBTIENE LOS SUBITEMS DEL MENU
                    var objli = objdt[0].getElementsByTagName('li');
                    
                    //ASIGNA EVENTOS AL ITEM PRINCIPAL
                    this.ItemsMenu[i].onmouseover =  new Function(this.NombreVariable + '.MouseOverdl(this,this.getElementsByTagName(\'dt\')[0],' + i + ')');
                    this.ItemsMenu[i].onmouseout =  new Function(this.NombreVariable + '.MouseOutdl(this,this.getElementsByTagName(\'dt\')[0],' + i + ')');
                    //VERIFICA SELECCION DEL ITEM PRINCIPAL                                
                    if(i == this.intItemSel)
                    {
                        this.ItemsMenu[i].className = 'seleccionado';
                        this.objdtSeleccionado = objdt[0]; 
                        this.objdtSeleccionado.style['display'] = 'block';
                        for(j = 0; j < objli.length; j++)
                        {
                            if(j == this.intSubItemSel)
                            {
                               objli[j].className = 'seleccionado';
                            }
                            else
                            {
                                objli[j].className = 'noactivo';
                                objli[j].onmouseover =  new Function(this.NombreVariable + '.MouseOverli(this)');
                                objli[j].onmouseout =  new Function(this.NombreVariable + '.MouseOutli(this)');                                            
                            }
                        }
                    }
                    else
                    {
                        objdt[0].style['display'] = 'none';
                        
                        for(j = 0; j < objli.length; j++)
                        {
                            objli[j].className = 'noactivo';
                            objli[j].onmouseover =  new Function(this.NombreVariable + '.MouseOverli(this)');
                            objli[j].onmouseout =  new Function(this.NombreVariable + '.MouseOutli(this)');
                        }                                        
                    }
                }
            }
        }
    }
    MenuPrincipal.prototype.MouseOverdl = function(objdl, objdt, posobj)
    {
        clearTimeout(Temporizador);
        if(this.intItemSel != posobj)
        {
            objdl.className = 'activo';
            this.ItemsMenu[this.intItemSel].className = '';
            this.objdtSeleccionado.style['display'] = 'none';
            objdt.style['display'] = 'block';
        }
        else
        {
            this.ItemsMenu[this.intItemSel].className = 'seleccionado';
            this.objdtSeleccionado.style['display'] = 'block';
        }
    }
    MenuPrincipal.prototype.MouseOutdl = function(objdl, objdt, posobj)
    {
        if(this.intItemSel != posobj)
        {
            objdl.className = '';
            objdt.style['display'] = 'none';
            Temporizador = setTimeout(this.NombreVariable + '.fnFinTemporizador()', 500);
        }
    }
    MenuPrincipal.prototype.MouseOverli = function(objli)
    {
        if(objli.className != 'seleccionado')
        {
            objli.className='activo';
        }
    }
    MenuPrincipal.prototype.MouseOutli = function(objli)
    {
        if(objli.className != 'seleccionado')
        {
            objli.className = 'noactivo';
        }
    }
    MenuPrincipal.prototype.fnFinTemporizador = function()
    {
        clearTimeout(Temporizador);
        this.ItemsMenu[this.intItemSel].className = 'seleccionado';
        this.objdtSeleccionado.style['display'] = 'block';
    }
    return{MenuPrincipal:MenuPrincipal}
}();
/*****************************FIN METODOS DE MENU PRINCIPAL*********************************************/

/*****************************METODOS DE ENCUESTA*********************************************/

function RegistrarVotoEncuesta(idContEncuesta, CodEncuesta)
{
    var i;
    //CAPTURA CONTENEDOR DE LA ENCUESTA
    var objContEncuesta = document.getElementById(idContEncuesta);
    if(objContEncuesta != null && !isNaN(CodEncuesta))
    {
        //VERIFICA LA SELECCION DE UNA OPCION DE ENCUESTA
        var objVoto = objContEncuesta.getElementsByTagName('input');
        var codOpcionSel = -1;
        for(i = 0; i < objVoto.length; i++)
        {
            if(objVoto[i].name == 'OpcionVoto' && objVoto[i].checked == true)
            {
                codOpcionSel = objVoto[i].value;
                break;
            }
        }
        if(codOpcionSel != -1)
        {
            RealizaPostBackAsincronico('include/ModuloEncuesta.asp', 'POST', 'FinCallBackEncuesta(\''+ idContEncuesta + '\')', 1, 'RegVoto=1&CodEncuesta=' + CodEncuesta + '&CodOpcion=' + codOpcionSel);
        }
        else
        {
            alert('Por favor seleccione una opcion.');
        }
    }
}
function FinCallBackEncuesta(idContEncuesta)  
{
    var objContEncuesta = document.getElementById(idContEncuesta);
    if(objContEncuesta != null)
    {
        if(navigator.appName == "Microsoft Internet Explorer")
        {
            objContEncuesta.outerHTML = '<div id="' + idContEncuesta + '">' + objRespuestaPostback + '</div>';
        }
        else
        {
            objContEncuesta.innerHTML = objRespuestaPostback;
        }            
    }
}

/*****************************FIN METODOS DE ENCUESTA*********************************************/

/*****************************METODOS DE SLIDER HORIZONTAL VERTICAL*********************************************/
function AjustaTamanoSlaider(idulContenedor)
{
    var objulContenedor = document.getElementById(idulContenedor);

    if(objulContenedor != null)
    {
        var lstli = objulContenedor.getElementsByTagName('li');
        var i,altotammax = 0;
        
        for(i = 0; i < lstli.length; i++)
        {
           if(navigator.appName == "Microsoft Internet Explorer")
           {    
           	 // alert(lstli[i].offsetHeight);
           	 // alert(altotammax);
                if(lstli[i].offsetHeight > altotammax)
                    altotammax = lstli[i].offsetHeight + 25;
           }
           else 
           {
                if(lstli[i].clientHeight > altotammax)
                    altotammax = lstli[i].clientHeight + 25;
           }
        }
        
        objulContenedor.style['height'] = altotammax -10 + 'px';
        lstli[lstli.length - 1].style['height'] = altotammax  + 'px';
    }
}
/*****************************FIN METODOS DE SLIDER HORIZONTAL VERTICAL*********************************************/
/*******************************FUNCIONES DE REPRODUCCION DE VIDEO*********************************/
function IntroducirReproductorVideo(idDivReproductor, UrlVideo, extencionVideo, ancho, alto)
{
    var objDivContenedor = document.getElementById(idDivReproductor);
    var ContenidoDiv = "";
    
    if(objDivContenedor != null)
    {
        if(UrlVideo.length > 0 && extencionVideo.length > 0 && !isNaN(ancho) && !isNaN(alto))
        {
            if(extencionVideo == 'flv' || extencionVideo == 'swf')
            {
                var s1 = new SWFObject("flash/mediaplayer.swf","mediaplayer",ancho,alto,7);
                s1.addParam("allowfullscreen","true");
                s1.addParam("wmode","transparent");                
                s1.addVariable("width",ancho);
                s1.addVariable("height",alto);
                s1.addVariable("file",UrlVideo);  
                s1.addVariable("autostart","true");              
                s1.write(idDivReproductor);
            }
            else if(extencionVideo == 'wmv' || extencionVideo == 'avi' || extencionVideo == 'mpg' || extencionVideo == 'mpeg')
            {
                var TipoObjeto, Plugin, CodeBase;
                if(extencionVideo == 'mpg' || extencionVideo == 'mpeg')
                {
                    TipoObjeto = "application/x-mplayer2";
                    Plugin = "";
                    CodeBase = "";
                }
                else
                {
                    TipoObjeto = "application/x-mplayer2";
                    Plugin = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0";
                    CodeBase = "http://www.microsoft.com/Windows/MediaPlayer/";
                }
                ContenidoDiv = '<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="' + ancho + 'px" height="' + alto + 'px" codebase="' + CodeBase + '"> ' +
                               '    <param name="Filename" value="' + UrlVideo + '"/> ' +
                               '    <param name="AutoStart" value="true"> ' +
                               '    <param name="ShowControls" value="true"> ' +
                               '    <param name="BufferingTime" value="2"> ' +
                               '    <param name="ShowStatusBar" value="false"> ' +
                               '    <param name="AutoSize" value="true"> ' +
                               '    <param name="InvokeURLs" value="false"> ' +
                               '    <param name="width" value="' + ancho + '"> ' +
                               '    <param name="height" value="' + alto + '"> ' +
                               '    <embed src="' + UrlVideo + '" type="' + TipoObjeto + '" autostart="1" enabled="1" showstatusbar="0" showdisplay="0" showcontrols="1" pluginspage="' + CodeBase + '" CODEBASE="' + Plugin + '" width="' + ancho + 'px" height="' + alto + 'px"></embed> ' +
                               '</object> ' 
            }
            else
            {
                ContenidoDiv = '<img alt="" src="g/img_videos_default.gif" style="height: 269; width: 326" />';
            }
        }
        else
        {
            ContenidoDiv = '<img alt="" src="g/img_videos_default.gif" style="height: 269px; width: 326px;" />';
        }
        //VERIFICA SI DEBE INCLUIR CONTENIDO EN EL DIV
        if(ContenidoDiv.length > 0)
        {
            if(navigator.appName == "Microsoft Internet Explorer")
            {
                var contenidodivaux = '<div id="' + idDivReproductor + '" class="cntr_controlvideo" style="width:' + ancho +'px;height:' + alto + 'px;">' + ContenidoDiv + '</div> ';
                objDivContenedor.outerHTML = contenidodivaux;
            }
            else
            {
                objDivContenedor.innerHTML = ContenidoDiv;
            }
        }
    }
    else
    {
        alert('Error cargando video');
    }
}
/*******************************FIN FUNCIONES DE REPRODUCCION DE VIDEO****************************/

/*------------------------------------------------------------
	Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
	Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
	Web Site: http://txkang.com
	Script featured on Dynamic Drive (http://www.dynamicdrive.com)
	
	Please retain this copyright notice in the script.
	License is granted to user to reuse this code on 
	their own website if, and only if, 
	this entire copyright notice is included.
--------------------------------------------------------------*/
 
//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');
 
//Specify spectrum of different font sizes:
var szs = new Array( '9px','12px','18px' );
var startSz = 1;
 
function textsizer( trgt,inc ) {
	
	if (!document.getElementById) return
	var d = document;
	var cEl = null;
	var sz = startSz;
	var i,j,cTags;
	
	sz += inc;
 
	if ( inc < 0 ) sz = 0;
	if ( inc == 0 ) sz = 1;
	if ( inc > 0 ) sz = 2;
	
	startSz = sz;
	
	if (!(cEl = d.getElementById(trgt))) 
	{	
		cEl = d.getElementsByTagName(trgt)[0];
	}
	
	cEl.style.fontSize = szs[ sz ];
 
	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}


function CambiarEstiloColumnaDerecha(idobj)
{
	
  var objDiv = document.getElementById(idobj);
	if (objDiv == null)
	{
		return;
	}
  objDiv.id = 'cntr_column_left1';
  //objDiv.className = 'cntr_column_left1';
				
}

function fnMenu1(objFuente,objDivAfectado) 
        {
        	
        	 var ObjDiv = document.getElementById(objDivAfectado);
           var AtributoSRC = document.getElementById(objFuente);
           var visible = (ObjDiv.style.display!="none");
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                AtributoSRC.className = 'btn_mas_colapsable';
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                AtributoSRC.className = 'btn_menos_colapsable';
            }
        }
        
function MostrarLayer(UrlAbrir,AnchoVentana,AltoVentana)
{
    var iframeMostrar;
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA IFRAME A MOSTRAR
    iframeMostrar = document.getElementById('imgCapa');
    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner2');
    if(iframeMostrar != null && divImagenBig != null && divImagenBigInner != null)
    {
        //CAPTURA DISTANCIA Y DE LA VENTANA
        var dsoctop = document.all? iecompattest().scrollTop : pageYOffset

        //ASIGNA PROPIEDADES AL IFRAME    
       // iframeMostrar.style.width = AnchoVentana + 'px';
       // iframeMostrar.style.height = AltoVentana + 'px';
       // iframeMostrar.style.backgroundColor="red";
		//alert("Abrir documento en iFrame");
       // iframeMostrar.src = UrlAbrir;
       	//iframeMostrar.onload = alert(iframeMostrar.contentWindow.document.body.clientHeight);alert(iframeMostrar.contentWindow.document.body.offsetHeight);

        //ASIGNA PROPIEDADES A DIV DE EFECTOS
        divImagenBig.style.visibility = "";
        divImagenBig.style.display='block';
        divImagenBig.style.height = (window.document.body.scrollHeight) + 'px';
		//alert("ok");
        divImagenBig.style.overflow = 'auto';

        divImagenBigInner.style.visibility = "";
	    divImagenBigInner.style.display='block';

	    //ASIGNA POSICION DEL IFRAME
	    divImagenBigInner.style.left = ((document.body.clientWidth/2) - (AnchoVentana/2))+'px';	    
	    divImagenBigInner.style.top = (dsoctop + 50) + 'px';
    }
}      
function OcultarLayer()
{
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner2');

	iframeMostrar = document.getElementById('imgCapa');
    if(divImagenBig != null && divImagenBigInner != null)
    {
        divImagenBig.style.display = 'none';
	    divImagenBigInner.style.display = 'none';
		iframeMostrar.src = 'about:blank';
    }
}  

function fnMenuBib(objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
            var AtributoSRC = objFuente.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                //CAMBIA IMAGEN
               // objFuente.setAttribute((document.all ? 'className' : 'class'), AtributoSRC.replace('btn_coll_biblioteca_active','btn_coll_biblioteca'));
			   objFuente.className='btn_coll_biblioteca'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                //CAMBIA IMAGEN
                //objFuente.setAttribute((document.all ? 'className' : 'class'), AtributoSRC.replace('btn_coll_biblioteca','btn_coll_biblioteca_active'));
				 objFuente.className='btn_coll_biblioteca_active'
            }
        }
        
function fnMenuCal(objFuente,objDivAfectado) 
        {
        	var ObjDiv = document.getElementById(objDivAfectado);
            var AtributoSRC = objFuente.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                //CAMBIA IMAGEN
                //objFuente.setAttribute((document.all ? 'className' : 'class'), AtributoSRC.replace('btn_coll_calendario_active','btn_coll_calendario'));
				objFuente.className='btn_coll_calendario'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                //CAMBIA IMAGEN
                //objFuente.setAttribute((document.all ? 'className' : 'class'), AtributoSRC.replace('btn_coll_calendario','btn_coll_calendario_active'));
				objFuente.className='btn_coll_calendario_active'
            }
        }
        
function fnPortafolioCom(ObjDivFondo,objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
        	  var ObjHRef = document.getElementById(objFuente);
            var AtributoSRC = ObjHRef.getAttribute((document.all ? 'className' : 'class'));
            var AtributoSRCDiv = ObjDivFondo.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                ObjHRef.className='btn_coll01'
                ObjDivFondo.className='opc_collap'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                ObjHRef.className='btn_coll02'
                ObjDivFondo.className='opc_collap2'
            }
        }
 
function fnPortafolioEnergia(ObjDivFondo,objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
        	  var ObjHRef = document.getElementById(objFuente);
            var AtributoSRC = ObjHRef.getAttribute((document.all ? 'className' : 'class'));
            var AtributoSRCDiv = ObjDivFondo.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                ObjHRef.className='btn_coll01'
                ObjDivFondo.className='opc_collap'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                ObjHRef.className='btn_coll02'
                ObjDivFondo.className='opc_collap2'
            }
        }
        
function fnPortafolioAhorrar(ObjDivFondo,objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
        	  var ObjHRef = document.getElementById(objFuente);
            var AtributoSRC = ObjHRef.getAttribute((document.all ? 'className' : 'class'));
            var AtributoSRCDiv = ObjDivFondo.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                ObjHRef.className='btn_coll01'
                ObjDivFondo.className='opc_collap'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                ObjHRef.className='btn_coll02'
                ObjDivFondo.className='opc_collap2'
            }
        }
        
function fnPortafolioMant(objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
            var AtributoSRC = objFuente.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                objFuente.className='btn_coll_biblioteca'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                objFuente.className='btn_coll_biblioteca_active'
            }
        }
        
function fnPortafolioRedes(ObjDivFondo,objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
        	  var ObjHRef = document.getElementById(objFuente);
            var AtributoSRC = ObjHRef.getAttribute((document.all ? 'className' : 'class'));
            var AtributoSRCDiv = ObjDivFondo.getAttribute((document.all ? 'className' : 'class'));
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                ObjHRef.className='btn_coll01'
                ObjDivFondo.className='opc_collap'
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                ObjHRef.className='btn_coll02'
                ObjDivFondo.className='opc_collap2'
            }
        }
        
/*Se agregan funciones para eliminacion de espacios al inicio y fin de un acadena*/        
function trim(stringToTrim) 
{
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
    return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
    return stringToTrim.replace(/\s+$/,"");
}        
