﻿
/***********************************************************************************************
                        TAMAÑOS DE LOS DIVS Y DE LOS IFRAMES 
/***********************************************************************************************/
//////////////////////////////////////MASTER.LOGIN///////////////////////////////////////////////
var width_OlvidarPwdDiv     = '466';
var height_OlvidarPwdDiv    = '278';
var width_OlvidarPwdIFrame  = '466';
var height_OlvidarPwdIFrame = '278';

var width_GenerarPwdDiv     = '457';
var height_GenerarPwdDiv    = '268';
var width_GenerarPwdIFrame  = '457';
var height_GenerarPwdIFrame = '268';

var width_VentanaAyudaDiv     = '340';
var height_VentanaAyudaDiv    = '303';
var width_VentanaAyudaIFrame  = '340';
var height_VentanaAyudaIFrame = '303';

var width_AmailDiv     = '457';
var height_AmailDiv    = '273';
var width_AmailIFrame  = '457';
var height_AmailIFrame = '273';
//////////////////////////////////////USUA_DATO///////////////////////////////////////////////

var width_CambiarPwdDiv     = '466';
var height_CambiarPwdDiv    = '278';
var width_CambiarPwdIFrame  = '466';
var height_CambiarPwdIFrame = '278';

var width_Ayuda  = '483';
var height_Ayuda = '352';
var width_Ayuda  = '483';
var height_Ayuda = '352';
/////////////////////////////////////USUA_DICL////////////////////////////////////////////////
var width_EdicionClienteDiv   = '464';
var height_EdicionClienteDiv  = '278';
var width_EdicionClienteIFrame  = '464';
var height_EdicionClienteIFrame = '278';

///////////////////////////////////////CONTACTANOS/////////////////////////////////////////////

var width_ContactanosDiv   = '427';
var height_ContactanosDiv  = '382';
var width_ContactanosIFrame  = '427';
var height_ContactanosIFrame = '382';


////////////////////////////////////////////////////////////////////////////////////////////////
var UICLIENT;
var UIUSUARIO;
var ROLUSUARIO;
var SEPARADOR = "#";
var HEIGTHCONSULTORA = "100px";  //110/125px
var HEIGTHDUPLA = "210px";       //210/212px
var ROLCONSULTORA = "01";
var ROLDUPLA = "02";
/////////////////////////////////////USUA_ENCL_SELECT//////////////////////////////////////////


var width_SeleccionarClienteDIV     = '605';
var height_SeleccionarClienteDIV    = '800';
var width_SeleccionarClienteIFrame  = '605';
var height_SeleccionarClienteIFrame = '800';

var width_SeleccionarClienteBolsaDIV     = '605';
var height_SeleccionarClienteBolsaDIV    = '779';
var width_SeleccionarClienteBolsaIFrame  = '605';
var height_SeleccionarClienteBolsaIFrame = '779';

///////////////////////////////////////MASTER_CONTENIDO////////////////////////////////////////

var width_AyudaContenidoDiv     = '352';
var height_AyudaContenidoDiv    = '700';
var width_AyudaContenidoIFrame  = '352';
var height_AyudaContenidoIFrame = '700';

///////////////////////////////////////MASTER_CONTENIDO////////////////////////////////////////

var width_AyudaPopUpDiv     = '352';
var height_AyudaPopUpDiv    = '520';
var width_AyudaPopUpIFrame  = '352';
var height_AyudaPopUpIFrame = '520';

////////////////////////////////// MOSTRAR DATOS CONSULTORA ////////////////////////////////////
var widthDiv  = '427';
var heightDiv = '382';

var widthIframe  = '427';
var heightIframe = '390';
////////////////////////////////// VENTANAS DE AYUDA PEQUEÑAS //////////////////////////////////
var offsetx = 5;
var offsety = 5;
var width_Ayudita     = 352;
var height_Ayudita    = 520;
var width_Ayudita  = 352;
var height_Ayudita = 520;
var ventana;
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
////////////////////////////////// VENTANAS DE AYUDA PEQUEÑAS //////////////////////////////////
var width_FAQDiv     = '413';
var height_FAQDiv_l    = '800';
var width_FAQIFrame  = '413';
var height_FAQIFrame_l = '800';

var height_FAQIFrame_m = '544';
var height_FAQDiv_m    = '544';
////////////////////////////////// VENTANAS DE TIPS/////////////////////////////////////////////
var width_TipsDiv     = '525';
var height_TipsDiv    = '837';
var width_TipsIFrame  = '525';
var height_TipsIFrame = '837';
////////////////////////////////// CONTADOR CARACTERES //////////////////////////////////
var cantMaxCaracteresEnvio = 50;
////////////////////////////////// PREGUNTAS FRECUENTES ////////////////////////////////////////

var heightFAQ = '386';
var widthFAQ  = '593';
/***********************************************************************************************/



function CloseWindows(idWindow)
{
    var oWin=document.getElementById(idWindow);  
    if(oWin!= null)
    { 
        oWin.style.display='none';
    }
    else
    {
        alert("no existe ventana");
    }
    return false;
}

function ShowWindows(idWindow, x, y)
{
    var ventanaActual=document.getElementById(idWindow);
    if(ventanaActual!=null)
    {	     
        ventanaActual.style.left = x;
        ventanaActual.style.top  = y;
        ventanaActual.style.height = height_AyudaPopUpDiv + 'px';
        ventanaActual.style.width= width_AyudaPopUpDiv + 'px';
	    ventanaActual.style.display='';
        ventanaActual.style.visibility='visible';
    }
    else
    {
        alert ("no existe ventana a mostrar");
    }
    return false;
}


/*************************************************************************************/
/*                                 CY_CABECERA_MASTER                                */
/*************************************************************************************/

    function showPanels()
    {
	    if(document.getElementById("ctl00_Panel1")!=null)
	    {
		    document.getElementById("ctl00_Panel1").style.display='' ;
	        document.getElementById("ctl00_Panel1").style.visibility='' ;
	    }
    	
	    if(document.getElementById("ctl00_Panel1en")!=null)
	    {
	        document.getElementById("ctl00_Panel1en").style.display='' ;
	        document.getElementById("ctl00_Panel1en").style.visibility='' ;
	    }
    	
        if(document.getElementById("ctl00_Panel2")!=null)
	    {
	        document.getElementById("ctl00_Panel2").style.display='' ;
	        document.getElementById("ctl00_Panel2").style.visibility='' ;
	    }
    	
        if(document.getElementById("ctl00_Panel2en")!=null )
	    {
	        document.getElementById("ctl00_Panel2en").style.display='' ;
	        document.getElementById("ctl00_Panel2en").style.visibility='' ;
	    }
    	
        if(document.getElementById("ctl00_Panel3")!=null)
	    {
	        document.getElementById("ctl00_Panel3").style.display='' ;
	        document.getElementById("ctl00_Panel3").style.visibility='' ;
	    }
    	
        if(document.getElementById("ctl00_Panel3en")!=null)
	    {
	        document.getElementById("ctl00_Panel3en").style.display='' ;
	        document.getElementById("ctl00_Panel3en").style.visibility='' ;
	    }
    	
        function LaunchPageData()
	    {   
	        window.parent.frames[1].window.location='usua_dato.aspx';
	    }
    	   
	    function LaunchPageDirectory()
	    {   
		    window.parent.frames[1].window.location='usua_dicl.aspx';
	            //showPanels();
	    }
    	
        function LaunchPageSending()
	    {
	        window.parent.frames[1].window.location='usua_encl_Catalogo.aspx';
            
	    }
    }
    
    function cargarPaginaMenu(pagina)
    {   
        var rolUsuario = document.getElementById('ctl00_hiddenTipoUsuario').value;
        switch (pagina)
        {
            case "datos":
                window.parent.frames[1].window.location='usua_dato.aspx';
                break;

            case "directorio":
                window.parent.frames[1].window.location='usua_dicl.aspx';
                break;

            case "enviar":
                window.parent.frames[1].window.location='usua_encl_Catalogo.aspx';
                break;

            case "catalogo":
                window.parent.frames[1].window.location='root_cliente.aspx?pag=OF';
                break;

            case "pedidos":
                
                if (rolUsuario=='01')
                   window.parent.frames[1].window.location='usua_bols_pedi_con.aspx';
                if (rolUsuario=='02')
                    window.parent.frames[1].window.location='usua_bols_pedi_dup.aspx';
                if (rolUsuario=='03' || rolUsuario == '04')
                    window.parent.frames[1].window.location='usua_bols_pedi_clie.aspx';
                break;
            case "inicio":
                window.parent.frames[1].window.location='root_cliente.aspx?pag=OF';
            case "historial":
                switch (rolUsuario)
                {
                    case "01": // consultora
                        window.parent.frames[1].window.location='usua_hist_pedi_cons.aspx';
                        break;
                    case "02": // dupla
                        window.parent.frames[1].window.location='usua_hist_pedi_dupl.aspx';
                        break;
                    default: // cliente o amiga
                        window.parent.frames[1].window.location='usua_hist_pedi_clie.aspx';
                        break;
                }
                break;
                
            case "faq":
                window.parent.frames[1].window.location='usua_preg_frec.aspx';
                break;
            
        }
	}
	

/*************************************************************************************/
/*                                 CY_CONTENIDO_MASTER                               */
/*************************************************************************************/
	function irCatalogo(rol)
    {   
	    if(document.images && rol!=null)
	    {
	        var imagenesOff = new Object();
	        switch(rol)
	        {
	            case '01':
		            imagenesOff["imgDatos"] 		= new Image();
		            imagenesOff["imgDirectorio"] 	= new Image();
		            imagenesOff["imgEnvio"] 		= new Image();
		            imagenesOff["imgBolsa"] 		= new Image();
		            imagenesOff["imgCatalogo"] 		= new Image();
            		
		            imagenesOff["imgDatos"].src		= "App_Themes/CY_es/images/cabecera/btn_dato_cons_off.gif";
		            imagenesOff["imgDirectorio"].src= "App_Themes/CY_es/images/cabecera/btn_dicl_cons_off.gif";
		            imagenesOff["imgEnvio"].src 	= "App_Themes/CY_es/images/cabecera/btn_encl_cons_off.gif";
		            imagenesOff["imgBolsa"].src 	= "App_Themes/CY_es/images/cabecera/btn_bols_cons_off.gif";
		            imagenesOff["imgCatalogo"].src	= "App_Themes/CY_es/images/cabecera/btn_cata_cons_off.gif";

		            window.parent.frames[0].document.getElementById('ctl00_imgPaso1').src	= imagenesOff["imgDatos"].src;
		            window.parent.frames[0].document.getElementById('ctl00_imgPaso2').src = imagenesOff["imgDirectorio"].src;
		            window.parent.frames[0].document.getElementById('ctl00_imgPaso3').src 	 = imagenesOff["imgEnvio"].src;
		            window.parent.frames[0].document.getElementById('ctl00_btnBolsPedi').src 	 = imagenesOff["imgBolsa"].src;
		            window.parent.frames[0].document.getElementById('ctl00_btnVerCatalogo').src	 = imagenesOff["imgCatalogo"].src;
		            break;
		            
                case '02':
                    
   		            imagenesOff["imgDatos"] 		= new Image();
		            imagenesOff["imgDirectorio"] 	= new Image();
		            imagenesOff["imgEnvio"] 		= new Image();
		            imagenesOff["imgBolsa"] 		= new Image();
		            imagenesOff["imgCatalogo"] 		= new Image();
            		
		            imagenesOff["imgDatos"].src		= "App_Themes/CY_es/images/cabecera/btn_dato_dupla_off.gif";
		            imagenesOff["imgDirectorio"].src= "App_Themes/CY_es/images/cabecera/btn_dicl_dupla_off.gif";
		            imagenesOff["imgEnvio"].src 	= "App_Themes/CY_es/images/cabecera/btn_encl_dupla_off.gif";
		            imagenesOff["imgBolsa"].src 	= "App_Themes/CY_es/images/cabecera/btn_bols_dupla_off.gif";
		            imagenesOff["imgCatalogo"].src	= "App_Themes/CY_es/images/cabecera/btn_cata_dupla_off.gif";

		            window.parent.frames[0].document.getElementById('ctl00_imgPaso1').src	= imagenesOff["imgDatos"].src;
		            window.parent.frames[0].document.getElementById('ctl00_imgPaso2').src = imagenesOff["imgDirectorio"].src;
		            window.parent.frames[0].document.getElementById('ctl00_imgPaso3').src 	 = imagenesOff["imgEnvio"].src;
		            window.parent.frames[0].document.getElementById('ctl00_btnBolsPedi').src 	 = imagenesOff["imgBolsa"].src;
		            window.parent.frames[0].document.getElementById('ctl00_btnVerCatalogo').src	 = imagenesOff["imgCatalogo"].src;
		            break;
	        }
		    location.href ='root_cliente.aspx?pag=OF';
		    return true;
	    }
    }
    
/*************************************************************************************/
/*                                 CY_INGRESO_MASTER                                 */
/*************************************************************************************/
    function MenuPage(pagina)
	{ 
	    location.href=pagina;
	}

/*************************************************************************************/
/*                                 CY_LOGIN_MASTER                                   */
/*************************************************************************************/

function divLoginMaster(nombreDiv, nombreIFrame)
{
    var objDiv = document.getElementById(nombreDiv);
    var objIfr = document.getElementById(nombreIFrame);
    var objt = document.getElementById('ctl00_txtCodigo');    
    
    if(objDiv != null && objIfr != null)
    {
        switch(nombreDiv)
        {
            case "VentanaOlvidarPwd":
                    if(objt.value.length > 0)
                        objIfr.src = "usua_opass.aspx?codigo=" + objt.value;
                    else
                        objIfr.src = "usua_opass.aspx";
                    break;
                    
            case "VentanaGenerarPwd":
                    
                    if(objt.value.length > 0)
                        objIfr.src = "usua_gpass_dupla.aspx?codigo=" + reemplazarCadena(objt.value);
                    else
                        objIfr.src = "usua_opass.aspx";
                    break;

            case "VentanaAmail":
                    var wndDiv = document.getElementById('IFrameAmail');
                    wndDiv.src = "usua_amail_dupla.aspx";
                    break;
        }
    }
}

	function LaunchAlertaDupla(paginaFullPath)
	{
	    var consultora=document.getElementById("ctl00_txtCodigo").value; 
	    var wnd = window.open(paginaFullPath + "?codigo=" + consultora + "&p1=" + getQueryVariable('p1'), "Alerta","width=455, height=268, resizable: No; status: No");
	    wnd.moveTo(0,0);
    }
	
	function LaunchAlerta(paginaFullPath)
    {   
        var codigo=document.getElementById("ctl00_txtCodigo").value;        
        var wnd = window.open(paginaFullPath + "?codigo=" + codigo + "&p1=" + getQueryVariable('p1'), "Alerta","width=464, height=277, resizable: No; status: No");
        wnd.moveTo(0,0);
    }

	function getQueryVariable(variable)
    {
        alert(variable);
        var query = window.location.search.substring(1);
        var vars = query.split("&");
		for (var i=0;i<vars.length;i++)
        {
			var pair = vars[i].split("=");
            if (pair[0] == variable)
            {
				return pair[1];
			}
        }
    }
        
    function showWindow(nombreDiv, nombreIFrame)
    {
		var ventana = document.getElementById('ctl00_'+nombreDiv);
        var iFrame  = document.getElementById(nombreIFrame);
        var objt = document.getElementById('ctl00_txtCodigo');
        var valorCodigo;
        var isFaq  = 0;
        var xWnd2  = 0;
        var yWnd2  = 0;
        var xLocal = 0;
        var yLocal = 0;

        if(ventana!=null && iFrame !=null)
        {
            /********************************************************************/
            if(objt != null && objt.value.length > 0)
            {
                valorCodigo = objt.value; //reemplazarCadena(objt.value);
                valorCodigo = reemplazarCadena(valorCodigo);
            }
            //alert(objt.value);                
           
            switch(nombreDiv.toLowerCase())
            {
                case 'ventanaolvidarpwd':
                    if(objt.value.length > 0)
                        iFrame.src = "usua_opass.aspx?codigo=" + valorCodigo; //objt.value;
                    else
                        iFrame.src = "usua_opass.aspx"
                    
                    ventana.style.width  = width_OlvidarPwdDiv + 'px';
                    ventana.style.height = height_OlvidarPwdDiv + 'px';
                    iFrame.style.width   = width_OlvidarPwdIFrame + 'px';
                    iFrame.style.height  = height_OlvidarPwdIFrame + 'px';
                    xWnd2 = width_OlvidarPwdDiv;
                    yWnd2 = height_OlvidarPwdDiv;
                    break;
                    
                case 'ventanagenerarpwd':
                    if(objt.value.length > 0)
                        iFrame.src = "usua_gpass_dupla.aspx?codigo=" + valorCodigo;// objt.value;
                    else
                        iFrame.src = "usua_gpass_dupla.aspx";
                    
                    ventana.style.width  = width_GenerarPwdDiv + 'px';
                    ventana.style.height = height_GenerarPwdDiv + 'px';
                    iFrame.style.width   = width_GenerarPwdIFrame + 'px';
                    iFrame.style.height  = height_GenerarPwdIFrame + 'px';
                    xWnd2 = width_GenerarPwdDiv;
                    yWnd2 = height_GenerarPwdDiv;
                    break;
                    
                case 'ventanaayuda':
                    iFrame.src = "usua_ayuda_login.aspx";
                    ventana.style.width  = width_VentanaAyudaDiv + 'px';
                    ventana.style.height = height_VentanaAyudaDiv + 'px';
                    iFrame.style.width   = width_VentanaAyudaIFrame + 'px';
                    iFrame.style.height  = height_VentanaAyudaIFrame + 'px';
                    xWnd2 = width_VentanaAyudaDiv;
                    yWnd2 = height_VentanaAyudaDiv;
                    break;
                    
                case 'ventanaamail':
                    ventana.style.width  = width_AmailDiv + 'px';
                    ventana.style.height = height_AmailIFrame + 'px';
                    iFrame.style.width   = width_AmailDiv + 'px';
                    iFrame.style.height  = height_AmailIFrame + 'px';
                    xWnd2 = width_AmailDiv;
                    yWnd2 = height_AmailIFrame;
                    iFrame.src = "usua_amail_dupla.aspx";
                    break;

                case 'MiConsultora':
                    iFrame.src = "usua_dato_cons.aspx";
                    break
                   
                    
                case 'helpmailwindow':
                    iFrame.src = wndDiv.src = "usua_preg_frec_dato.aspx";
                    ventana.style.width  = width_ContactanosDiv + 'px';
                    ventana.style.height = height_ContactanosDiv + 'px';
                    iFrame.style.width   = width_ContactanosIFrame + 'px';
                    iFrame.style.height  = height_ContactanosIFrame + 'px';
                    iFrame.src = "usua_mail_help.aspx";

                    break;
            }
            
            ventana.style.display='';
            ventana.style.visibility='visible';
            xLocal = parseFloat(screen.width)/2 - parseFloat(xWnd2)/2;
            yLocal = parseFloat(screen.height)/2 - parseFloat(yWnd2)/2;
            ventana.style.left = xLocal+'px';
            ventana.style.top = yLocal+'px';
            return false;
        } 
        else
        {
			alert("no hay ventanaaaa");
        }
    }
    
	function changeImagen()
	{
		var tabla=document.getElementById("TablaPrincipal"); 
	    if(tabla!=null)
	    {
			newImage="App_Themes/CY_es/images/login/fondo_login_dupla.jpg";
			var rol=getQueryVariable('p1').substring(12);
			if(rol=='02')
			{
				tabla.style.backgroundImage="url('"+newImage+"')";
			}
	    }
	}


    function changeImagenLogin()
	{
		var tabla=document.getElementById("TablaPrincipal"); 
	    if(tabla!=null)
	    {
			newImage="App_Themes/CY_es/images/login/fondo_login_dupla.jpg";
			var rol=getQueryVariable('p1').substring(12);
			if(rol=='02')
			{
				//tabla.style.backgroundImage="url('"+newImage+"')";
			}
	    }
	    
	    if(tabla!=null)
	    {
			newImage="App_Themes/CY_es/images/login/fondo_login_cliente_nuevo.jpg";
			var rol=getQueryVariable('p1').substring(12);
			if(rol=='03'|| rol=='04')
			{
				tabla.style.backgroundImage="url('"+newImage+"')";
			}
	    }
	}

/*************************************************************************************/
/*                                 ROOT_FINAL                                        */
/*************************************************************************************/
    function Cerrar()
	{
        window.opener='self';
        window.close();
    }


/*************************************************************************************/
/*                                 ROOT_INICIO                                       */
/*************************************************************************************/
	function getQueryVariable(rol,pagina,nomail)
	{
		if(nomail!='S')
        {
			if (rol!='03')
            { 
                top.moveTo(0,0); 
                top.window.resizeTo(screen.availWidth,screen.availHeight);
                var query = window.location.search;
                location.href=pagina+query; 
            }
            else
            {
				top.window.resizeTo(screen.availWidth,screen.availHeight);
                var query = window.location.search;
                location.href=pagina+query;
            }
        }
        else
        {
			top.moveTo(0,0); 
            top.window.resizeTo(screen.availWidth,screen.availHeight);
			var query = window.location.search;
			location.href=pagina+query; 
        }
           
    }
    
/*************************************************************************************/
/*                                 ROOT_MOSTRAR                                      */
/*************************************************************************************/
    function Redirect()
    {
        parent.parent.location.href ='root_sess.aspx';
    }
    

/*************************************************************************************/
/*                                 ROOT_TERM                                         */
/*************************************************************************************/    
    function SessionTimeOut()
    {
        var pagina = window.opener.location.href;
        if (pagina.indexOf('root_ingr.aspx') > -1)
        {
            document.location.href = 'root_sess.aspx';
        }
        else
        {
            document.location.href = 'root_sess.aspx';
        }
    }


/*************************************************************************************/
/*                                 USUA_AYUDA_DATOS                                  */
/*************************************************************************************/ 

	function ShowHelp()
	{   
		var rol=document.getElementById("hydValorRol").value ;
		var oWin=parent.document.getElementById("ctl00_VentanaAyuda");   
		if((oWin!= null)&&(oWin.style.display!='none'))
		{
			oWin.style.display='';
            oWin.style.visibility='';
        }       
	         	   
		if(rol!=null)
		{
			ventanaActual=document.getElementById("Help_"+rol);
	    }
	     
		if(ventanaActual!=null)
		{
			ventanaActual.style.display='';
			ventanaActual.style.visibility='visible';
		}
	    return false;
	}
	
	
	function ShowSOSHelp()
    {   
	        var rol=document.getElementById("hydValorRol").value ;
	        var oWin=parent.document.getElementById("ctl00_VentanaAyuda");   
            if((oWin!= null)&&(oWin.style.display!='none'))
            {
                oWin.style.display='';
                oWin.style.visibility='';
            }       
	         	   
	        if(rol!=null)
	        {   
	            ventanaActual=document.getElementById("Help_"+rol);
	        }
	     
	        if(ventanaActual!=null)
	        {
	            ventanaActual.style.display='';
	            ventanaActual.style.visibility='visible';
		    }
	        return false;
   }
	
	    
	function CloseWindowHelp()
	{
       var rol=document.getElementById("hydValorRol").value;
	        if(rol!=null)
	        {
	            oDiv=document.getElementById("Help_"+rol);
	        }
	        else
	        {
	            oDiv=document.getElementById("Help_0");
	        }
            if(oDiv.style.display != 'none') 
            {  
                var oWin=parent.document.getElementById("VentanaAyuda");  
                if(oWin!= null)
                { 
                    oWin.style.display='none';
                }
                else
                {
                    alert("no existe ventana");
                }
            }   
            return false;
    }
    
/*************************************************************************************/
/*                                 USUA_AYUDA_DATOS                                  */
/*************************************************************************************/ 
    
    function ShowHelp()
    {   
		var rol=document.getElementById("hydValorRol").value ;
		var oWin=parent.document.getElementById("ctl00_VentanaAyuda");   
		if((oWin!= null)&&(oWin.style.display!='none'))
		{
			oWin.style.display='';
			oWin.style.visibility='';
		}       
	     	 
		if(rol!=null)
		{
			ventanaActual=document.getElementById("Help_"+rol);
		}
				
		if(ventanaActual!=null)
		{
			ventanaActual.style.display='';
	        ventanaActual.style.visibility='visible';
		}
		
		return false;
	}
			
//	function CloseWindow()
//	{
//		var rol=document.getElementById("hydValorRol").value;
//		if(rol!=null)
//		{
//			oDiv=document.getElementById("Help_"+rol);
//		}
//		else
//		{
//			oDiv=document.getElementById("Help_0");
//		}
//	  
//		if(oDiv.style.display != 'none') 
//        {  
//			var oWin=parent.document.getElementById("VentanaAyuda");  
//			if(oWin!= null)
//			{ 
//				oWin.style.display='none';
//            }
//			
//			else
//			{
//				alert("no existe ventana");
//            }
//		}   
//		return false;           
//	}
	
/*************************************************************************************/
/*                                 USUA_AYUDA_DIRECTORIO                             */
/*************************************************************************************/ 

function ShowHelp()
    {   
		var rol=document.getElementById("hydValorRol").value ;
		var oWin=parent.document.getElementById("ctl00_VentanaAyuda");   
		if((oWin!= null)&&(oWin.style.display!='none'))
		{
			oWin.style.display='';
			oWin.style.visibility='';
		}       
	     	 
		if(rol!=null)
		{
			ventanaActual=document.getElementById("Help_"+rol);
		}
		
		if(ventanaActual!=null)
		{
			ventanaActual.style.display='';
			ventanaActual.style.visibility='visible';
		}
		return false;
	        
	}
	
    function CloseWindow()
	{
		var rol=document.getElementById("hydValorRol").value;
		if(rol!=null)
		{
			oDiv=document.getElementById("Help_"+rol);
	    }
	    
		else
		{
			oDiv=document.getElementById("Help_0");
		}
	  
		if( oDiv.style.display != 'none') 
		{  
			var oWin=parent.document.getElementById("VentanaAyuda");  
			if(oWin!= null)
			{ 
				oWin.style.display='none';
            }
			else
			{
				alert("no existe ventana");
			}
		}   
		return false;           
	}	
	
/*************************************************************************************/
/*                                 USUA_AYUDA_ENVIO                                  */
/*************************************************************************************/ 
	function ShowHelp()
	{   
		var rol=document.getElementById("hydValorRol").value ;
		var oWin=parent.document.getElementById("ctl00_VentanaAyuda");   
		if((oWin!= null)&&(oWin.style.display!='none'))
		{
			oWin.style.display='';
			oWin.style.visibility='';
		}       
		
		if(rol!=null)
		{
			ventanaActual=document.getElementById("Help_"+rol);
	    }
	     
		if(ventanaActual!=null)
	    {
			ventanaActual.style.display='';
	        ventanaActual.style.visibility='visible';
	    }
	    return false;
	}
	    
//	function CloseWindow()
//	{
//		var rol=document.getElementById("hydValorRol").value;
//		if(rol!=null)
//		{
//			oDiv=document.getElementById("Help_"+rol);
//	    }
//		
//		else
//		{
//			oDiv=document.getElementById("Help_0");
//		}
//		
//		if( oDiv.style.display != 'none') 
//		{  
//			var oWin=parent.document.getElementById("VentanaAyuda");  
//			if(oWin!= null)
//			{ 
//	            oWin.style.display='none';
//            }
//            
//			else
//			{
//				alert("no existe ventana");
//            }
//        }   
//        return false;           
//             
//    }
    
/*************************************************************************************/
/*                                 USUA_AYUDA_LOGIN                                  */
/*************************************************************************************/ 
function Close()
	{ 
		var portalMadre=document.getElementById("hydValorPortal").value;
		if(portalMadre!=null)
		{
			oDiv=document.getElementById("Help_"+portalMadre);
	    }
		else
		{
			oDiv=document.getElementById("Help_0");
	    }
	  
		if(oDiv.style.display != 'none') 
		{  
			var oWin=parent.document.getElementById("ctl00_VentanaAyuda");  
			if(oWin!= null)
			{ 
				oWin.style.display='none';
			}
		}   
		return false;
	}
	    
	function LoadAll()
	{       
		var oWin=parent.document.getElementById("ctl00_VentanaAyuda");  
		if((oWin!= null)&&(oWin.style.display!='none'))
		{
			oWin.style.display='';
			oWin.style.visibility='';
		}       
		
		var portalMadre=document.getElementById("hydValorPortal").value;
		if(portalMadre!=null)
		{
			ventanaActual=document.getElementById("Help_"+portalMadre);
		}
		else
		{
			ventanaActual=document.getElementById("Help_0");
		}
		if(ventanaActual!=null)
		{
			ventanaActual.style.display='';
	        ventanaActual.style.visibility='visible';
	    }
		return false;
	}


/*************************************************************************************/
/*                                   USUA_CPASS                                      */
/*************************************************************************************/ 
	function CloseWindow()
	{
		var ventana=parent.document.getElementById("Ventana"); 
		if(ventana!=null)
		{
			ventana.style.display='none';
			ventana.style.visibility='hidden';
		}
		else
		{
			//alert("no existe");
		}
		return false;
	}
	
/*************************************************************************************/
/*                                   USUA_CPASS_RESU                                 */
/*************************************************************************************/
    function CloseWindowPopUp(Div, Frame, nombreVentana)
    {
        var ventana = parent.document.getElementById(Div); 
        var iFrame  = parent.document.getElementById(Frame); 
        if(ventana!=null && iFrame!=null)
        {
            ventana.style.display = 'none';
            switch(nombreVentana.toLowerCase())
            {
                case 'cambiopassword':
                    iFrame.src = 'usua_cpass.aspx';
                        break;
                case  'MiConsultora':
                    iFrame.src = 'usua_dato_cons.aspx';
                        break;
            }
        }
        return false;
    }
    
/*************************************************************************************/
/*                                   USUA_DATO                                       */
/*************************************************************************************/
	function LaunchHelp(paginaFullPath)
    {
		if(document.getElementById("ctl00_cphContenido_txtSession").value != "|")
		{
			var rol=document.getElementById("ctl00_cphContenido_hydRol").value;
			var wnd2=document.getElementById("FrameAyudaDatos"); 
			var wnd=document.getElementById("VentanaAyuda");
			
			var xLocal = 0;
			var yLocal = 0;
			var xwnd2 = width_Ayuda;
			var ywnd2 = height_Ayuda;
			xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
			yLocal = 0;

			wnd.style.left = xLocal+'px';
			wnd.style.top = yLocal+'px';
			wnd.style.visibility = 'visible';
			wnd.style.display = 'block';
			wnd.style.width   = width_Ayuda + 'px';
			wnd.style.height  = height_Ayuda + 'px';
			wnd2.style.width  = width_Ayuda + 'px';
			wnd2.style.height = height_Ayuda + 'px';
			
			return false;
		}
		return true;
	}
	
	
    function LaunchHelpAndData(paginaFullPath, numeroTelefonoSAC, correoSAC)
    {    
        
		if(document.getElementById("ctl00_cphContenido_txtSession").value != "|")
		{
			var rol=document.getElementById("ctl00_cphContenido_hydRol").value;
			var wnd2=document.getElementById("FrameAyudaDatos"); 
			var wnd=document.getElementById("VentanaAyuda");
			
			var xLocal = 0;
			var yLocal = 0;
			var xwnd2 = wnd2.style.width;
			var ywnd2 = wnd2.style.height;
			xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
			yLocal = 0;//(parseFloat(screen.height)/2 -480) - parseFloat(ywnd2)/2;

			wnd.style.left = xLocal+'px';
			wnd.style.top = yLocal+'px';
			wnd.style.visibility = 'visible';
			wnd.style.display = 'block';
			return false;
		}
		return true;
	}

	function ShowWindow(tipo)
	{
		if(tipo=='S')
		{
			document.getElementById("Ventana").style.display='none';
		}
		else
		{
			document.getElementById("Ventana").style.display='';
		}
	}
            
	function disable(marca)
	{
		document.getElementById("ctl00_cphContenido_txtNombreCompleto_" + marca).disabled = true;
		document.getElementById("ctl00_cphContenido_txtAlias_"+ marca).disabled = true;
		document.getElementById("ctl00_cphContenido_txtTelefonoFijo_"+ marca).disabled = true;
		document.getElementById("ctl00_cphContenido_txtTelefonoMovil_"+ marca).disabled = true;
		document.getElementById("ctl00_cphContenido_txtEmail_"+ marca).disabled = true;
		document.getElementById("ctl00_cphContenido_lblError_" + marca).style.cssText='texto_validacion';
		document.getElementById("ctl00_cphContenido_btnGrabar_"+ marca).style.display='none';
		document.getElementById("ctl00_cphContenido_txtPrefijo").style.display='none';
		//window.parent.frames[0].window.location='root_cabe.aspx';
	}
   
    //--
    function RefrescarCabecera(rol)
    {
        window.parent.frames[0].window.location='root_cabe.aspx';
//    	if(document.images && rol!=null)
//	    {
//	        var imagenesOff = new Object();
//	        //alert(rol);
//	        switch(rol)
//	        {
//	            case '01':
//		            imagenesOff["imgDatos"] 		= new Image();
//		            imagenesOff["imgDirectorio"] 	= new Image();
//		            imagenesOff["imgEnvio"] 		= new Image();
//		            imagenesOff["imgBolsa"] 		= new Image();
//		            imagenesOff["imgCatalogo"] 		= new Image();
//            		
//		            imagenesOff["imgDatos"].src		= "App_Themes/CY_es/images/cabecera/btn_dato_cons_on.gif";
//		            imagenesOff["imgDirectorio"].src= "App_Themes/CY_es/images/cabecera/btn_dicl_cons_off.gif";
//		            imagenesOff["imgEnvio"].src 	= "App_Themes/CY_es/images/cabecera/btn_encl_cons_off.gif";
//		            imagenesOff["imgBolsa"].src 	= "App_Themes/CY_es/images/cabecera/btn_bols_cons_off.gif";
//		            imagenesOff["imgCatalogo"].src	= "App_Themes/CY_es/images/cabecera/btn_cata_cons_off.gif";

//		            window.parent.frames[0].document.getElementById('ctl00_imgPaso1').src	= imagenesOff["imgDatos"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_imgPaso2').src = imagenesOff["imgDirectorio"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_imgPaso3').src 	 = imagenesOff["imgEnvio"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_btnBolsPedi').src 	 = imagenesOff["imgBolsa"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_btnVerCatalogo').src	 = imagenesOff["imgCatalogo"].src;
//		            break;
//		            
//                case '02':
//   		            imagenesOff["imgDatos"] 		= new Image();
//		            imagenesOff["imgDirectorio"] 	= new Image();
//		            imagenesOff["imgEnvio"] 		= new Image();
//		            imagenesOff["imgBolsa"] 		= new Image();
//		            imagenesOff["imgCatalogo"] 		= new Image();
//            		
//		            imagenesOff["imgDatos"].src		= "App_Themes/CY_es/images/cabecera/btn_dato_dupl_on.gif";
//		            imagenesOff["imgDirectorio"].src= "App_Themes/CY_es/images/cabecera/btn_dicl_dupl_off.gif";
//		            imagenesOff["imgEnvio"].src 	= "App_Themes/CY_es/images/cabecera/btn_encl_dupl_off.gif";
//		            imagenesOff["imgBolsa"].src 	= "App_Themes/CY_es/images/cabecera/btn_bols_dupl_off.gif";
//		            imagenesOff["imgCatalogo"].src	= "App_Themes/CY_es/images/cabecera/btn_cata_dupl_off.gif";

//		            window.parent.frames[0].document.getElementById('ctl00_imgPaso1').src	= imagenesOff["imgDatos"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_imgPaso2').src = imagenesOff["imgDirectorio"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_imgPaso3').src 	 = imagenesOff["imgEnvio"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_btnBolsPedi').src 	 = imagenesOff["imgBolsa"].src;
//		            window.parent.frames[0].document.getElementById('ctl00_btnVerCatalogo').src	 = imagenesOff["imgCatalogo"].src;
//		            break;
//	        }
//        }
    }
   
   
	function enable(marca)
	{
		document.getElementById("ctl00_cphContenido_txtNombreCompleto_" + marca).disabled = true;
		document.getElementById("ctl00_cphContenido_txtAlias_"+ marca).disabled = false;
		document.getElementById("ctl00_cphContenido_txtTelefonoFijo_"+ marca).disabled = false;
		document.getElementById("ctl00_cphContenido_txtTelefonoMovil_"+ marca).disabled = false;
		document.getElementById("ctl00_cphContenido_txtEmail_"+ marca).disabled = false;
		document.getElementById("ctl00_cphContenido_lblError_" + marca).style.display='none';
		document.getElementById("ctl00_cphContenido_btnGrabar_"+ marca).style.display='';
                 
		if (Trim(document.getElementById("ctl00_cphContenido_txtTelefonoFijo_"+ marca).value) =='' )
			document.getElementById("ctl00_cphContenido_txtTelefonoFijo_"+ marca).value=document.getElementById("ctl00_cphContenido_txtPrefijo").value;

		if (Trim(document.getElementById("ctl00_cphContenido_txtTelefonoMovil_"+ marca).value) =='' )
			document.getElementById("ctl00_cphContenido_txtTelefonoMovil_"+ marca).value=document.getElementById("ctl00_cphContenido_txtPrefijo").value;
                 
		return false; 
	}

	function  ClientValidate_CY(source, values)
	{ 
		var txtTelefonoFijo=Trim(document.getElementById("ctl00_cphContenido_txtTelefonoFijo_CY").value);
		var txtTelefonoMovil= Trim(document.getElementById("ctl00_cphContenido_txtTelefonoMovil_CY").value);
		var txtPrefijo=document.getElementById("ctl00_cphContenido_txtPrefijo").value;
		if ((txtTelefonoFijo=='' && txtTelefonoMovil=='')||(txtTelefonoFijo==txtPrefijo && txtTelefonoMovil==txtPrefijo)||(txtTelefonoFijo=='' && txtTelefonoMovil==txtPrefijo)||(txtTelefonoFijo==txtPrefijo && txtTelefonoMovil==''))
			values.IsValid = false;
		else
			values.IsValid = true;
	}
            
	function  ClientValidate_LB(source, values)
	{ 
		var txtTelefonoFijo=Trim(document.getElementById("ctl00_cphContenido_txtTelefonoFijo_LB").value);
		var txtTelefonoMovil= Trim(document.getElementById("ctl00_cphContenido_txtTelefonoMovil_LB").value);
		var txtPrefijo=document.getElementById("ctl00_cphContenido_txtPrefijo").value;
		if ((txtTelefonoFijo=='' && txtTelefonoMovil=='')||(txtTelefonoFijo==txtPrefijo && txtTelefonoMovil==txtPrefijo)||(txtTelefonoFijo=='' && txtTelefonoMovil==txtPrefijo)||(txtTelefonoFijo==txtPrefijo && txtTelefonoMovil==''))
			values.IsValid = false;
		else
			values.IsValid = true;
	}
            
	function Trim(cadena)
	{
		if(cadena.length >0)
		{
			for(i=0; i<cadena.length; )
			{
				if(cadena.charAt(i)==" ")
					cadena=cadena.substring(i+1, cadena.length);
				else
					break;
			}

			for(i=cadena.length-1; i>=0; i=cadena.length-1)
			{
				if(cadena.charAt(i)==" ")
					cadena=cadena.substring(0,i);
				else
					break;
			}

		}
		return cadena;   
    }
            
            
	function irCambioPsw(ventanaDiv, IFrame)
	{
		var wnd=document.getElementById(ventanaDiv);
		var wnd2=document.getElementById(IFrame); 
		if(wnd != null && wnd2 != null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    var xwnd2 = width_CambiarPwdDiv;
		    var ywnd2 = height_CambiarPwdDiv;
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
		    yLocal = 0;

		    wnd.style.display = '';
		    wnd.style.visibility = 'visible';
		    wnd.style.left = xLocal+'px';
		    wnd.style.top = yLocal+'px';
		    wnd.style.height  = height_CambiarPwdDiv  + 'px';
		    wnd.style.width   = width_CambiarPwdDiv + 'px';
		    wnd2.style.height = height_CambiarPwdIFrame  + 'px';
		    wnd2.style.width  = width_CambiarPwdIFrame + 'px';
		    wnd2.src    = 'usua_cpass.aspx'; 
		}
		else
		{
		    alert('No hay ventana');
		}
		return false;
	}
	
	function CambiarPWDcabecera(ventanaDiv, IFrame)
	{
		var wnd=window.parent.frames[1].document.getElementById(ventanaDiv);
		var wnd2=window.parent.frames[1].document.getElementById(IFrame); 
		if(wnd != null && wnd2 != null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    var xwnd2 = width_CambiarPwdDiv;
		    var ywnd2 = height_CambiarPwdDiv;
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
		    yLocal = 0;

		    wnd.style.display = '';
		    wnd.style.visibility = 'visible';
		    wnd.style.left = xLocal+'px';
		    wnd.style.top = yLocal+'px';
		    wnd.style.height  = height_CambiarPwdDiv  + 'px';
		    wnd.style.width   = width_CambiarPwdDiv + 'px';
		    wnd2.style.height = height_CambiarPwdIFrame  + 'px';
		    wnd2.style.width  = width_CambiarPwdIFrame + 'px';
		    
		    switch(IFrame.toLowerCase())
		    {
		        case "frame":
		            wnd2.src = 'usua_cpass.aspx';
		            break;
		        
		        case "frameconsultora":
		            wnd2.src = 'usua_dato_cons.aspx'; 
		            break;
		            
                case "frameconsultora":
		            wnd2.src = 'usua_dato_cons.aspx'; 
		            break;        
		    }
		}
		else
		{
		    alert('No hay ventana');
		}
		return false;
	}

/*************************************************************************************/
/*                                   USUA_DICL                                       */
/*************************************************************************************/
	function LaunchHelp()
	{
		var wnd=document.getElementById("VentanaAyuda");
		var wnd2=document.getElementById("FrameAyudaDatos");
		if(wnd != null && wnd2 != null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    var xwnd = width_AyudaContenidoDiv;
		    var ywnd = height_AyudaContenidoDiv;
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd)/2;
		    yLocal = 0;
		    /********************************************************************/
		    wnd.style.height = height_AyudaContenidoDiv + 'px';
		    wnd.style.width  = width_AyudaContenidoDiv + 'px';
		    wnd2.style.height = height_AyudaContenidoIFrame + 'px';
		    wnd2.style.width  = width_AyudaContenidoIFrame + 'px';
		    
		    wnd.style.left = xLocal+'px';
		    wnd.style.top = yLocal+'px';
		    wnd.style.visibility = 'visible';
		    wnd.style.display = '';
		    //wnd2.src = "usua_ayuda_datos.aspx";
		    //alert(tipoVentana);
		    wnd2.src = "usua_ayuda_"+ tipoVentana +".aspx";
		    return false;
		}
		else
		{
		    //alert('no existe_');
		}
	}
	
	function LaunchMailContactWindow()
	{
		var wnd=document.getElementById("MailHelpWindow");
		var wnd2=document.getElementById("MailHelpFrame");
		
		alert('entro');
		
		if(wnd != null && wnd2 != null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    var xwnd = width_AyudaContenidoDiv;
		    var ywnd = height_AyudaContenidoDiv;
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd)/2;
		    yLocal = 0;
		    /********************************************************************/
		    wnd.style.height = height_AyudaContenidoDiv + 'px';
		    wnd.style.width  = width_AyudaContenidoDiv + 'px';
		    wnd2.style.height = height_AyudaContenidoIFrame + 'px';
		    wnd2.style.width  = width_AyudaContenidoIFrame + 'px';
		    
		    wnd.style.left = xLocal+'px';
		    wnd.style.top = yLocal+'px';
		    wnd.style.visibility = 'visible';
		    wnd.style.display = '';
		    wnd2.src = "usua_mail_help.aspx";
		    return false;
		}
		else
		{
		    //alert('no existe_');
		}
		
		
		

		
	}
	
	function LaunchPhoneContactWindow()
	{
		var wnd=document.getElementById("VentanaAyuda");
		var wnd2=document.getElementById("FrameAyudaDatos");
		if(wnd != null && wnd2 != null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    var xwnd = width_AyudaContenidoDiv;
		    var ywnd = height_AyudaContenidoDiv;
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd)/2;
		    yLocal = 0;
		    /********************************************************************/
		    wnd.style.height = height_AyudaContenidoDiv + 'px';
		    wnd.style.width  = width_AyudaContenidoDiv + 'px';
		    wnd2.style.height = height_AyudaContenidoIFrame + 'px';
		    wnd2.style.width  = width_AyudaContenidoIFrame + 'px';
		    
		    wnd.style.left = xLocal+'px';
		    wnd.style.top = yLocal+'px';
		    wnd.style.visibility = 'visible';
		    wnd.style.display = '';
		    wnd2.src = "usua_ayuda_datos.aspx";
		    return false;
		}
		else
		{
		    //alert('no existe_');
		}
	}
	
            
    function GetRandomValue()
	{
		var randomnumber = Math.random() + '';
		randomnumber = randomnumber.substring(2, randomnumber.length - 3);
		return randomnumber + '';
	}
        
	function Edit()
	{
		var wndDiv = document.getElementById("divEdicion");
		var wndFrm = document.getElementById("IFrameEditarCliente"); 
		if(wndDiv != null && wndFrm != null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    var xwndDiv = width_EdicionClienteDiv;
		    var ywndDiv = height_EdicionClienteDiv;
            wndFrm.src = 'usua_dicl_edit.aspx?'+GetRandomValue()+'&codigocliente='+reemplazarCadena(UICLIENT)+'&codigousuario='+reemplazarCadena(UIUSUARIO)+'&rol='+reemplazarCadena(ROLUSUARIO);
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwndDiv)/2;
		    yLocal = 0;
		    wndDiv.style.left = xLocal+'px';
		    wndDiv.style.top = yLocal+'px';
		    wndDiv.style.visibility = 'visible';
		    wndDiv.style.display = '';
            wndDiv.style.width  = width_EdicionClienteDiv + 'px';
            wndDiv.style.height = height_EdicionClienteDiv + 'px';
            wndFrm.style.width   = width_EdicionClienteIFrame + 'px';
            wndFrm.style.height  = height_EdicionClienteIFrame + 'px';
		}
    }
        
    function postEdit()
	{
		if (SessionTimeOut())
        {
			return;
        }
        alert(GetMessage(2));
    }
        
	
	function preDelete()
	{
		return confirm(GetMessage(0));
	}
        
	function postDelete()
	{
		if (SessionTimeOut())
		{
			return;
		}
		var opc = document.getElementById('ctl00_cphContenido_delete');
		if(opc != null)
		{
		    if(opc.value == '1')
		        alert(GetMessage(1));
		    else
		        alert(GetMessage(4));
        }
        opc.value = '0';
	}
        
	function postSave()
	{
		SessionTimeOut();
	}

	function EditarCliente(cliente, usuario, rol)
	{
		UICLIENT = cliente;
		UIUSUARIO = usuario;
		ROLUSUARIO = rol;
	}
        
	function GetMessage(posicion)
	{
		var mensajes = document.getElementById('ctl00_cphContenido_hydMensajes').value;
		return mensajes.split(SEPARADOR)[posicion];            
	}
        
	function GridResize(RolUsuario)
	{
//	    if (RolUsuario == ROLCONSULTORA)
//        {
//             divCY.style.height = HEIGTHCONSULTORA;
//        }
//        else 
//            if (RolUsuario == ROLDUPLA)
//                divCY.style.height = HEIGTHDUPLA;
	}
        
	function OpenSiteDupla(CodigoPaisDupla, Tipo)
	{
		var Url = 'http://www.cyzone.com/portal/dupla/';
		var Parametro = '.asp?strpais=' + CodigoPaisDupla;
		var Pagina = '';
            
		if (Tipo == '1')
		{
			Pagina = 'duplaInscripcionWeb';
		}

		if (Tipo == '2')
		{
			Pagina = 'duplaActualizacionWeb';
		}
		Url = Url + Pagina + Parametro;
		location.href = Url;
		return false;
	}
        
	function SessionTimeOut()
	{
		if (document.getElementById('ctl00_cphContenido_hydSessionTimeOut').value.length != 0)
		{
			parent.location.href = 'root_sess.aspx';
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function defaulttxtCodigo(name)
    {
        if(window.event.keyCode==13 && document.getElementById('ctl00_cphContenido_'+name).lenght != 0) 
        {
            document.getElementById('ctl00_cphContenido_btnGrabar_CY').click();
            return false;
        }
    }
	
/*************************************************************************************/
/*                                   USUA_DICL_EDIT                                  */
/*************************************************************************************/
	function ValidateSave()
    {
        var resultado = document.getElementById('ctl00_cphContenido_hydProcesado').value;
        if (resultado.length > 0)
        {
            window.returnValue = resultado;
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////////
    function ValidateSaveDiclEdit()
    {
        var resultado = document.getElementById('ctl00_cphContenido_hydProcesado').value;
        if (resultado.length > 0)
        {
            window.returnValue = resultado;
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////////

    function CloseWindowDiclEdit()
    {
            var wndFrm = parent.document.getElementById("IFrameEditarCliente"); 
            var oWin=parent.document.getElementById("divEdicion");  
            if ( wndFrm != null || oWin != null )
            {
                oWin.style.display = 'none';
                wndFrm.src = '';
            }
            else
                alert('No existe Frame o Div');            
    }
    
    function verificarGrabar()
    {
        /*SI EXPIRO LA SESION*/
        if (document.getElementById('ctl00_cphContenido_hiddenSession').value.length != 0)
        {
            parent.parent.location = 'root_sess.aspx';
            return true;
        }
        else
        /*SI HAY SESION ACTIVA*/
        {
            var resultado = document.getElementById('ctl00_cphContenido_hydProcesado').value;
            if (resultado.length > 0)
            /*SI ES QUE SE HA PRESIONADO EL BOTON DE GUARDAR*/
            {   
                
                /*SI ES QUE HA RESULTADO EXITOSA LA ACTUALIZACION*/
                if(resultado == 0 || resultado == 1)
                {
                    var mensajes = parent.document.getElementById('ctl00_cphContenido_hydMensajes').value;
                    if(resultado == 0)
                        alert(mensajes.split(SEPARADOR)[3]);  //Cambia de mensaje para que muestre actualización de Email de dupla
                    else
                        alert(mensajes.split(SEPARADOR)[2]);  //Cambia de mensaje para que muestre actualización de Cliente
                    /*ACTUALIZAR GRILLA*/
                    parent.location.href = 'usua_dicl.aspx';
                    var oWin=parent.document.getElementById("divEdicion");  
                    oWin.style.display = 'none';
                    CloseWindowDiclEdit();
                    return;
                }
                /*SI ES QUE HAY UN PROBLEMA AL ACTUALIZAR*/
                if(resultado == 2)
                {
                    alert('No se pudo completar la operación');
                    return;
                }
            }
        }
    }



/*************************************************************************************/
/*                                   USUA_ENCL                                       */
/*************************************************************************************/
	
	function GetRandomValue()
	{
		var randomnumber = Math.random() + '';
		randomnumber = randomnumber.substring(2, randomnumber.length - 3);
		return randomnumber + '';
	}
	
	function Select()
	{
		var wndDiv = document.getElementById("divEnviarMails");
		var wndFrm = document.getElementById("IFrameEnviarMails"); 
		var xLocal = 0;
		var yLocal = 0;
		var xwndDiv = wndDiv.style.width;
		var ywndDiv = wndDiv.style.height;
		wndFrm.src = 'usua_encl_selc.aspx?rndvalue=' + GetRandomValue();
		xLocal = parseFloat(screen.width)/2 - parseFloat(xwndDiv)/2;
		yLocal = 0;
		wndDiv.style.left = xLocal+'px';
		wndDiv.style.top = yLocal+'px';
		wndDiv.style.visibility = 'visible';
		wndDiv.style.display = 'block';
	}
	
	function Preview(ventanaDiv, IFrame, bolsaPedido)
	{
		var wndDiv = document.getElementById(ventanaDiv);
		var wndFrm = document.getElementById(IFrame); 
		if(wndDiv !=null && wndFrm !=null)
		{
		    var xLocal = 0;
		    var yLocal = 0;
		    if(bolsaPedido == 0)  //Sin Bolsa de pedido
		    {
		        //alert('Esta es sin bolsa de pedido');
		        var xwndDiv = width_SeleccionarClienteDIV;
		        var ywndDiv = height_SeleccionarClienteDIV;
		        wndFrm.src = 'usua_encl_preview.aspx';
		        wndDiv.style.width  = width_SeleccionarClienteDIV  + 'px';
		        wndDiv.style.height = height_SeleccionarClienteDIV + 'px';
		        wndFrm.style.width  = width_SeleccionarClienteIFrame  + 'px';
                wndFrm.style.height = height_SeleccionarClienteIFrame + 'px';
            }
            else  
            {
                //alert('Con Bolsa de pedidos, cambia los tamaños!');
                var xwndDiv = width_SeleccionarClienteBolsaDIV;
		        var ywndDiv = height_SeleccionarClienteBolsaDIV;
		        wndFrm.src = 'usua_encl_preview.aspx';
		        wndDiv.style.width  = width_SeleccionarClienteBolsaDIV  + 'px';
		        wndDiv.style.height = height_SeleccionarClienteBolsaDIV + 'px';
		        wndFrm.style.width  = width_SeleccionarClienteBolsaIFrame  + 'px';
                wndFrm.style.height = height_SeleccionarClienteBolsaIFrame + 'px';
            }
    		
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwndDiv)/2;
		    yLocal = 0;
		    wndDiv.style.left = xLocal+'px';
		    wndDiv.style.top = yLocal+'px';
		    wndDiv.style.visibility = 'visible';
		    wndDiv.style.display = 'block';
		}
	}

	function postSelect()
	{
		
		SessionTimeOut();
	}
	
	function postAll()
	{   
		SessionTimeOut();
	}
	
	function postSend()
	{   
		SessionTimeOut();
	}
	
	function postPreview()
	{   
		SessionTimeOut();
	}

	function SessionTimeOut()
	{   
		if (document.getElementById('ctl00_cphContenido_hydSessionTimeOut').value.length != 0)
		{
			parent.location.href = 'root_sess.aspx';
			return true;
		}
		else
		{
			return false;
		}
	}


/*************************************************************************************/
/*                                   USUA_ENCL_PREVIEW                               */
/*************************************************************************************/
    function CloseWindowPreview()
    {
        if (parent.document.getElementById('ctl00_cphContenido_hydSessionTimeOut').value == '')
        {
            var oWin=parent.document.getElementById("divVentanaPreview");  
            oWin.style.display = 'none';
            return false;
        }
        else
        {
            if(parent.document.getElementById('ctl00_cphContenido_hydSessionTimeOut').value.lenght != 0)
            {
                parent.location.href = 'root_sess.aspx';
                return true;
            }
        }
    }


/*************************************************************************************/
/*                                   USUA_ENCL_SELC                                  */
/*************************************************************************************/
    function CloseWindow()
    {
        var sesion = document.getElementById('hiddenSession').value;
        if(sesion.length != 0)
            parent.location.href = 'usua_encl.aspx';                        
        var oWin=parent.document.getElementById("divEnviarMails");
        oWin.style.display = 'none';
    }

/*************************************************************************************/
/*                                   USUA_GPASS_DUPL                                 */
/*************************************************************************************/
    function CloseMyWindow()
    {
        var ventana=parent.document.getElementById("ctl00_VentanaGenerarPwd"); 
        if(ventana!=null)
        {
            ventana.style.display='none';
            ventana.style.visibility='hidden';
        }
        else
        {
            alert("no existe ventana");
        }
        return false;
    }

/*************************************************************************************/
/*                                   USUA_GPASS_DUPL                                 */
/*************************************************************************************/

    function CloseWindow()
    {
        var ventana=parent.document.getElementById("ctl00_VentanaGenerarPwd"); 
        if(ventana!=null)
        {    
            var wndDiv = parent.document.getElementById("FrameGenerar"); 
            wndDiv.src = "usua_gpass_dupla.aspx";
            ventana.style.display='none';
            ventana.style.visibility='hidden';
        }
        else
        {
            //alert("no existe");
        }
        return false;
    }
    
/*************************************************************************************/
/*                                   USUA_OPASS                                      */
/*************************************************************************************/

    function CloseWindow()
    {
        var ventana=parent.document.getElementById("ctl00_VentanaOlvidarPwd"); 
        if(ventana!=null)
        {
            ventana.style.display='none';
            ventana.style.visibility='hidden';
        }
        else
        {
            //alert("no existe");
        }
        return false;
    }

/*************************************************************************************/
/*                                   USUA_OPASS_RESU                                 */
/*************************************************************************************/
    function CloseWindow()
    {
        var ventana=parent.document.getElementById("ctl00_VentanaOlvidarPwd"); 
        if(ventana!=null)
        {
            var wndDiv = parent.document.getElementById("Frame"); 
            wndDiv.src = "usua_opass.aspx";
            ventana.style.display='none';
            ventana.style.visibility='hidden';
        }
        else
        {
            //alert("no existe");
        }
        return false;
    }
/*****************************************************************************************/

	function reemplazarCadena(qstring)
	{
	    if(qstring.indexOf('/') != -1)
	    {
	        qstring = qstring.replace('/', '%2F');
	    }
	    if(qstring.indexOf('+') != -1)
	    {
	        qstring = qstring.replace('+', '%2B');
	    }
	    qstring = escape(qstring);
	    return qstring;
	}

/*********************************************************************************************/
/*                                      USUA_ENCL_SELECT                                     */
/*********************************************************************************************/

function CheckporTipoEnvio(aspCheckBoxID,nombreControl) 
    {
        if (nombreControl == 'chk1')
        {
            var checkboxSeleccionadoSC 
            checkboxSeleccionadoSC =  aspCheckBoxID.id;
            var checkboxSeleccionadoCC 
            checkboxSeleccionadoCC = checkboxSeleccionadoSC.substring(0,checkboxSeleccionadoSC.length-1);
            checkboxSeleccionadoCC = checkboxSeleccionadoCC+ '2';    
        }
        
        else
        {
            var checkboxSeleccionadoCC 
            checkboxSeleccionadoCC =  aspCheckBoxID.id
            var checkboxSeleccionadoSC 
            checkboxSeleccionadoSC = checkboxSeleccionadoCC.substring(0,checkboxSeleccionadoCC.length-1);
            checkboxSeleccionadoSC = checkboxSeleccionadoSC+ '1';
        }
        
        var chk1 = document.getElementById(checkboxSeleccionadoSC);
        var chk2 =  document.getElementById(checkboxSeleccionadoCC);
           
        if (nombreControl == 'chk1')
        {
            if (chk1.checked==true)
            {   
                document.getElementById(checkboxSeleccionadoSC).checked=true;
                document.getElementById(checkboxSeleccionadoCC).checked=false;}
            }
        else 
        {
            if (chk2.checked==true)
            {   
                document.getElementById(checkboxSeleccionadoCC).checked=true;
                document.getElementById(checkboxSeleccionadoSC).checked=false;}
        }       
    }
    
/********************************************************************************************************/
/*                                          AYUDITAS                                                    */
/********************************************************************************************************/

    function getMouseXY(eventoFF, divlocal) 
    {
        var btn = document.getElementById('ctl00_cphContenido_btnAyuda');
        var x1 = btn.style.top;
        var y1 = btn.style.left;
        if(/MSIE (\d+\.\d+);/.test(navigator.userAgent))
        {
            x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft ;
            y = event.clientY + document.body.scrollTop  + document.documentElement.scrollTop ;
        }
	    else 
	    {
	        x = eventoFF.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            y = eventoFF.clientY + document.body.scrollTop  + document.documentElement.scrollTop ;
	    }
	        
        x = x + 'px';
        y = y + 'px';
        ShowWindows(divlocal, x, y);
    }
    
    
    
    
    function SimulateModalWindow(url, div, frame)
    {             
		//var wnd=window.parent.frames[1].document.getElementById("HelpWindow");			 
		//var wnd2=window.parent.frames[1].document.getElementById("HelpFrame");			
		var wnd=window.parent.frames[1].document.getElementById(div);			 
		var wnd2=window.parent.frames[1].document.getElementById(frame);
		
		var isOpera = (navigator.userAgent.indexOf("Opera"));		
		if (wnd!=null && wnd2!=null)		 
        {   
            /*utilizando la funcion de Nelson*/
            var path = window.parent.frames[1].document.location.pathname;
            var carpetas = path.split('/');
            var opc = 0;
            for(var x=0; x<carpetas.length; x++)
            {
                carpetas[x] = carpetas[x].toLowerCase();
                if(carpetas[x] == 'historial' || carpetas[x] == 'reportes')
                    opc = 1;
            }
            /*utilizando la funcion de ricardo*/
            
            if (isOpera==0)
            { 
                if(opc == 1)
                    window.parent.frames[1].frames['Frame'].location.href = url;
                else
                    window.parent.frames[1].frames['Frame'].location.href = url;            
            }
            else            
            {            
                if(opc == 1)
                    wnd2.src = '../'+url;
                else
                    wnd2.src = url;
            }           
            
            /**/           
            var xLocal = 0;
		    var yLocal = 0;
		    var xwnd2 = widthDiv;
		    var ywnd2 = heightDiv;
		    xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
		    yLocal = 0;//(parseFloat(screen.height)/2 -480) - parseFloat(ywnd2)/2;
		    /********************************************************************/
		    
		    wnd.style.visibility = 'visible';
		    wnd.style.display = '';
		    wnd.style.left = xLocal+'px';
		    wnd.style.top = yLocal+'px';
		    
		    wnd.style.height = heightDiv + 'px';
		    wnd.style.width  = widthDiv + 'px';
		    
		    wnd2.style.height = heightIframe + 'px';
		    wnd2.style.width  = widthIframe + 'px';
		    
		    return false;  
		}
		else
		{   	     
              alert("no hay ventana asociada");
              return false;
        }
    }
    
    
    function ValidarCasilla()
    {
        var chkBox = document.getElementById('ctl00_cphContenido_chkConfirmacion_CY');
        var txtBox = document.getElementById('ctl00_cphContenido_txtCodigoConsultora');
        var casilla=document.getElementById('Casilla');
        var codigo=document.getElementById('Codigo');
        if(chkBox!=null && casilla!=null )
        {
            if(chkBox.checked!=false && txtBox.value != "")
                return;
            else
            {
                if(chkBox.checked==false && casilla!=null)
                    casilla.style.visibility = 'visible';
                else
                    casilla.style.visibility = 'hidden';
                
                if(txtBox.value == "" && codigo!=null)
                    codigo.style.visibility = 'visible';
                else
                    codigo.style.visibility = 'hidden';
                return false;            
            }
        }
        else
        {
            alert('Error JS');
        }
        
    }
    
    
    /********************************************************************************************************/
    /*                          FUNCIONES PARA VENTANAS PEQUEÑAS                                            */
    /********************************************************************************************************/
    function getmouseposition(e)
    {
        if(document.getElementById)
        {
            var iebody=(document.compatMode && 
        	    document.compatMode != 'BackCompat') ? 
        		    document.documentElement : document.body;
            pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
            pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
            mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
            mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

            var ventanaDiv = document.getElementById(ventana);
            alert(mousex + ' ' + pagex + ' '+ ' ' + offsetx);
            alert(mousey + ' ' + pagey + ' '+ ' ' + offsety);
            ventanaDiv.style.left = (mousex+pagex+offsetx-100) + 'px';
            ventanaDiv.style.top = (mousey+pagey+offsety) + 'px';
        }
    }
    
   
    
    function tooltip(div, e)
    {
        var ventanaDiv = document.getElementById(div);
        var posTabla   = document.getElementById('tablaGeneral');
        ventana = div;
        ventanaDiv.style.display = 'block';
        ventanaDiv.style.visibility= 'visible';
        ventanaDiv.style.height = height_Ayudita;
        ventanaDiv.style.width= width_Ayudita;
        
        if(!e) e = window.event; 
        if (e.pageX) 
	        mousex = e.pageX; 
        else 
	        if (e.clientX)
		        mousex = e.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); 
    
        if (e.pageY) 
		    mousey = e.pageY; 
        else 
	        if (e.clientY)
		        mousey = e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 
	        else 
	            mousey =  0;
        
        if(/MSIE (\d+\.\d+);/.test(navigator.userAgent) == false)
            mousex = mousex + 100;
        else    
            mousex = mousex + 50;
        
        var poscIzq = mousex-width_Ayudita;
        var tamanio = (screen.width - parseInt(posTabla.style.width))/2;
        if(poscIzq < tamanio)
            poscIzq=tamanio;
            
        ventanaDiv.style.left = poscIzq + 'px';
        ventanaDiv.style.top = (mousey) + 'px';
    }
    function exit(div)
    {
        document.getElementById(div).style.display='none';
        document.getElementById(div).style.visibility='hidden';
    }
    /********************************************************************************************************/
    
    function cambiarTamanio()
    {
        var ventana = document.getElementById('ventana');
        ventana.style.visibility = 'visible';
        ventana.style.display= 'block';
        ventana.style.left = "50%";
        ventana.style.top = "50%";
        var ventanaleft = ventana.offsetLeft;
        ventana.style.left = ventanaleft - ventana.offsetWidth/2;
        var ventanatop = ventana.offsetTop;
        ventana.style.top = ventanatop - ventana.offsetHeight/2;
    }
    
    function centrarTC()
    {
        var w = 820
        var posIzquierda = (screen.width) ? (screen.width-w)/2 : 0;
        window.moveTo(posIzquierda,0);
        self.resizeTo(820,screen.availHeight);
        self.moveTo(posIzquierda,0);
        self.focus;
        
        var ventana = document.getElementById('principal');
        var tabla = document.getElementById('tablaPrincipal');
        
        ventana.style.left = "10%";
        
        ventana.style.height = screen.availHeight - 300 + 'px';
        tabla.style.height = screen.availHeight - 300 + 'px';
        
    }

    //Funcion para levantar las paginas a las que accede el cliente o consultora 
    function LaunchPageR()
	{  
	    //var ruta=document.getElementById("ctl00_lblparametropagina"); 
	    var ruta=document.getElementById("ctl00_hfldParametroPag");
	    if(ruta !=null)
	    {
	        window.parent.frames[1].window.location=ruta.value;//.innerHTML;
	        cambiarVisibilidad('visible');
        }
	    else
	        alert('null');
		return false;   
    }
    
       
        
    function cambiarVisibilidad(cambio)
    {
        if (cambio!=null)
        {
            var imgCatalogo = document.getElementById("ctl00_btnVerCatalogo");
	        if(imgCatalogo != null)
	        {
	            if(cambio == 'visible')
	                imgCatalogo.style.visibility= 'visible';
                else
                    imgCatalogo.style.visibility= 'hidden';
	        }
	        else
	            alert('No existe boton verCatalogo');
            }
    }
    
    
    function LaunchTips()
    {
            var wnd=document.getElementById('ventanaTips');
	        var iFrame=document.getElementById('frameTips');
	        var xLocal = 0;
	        var yLocal = 0;
	        var xwnd2 = width_TipsDiv;
	        var ywnd2 = height_TipsDiv;
	        xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
	        yLocal = 0;
            iFrame.src      = "usua_encl_tips.aspx";
            wnd.style.left  = xLocal+'px';
            wnd.style.top        = yLocal+'px';
            wnd.style.visibility = 'visible';
            wnd.style.display = '';
            wnd.style.width   = width_TipsDiv + 'px';
            wnd.style.height  = height_TipsDiv + 'px';
            iFrame.style.width  = width_TipsIFrame + 'px';
            iFrame.style.height = height_TipsIFrame + 'px';

    }
    
    ////////////////////////////////////////////////////////////////////////////////////////////
    /************************************** PANTALLAS FAQ**************************************/
        function LaunchFAQ(ventana, tamanio)
    {
        if(ventana!= null)
        {
            var wnd = window.parent.frames[1].document.getElementById('ventanaFAQ');// parent.frame[1].document.getElementById('ventanaFAQ');
	        var iFrame=window.parent.frames[1].document.getElementById('frameFAQ');  //parent.frame[1].
	        var xLocal = 0;
	        var yLocal = 0;
	        
	         if(tamanio != null && tamanio.toLowerCase() != 'l')
	         {
	            altoD = height_FAQDiv_m;
	            altoI = height_FAQIFrame_m;
             }
             else
             {
                altoD = height_FAQDiv_l;
	            altoI = height_FAQIFrame_l;
             }
	        
	        var xwnd2 = width_FAQDiv;
	        var ywnd2 = altoD;
	        xLocal = parseFloat(screen.width)/2 - parseFloat(xwnd2)/2;
	        yLocal = 0;
	        
	        switch(ventana.toLowerCase())
	        {
                case 'faqdato':
                    iFrame.src = "usua_preg_frec_dato.aspx";
                    break;
                    
                case 'faqdicl':
                    iFrame.src = "usua_preg_frec_dicl.aspx";
                    break;

                case 'faqencl':
                    iFrame.src = "usua_preg_frec_encl.aspx";
                    break;
                    
                case 'faqenclsel':
                    iFrame.src = "usua_preg_frec_enviosel.aspx";
                    break;                                        

                case 'faqbols':
                    iFrame.src = "usua_preg_frec_bols.aspx";
                    break;
                    
                case 'faqhist':
                    iFrame.src = "usua_preg_frec_hist.aspx";
                    break;
                
                case 'faqbolstotal':
                    iFrame.src = "usua_preg_frec_detped.aspx";
                    break;
                    
                case 'faqbolsdettotal':
                    iFrame.src = "usua_preg_frec_dettotped.aspx";
                    break;
                
                case 'faqdetalle':
                    iFrame.src = "usua_preg_frec_detped.aspx";
                    break;                        
                
                default:
                    iFrame.src = "usua_preg_frec_cata.aspx";
                    break;

            }
            
	        wnd.style.left = xLocal+'px';
	        wnd.style.top = yLocal+'px';
	        wnd.style.visibility = 'visible';
	        wnd.style.display = '';
	        wnd.style.width   = width_FAQDiv + 'px';
	        wnd.style.height  = altoD + 'px';
	        iFrame.style.width  = width_FAQIFrame + 'px';
	        iFrame.style.height = altoI + 'px';
	        //////////////////////////////////////////////////////////////////////////////////
    	 }
    	 return false;
	}

	
	function abrirFAQRol(rol)
	{   
        if(rol != null)
        {
            var faq = document.getElementById('help_'+rol);
            if(faq!=null)
            {
                faq.style.visibility = 'visible';
                faq.style.display    = '';
            }
        }
        else
            alert('Rol no establecido');
	}
    /******************************************************************************************/
    
   
   
    
    /********************************************************************************************************/
    /*                          FUNCIONES BOLSA CONSULTORA
    /********************************************************************************************************/
    
    function MensajeErrorAplicacion(proceso,msgError)
    {
        var Titulo = "- Ocurrio un problema en:"
        var Opcion = "Consulte con el Administrador del Sistema."
        var salto = "\n"     
        var Mensaje = Titulo +  proceso + salto+ "-Error:"+ msgError + salto + Opcion 
        alert(Mensaje);
    }
    
    function CloseWindow2()
    {
        alert('asdf');
        var rol=document.getElementById("hydValorRol").value;
        if(rol!=null)
        {
            oDiv=document.getElementById("Help_"+"01");
        }
        else
        {
            alert('rol0');
            oDiv=document.getElementById("Help_0");
        }
  
        if( oDiv.style.display != 'none') 
        {  
            var oWin=parent.document.getElementById("HelpMailWindow");  
            if(oWin!= null)
            { 
                oWin.style.display='none';
            }
            else
            {
                alert("no existe ventana");
            }
         }   
         return false;           
    }
        
        
    function ShowHelp2()
	{   
         //alert("ingreso a help");
         var rol=document.getElementById("hydValorRol").value ;
         //alert(rol);
         //document.getElementById("Help_"+rol).style.display='';
         var oWin=parent.document.getElementById("ctl00_HelpMailWindow");   
         if((oWin!= null)&&(oWin.style.display!='none'))
         {
             oWin.style.display='';
             oWin.style.visibility='';
         }       
     	 
         if(rol!=null)
         {
            // ventanaActual=document.getElementById("Help_"+rol);
             ventanaActual=document.getElementById("Help_"+"01");
         }
         if(ventanaActual!=null)
         {
	     
            ventanaActual.style.display='';
            ventanaActual.style.visibility='visible';
         }
         return false;
	        
	}
	
	function ValidarEnteroOnKeyDown(e)
	{
        /************************************************
        DESCRIPTION: Validates that a string contains only
        valid integer number on KeyDown event.

        PARAMETERS:
        strValue - String to be tested for validity

        RETURNS:
        True if valid, otherwise false.
        **************************************************/
        var key = (document.all) ? e.keyCode : e.which;
        var charKey = String.fromCharCode(key);
        var shiftKey = e.shiftKey;
        var altKey = e.altKey;
        var ctrlKey = e.ctrlKey;
        var numlockNumber = (key >= 96 && key <= 105);
        var arrows = (key == 37 || key == 39);
        var objRegExp  = /\d/;
        //check for integer characters, backspace key or delete key (supr)
        return (!shiftKey && (objRegExp.test(charKey) || key == 8 || key == 46 || numlockNumber || arrows));
    }
    
    function ValidarEnteroOnKeyPress(e)
	{
        /************************************************
        DESCRIPTION: Validates that a string contains only
        valid integer number on KeyDown event.

        PARAMETERS:
        strValue - String to be tested for validity

        RETURNS:
        True if valid, otherwise false.
        **************************************************/
        var key = (document.all) ? e.keyCode : e.which;
        var charKey = String.fromCharCode(key);
        var objRegExp  = /\d/;
        //check for integer characters
        return (key == 0 || key == 8 || objRegExp.test(charKey));
    }
    
    function CompletarSiVacio(strValue, strComplete) 
    {
        /************************************************
        DESCRIPTION: Completes a field blank with 
        characters.

        PARAMETERS:
           strValue - String to be tested for validity
           strComplete - String for complete

        RETURNS:
           True if valid, otherwise false.
        *************************************************/
        var strTemp = strValue;
        strTemp = TrimAll(strTemp);
        if(!ValidarNoVacio(strValue))
        {
            return strComplete;
        }
        return strValue;
    }
    
    function ReemplazarSiCero(strValue, strComplete) 
    {
        /************************************************
        DESCRIPTION: Replace a field with zero with 
        other character.

        PARAMETERS:
           strValue - String to be tested for validity
           strComplete - String for replace

        RETURNS:
           True if valid, otherwise false.
        *************************************************/
        if(parseInt(strValue) == 0)
        {
            return strComplete;
        }
        return strValue;
    }
    
    function ReemplazarCadenaXNumeros(strValue, strComplete) 
    {
        /************************************************
        DESCRIPTION: Replace a field with zero with 
        other character.

        PARAMETERS:
           strValue - String to be tested for validity
           strComplete - String for replace

        RETURNS:
           True if valid, otherwise false.
        *************************************************/
        if(isNaN(strValue))
        {
            return strComplete;
        }
        return strValue;
    }
    
    function TrimAll(strValue) 
    {
        /************************************************
        DESCRIPTION: Removes leading and trailing spaces.

        PARAMETERS: Source string from which spaces will
        be removed;

        RETURNS: Source string with whitespaces removed.
        *************************************************/
        var objRegExp = /^(\s*)$/;
        //check for all spaces
        if(objRegExp.test(strValue)) 
        {
           strValue = strValue.replace(objRegExp, '');
           if( strValue.length == 0)
              return strValue;
        }
        return strValue;
    }
    
    function ValidarNoVacio(strValue) 
    {
        /************************************************
        DESCRIPTION: Validates that a string is not all
          blank (whitespace) characters.

        PARAMETERS:
           strValue - String to be tested for validity

        RETURNS:
           True if valid, otherwise false.
        *************************************************/
       var strTemp = strValue;
       strTemp = TrimAll(strTemp);
       if(strTemp.length > 0)
       {
         return true;
       }
       return false;
    }
    
    function validarTexto(e)
    {
        var tecla = (document.all) ? e.keyCode : e.which;
        if (tecla == 8) 
            return true;
        patron = /^[a-zA-ZáéíóúÁÉÍÓÚñÑüÜ@çÇàèìòùÀÈÌÒÙâêîôûÂÊÎÔÛºª]|\s$/;
        caracter = String.fromCharCode(tecla);
        return patron.test(caracter);
    }
    
    function validarAlfanumerico(e)
    {
        var tecla = (document.all) ? e.keyCode : e.which;
        if (tecla == 8) 
            return true;
        patron = /^[a-zA-Z0-9áéíóúÁÉÍÓÚñÑüÜ@çÇàèìòùÀÈÌÒÙâêîôûÂÊÎÔÛºª]|\s$/;
        caracter = String.fromCharCode(tecla);
        return patron.test(caracter);
    }
    
    function validarTelefono(e)
    {
        tecla = (document.all) ? e.keyCode : e.which;
        if (tecla == 8)
            return true;
        patron = /^[0-9-]|\s|[()]$/;
        te = String.fromCharCode(tecla);
        return patron.test(te);    
    }
    
    
    function reemplazarPortal(valorAntiguoPortal, valorNuevoPortal, valorAntiguoConsultora , valorNuevoConsultora , ayuda)
    {
    
        var texto = document.getElementById(ayuda).innerHTML;
        var intIndexOfMatch = document.getElementById(ayuda).innerHTML.indexOf(valorAntiguoPortal);
        //PORTAL
        while (intIndexOfMatch != -1)
        {
            document.getElementById(ayuda).innerHTML = document.getElementById(ayuda).innerHTML.replace(valorAntiguoPortal,valorNuevoPortal);            
            intIndexOfMatch = document.getElementById(ayuda).innerHTML.indexOf(valorAntiguoPortal);
        }
        intIndexOfMatch = 0;
        intIndexOfMatch = document.getElementById(ayuda).innerHTML.indexOf(valorAntiguoConsultora);
        //CONSULTORA
        while (intIndexOfMatch != -1)
        {
            document.getElementById(ayuda).innerHTML = document.getElementById(ayuda).innerHTML.replace(valorAntiguoConsultora,valorNuevoConsultora);            
            intIndexOfMatch = document.getElementById(ayuda).innerHTML.indexOf(valorAntiguoConsultora);
        }
        
        return false;
    }
    
    function deshabilitarCajasTexto()
    {
        var x=0;
        var ar = new Array();
        var cajas = new Array();
        var combos = new Array();
        cajas = document.getElementsByTagName( 'input' );
        combos = document.getElementsByTagName('select');
        for ( i = 0; i < cajas.length; i++ )
        { 
            if ( cajas[i].type == 'text')
            {
                cajas[i].value = "";
                cajas[i].disabled = true;
            }
        }
        var anio = document.getElementById('ctl00_cphContenido_ddlAnho');
        var mes = document.getElementById('ctl00_cphContenido_ddlMes');
        var dia = document.getElementById('ctl00_cphContenido_ddlDia');
        
        anio.disabled = true;
        mes.disabled = true;
        dia.disabled = true;
        
        return false;
    }
    
    function BotonDefecto()
    {
        if((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13))
        {
            window.focus();
            return false;
        }
    }
    
/*******************************************************************************************************************************************/    
    function ShowPopUpFaq(idWindow)
    {
        var rol = document.getElementById('ctl00_cphContenido_rol');
        var ventanaActual=document.getElementById(idWindow+rol.value);
        
        if(ventanaActual!=null)
        {	     
            ventanaActual.style.height = heightFAQ + 'px' ;
            ventanaActual.style.width  = widthFAQ + 'px';
	        ventanaActual.style.display='';
            ventanaActual.style.visibility='visible';
            reemplazarFaq(idWindow+rol.value);
            
            var xLocal = parseFloat(screen.width)/2 - parseFloat(ventanaActual.style.width)/2;
            var yLocal = parseFloat(screen.height)/4 - parseFloat(ventanaActual.style.height)/4;
            ventanaActual.style.left = xLocal+'px';
            ventanaActual.style.top = yLocal+'px';
        }
        else
        {
            alert ("no existe ventana a mostrar");
        }
        return false;
    }
    
    function reemplazarFaq(div)
    {
        var valorAntiguoPortal = '!*PORTAL*!';
        var valorAntiguoConsultora = '!*CONSULTORA*!';
        var valorFonoAntiguo = '!*TELEFONO*!';
        var valorNuevoPortal = document.getElementById('ctl00_cphContenido_portal');
        var valorNuevoConsultora  = document.getElementById('ctl00_cphContenido_consultora');
        var valorFonoNuevo  = document.getElementById('ctl00_cphContenido_telefono');
        var rol = document.getElementById('ctl00_cphContenido_rol');
        var faqPrincipal;
        
        if(rol != null)
        {
            if(rol.value == '01')
                faqPrincipal = document.getElementById(div);
            else
                faqPrincipal = document.getElementById(div);
        }
        else
            return false;
        
        if(faqPrincipal !=null)
        {
            if(faqPrincipal.style.visible != 'visible')
            {
                faqPrincipal.style.visibility = 'visible';
			    faqPrincipal.style.display = 'block';
            }
            
            /**********************************************************************************************************************
                              REEMPLAZOS DE PORTAL, CONSULTORA Y TELEFONO EN LAS PREGUNTAS FRECUENTES        
            ***********************************************************************************************************************/
            var texto = faqPrincipal.innerHTML;
            var intIndexOfMatch = faqPrincipal.innerHTML.indexOf(valorAntiguoPortal);
            
            /******************************************PORTAL*************************************************/
            while (intIndexOfMatch != -1)
            {
                faqPrincipal.innerHTML = faqPrincipal.innerHTML.replace(valorAntiguoPortal,valorNuevoPortal.value);
                intIndexOfMatch = faqPrincipal.innerHTML.indexOf(valorAntiguoPortal);
            }
            intIndexOfMatch = 0;
            intIndexOfMatch = faqPrincipal.innerHTML.indexOf(valorAntiguoConsultora);

            /**************************************CONSULTORA*************************************************/
            while (intIndexOfMatch != -1)
            {
                faqPrincipal.innerHTML = faqPrincipal.innerHTML.replace(valorAntiguoConsultora,valorNuevoConsultora.value);            
                intIndexOfMatch = faqPrincipal.innerHTML.indexOf(valorAntiguoConsultora);
            }

            /**************************************TELEFONO***************************************************/
            intIndexOfMatch = 0;
            intIndexOfMatch = faqPrincipal.innerHTML.indexOf(valorFonoAntiguo);
            while (intIndexOfMatch != -1)
            {
                faqPrincipal.innerHTML = faqPrincipal.innerHTML.replace(valorFonoAntiguo,valorFonoNuevo.value);            
                intIndexOfMatch = faqPrincipal.innerHTML.indexOf(valorFonoAntiguo);
            }
            /***********************************************************************************************************************/
        }
        else
            alert('No existen preguntas frecuentes')
        return false;
    }

function cortarCaracteres(obj) 
{
    if (obj.value.length > cantMaxCaracteresEnvio)
    {
	    obj.value = obj.value.substring(0, cantMaxCaracteresEnvio);
    }
}

/********************************************************************************************************************/
function ValidarDia(source, arguments)
{
    var genderList = document.getElementById("ctl00_cphContenido_ddlDia");
	if (null != genderList)
	{
		var iValue = new Number(genderList[genderList.selectedIndex].value);
		arguments.IsValid=(iValue > 0);
	}
	else
	{
		arguments.IsValid = false;
	}
}

function ValidarMes(source, arguments)
{
    var genderList = document.getElementById("ctl00_cphContenido_ddlMes");
	if (null != genderList)
	{
		var iValue = new Number(genderList[genderList.selectedIndex].value);
		arguments.IsValid=(iValue > 0);
	}
	else
	{
		arguments.IsValid = false;
	}
}

function ValidarAnio(source, arguments)
{
    var genderList = document.getElementById("ctl00_cphContenido_ddlAnho");
	if (null != genderList)
	{
		var iValue = new Number(genderList[genderList.selectedIndex].value);
		arguments.IsValid=(iValue > 0);
	}
	else
	{
		arguments.IsValid = false;
	}
}

function validarCampoTextoNombre(source, arguments)
{
    var txtNombre = document.getElementById('ctl00_cphContenido_txtNombre_CY');
    if(null != txtNombre)
    {
        var tamanio = txtNombre.value;
        var valor = new Number(tamanio.length);
        arguments.IsValid = (valor < 49);
    }
    else
        arguments.IsValid = false;
}


function validarCampoTextoApellido(source, arguments)
{
    var txtNombre = document.getElementById('ctl00_cphContenido_txtApellido_CY');
    if(null != txtNombre)
    {
        var tamanio = txtNombre.value;
        var valor = new Number(tamanio.length);
        arguments.IsValid = (valor < 29);
    }
    else
        arguments.IsValid = false;
}


function validarCampoTextoEmail(source, arguments)
{
    var txtNombre = document.getElementById('ctl00_cphContenido_txtEmail_CY');
    if(null != txtNombre)
    {
        var tamanio = txtNombre.value;
        var valor = new Number(tamanio.length);
        arguments.IsValid = (valor < 49);
    }
    else
        arguments.IsValid = false;
}
/********************************************************************************************************************/

function mostrarCarga()
{
    document.getElementById('loading').style.visibility = 'visible';
    return true;
}

function quitarCarga()
{
    document.getElementById('loading').style.visibility = 'hidden';
    return true;
}