﻿/*********************************  CUPublico.js ********************************/

function AbrirEspecial(CodBanner)
{
    var NuevaVentana
    var URL = "Especial.aspx?CodBanner=" + CodBanner
    var NombreVentana = 'Especial'
//    var Parametros = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=1084'
    var Parametros = 'toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1, width=1084'
    NuevaVentana=window.open(URL, NombreVentana, Parametros); 
    
    return false 
}

function AbrirEspecialContratista(TipoItemBuscador)
{
    var NuevaVentana
    var URL = "EspecialContratista.aspx?TipoItemBuscador=" + TipoItemBuscador //TipoItemBuscador=5 => General.PERFIL_CONTRATISTA
    var NombreVentana = 'EspecialContratista'
//    var Parametros = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=1084'
    var Parametros = 'toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1, width=1084'
    NuevaVentana=window.open(URL, NombreVentana, Parametros); 
    
    return false 
}

function AbrirNoticiaEvento(NoticiaEvento,TipoNoticiaEvento)
{
    var NuevaVentana
    var URL = "NoticiaEvento.aspx?NoticiaEvento=" + NoticiaEvento + "&TipoNoticiaEvento=" + TipoNoticiaEvento
    var NombreVentana = 'Evento'
//    var Parametros = 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=1, width=1084'
    var Parametros = 'toolbar=1, location=1, directories=0, status=0, menubar=1, scrollbars=1, resizable=1, width=1084'
    NuevaVentana=window.open(URL, NombreVentana, Parametros);  
    return false
}

function AbrirDocumento(Ruta)
{
    var NuevaVentana
    var URL = Ruta
    var NombreVentana = "Documento"
    var Parametros = 'toolbar=1, location=1, directories=1, status=1, menubar=1, scrollbars=1, fullscreen=1, resizable=1, width="100%"'
    NuevaVentana = window.open(URL, NombreVentana, Parametros)
    
    return false  
}

function AbrirEnlace(Ruta)
{
    var NuevaVentana
    var URL = Ruta
    var NombreVentana = 'Enlace'
    var Parametros = 'toolbar=1, location=1, directories=1, status=1, menubar=1, scrollbars=1, resizable=1, width="100%"'
    NuevaVentana=window.open(URL, NombreVentana, Parametros); 
    
    return false  
}

function AbrirWAI()
{
    var NuevaVentana
    var URL = "Wai.aspx"
    var NombreVentana = 'Enlace'
//    var Parametros = 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=0, width=600px, height=380px'
    var Parametros = 'toolbar=1, location=1, directories=0, status=0, menubar=1, scrollbars=1, resizable=0, width=600px, height=380px'
    NuevaVentana=window.open(URL, NombreVentana, Parametros); 
    
    return false  
}

function AbrirEspacioAbierto()
{
    var NuevaVentana
    var URL = "EspacioAbierto.aspx"
    var NombreVentana = "EspacioAbierto"
//    var Parametros = "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=0, width=1048px, height=700px"
    var Parametros = "toolbar=1, location=1, directories=0, status=0, menubar=1, scrollbars=1, resizable=0, width=1048px, height=700px"
    NuevaVentana=window.open(URL, NombreVentana, Parametros); 
    
    return false  
}

function ValidarEnviarSugerencia(ObjetoPulsado)
{
    var DenInicio = ObjetoPulsado.id.substring(0, ObjetoPulsado.id.lastIndexOf("_") + 1)    
    var TextoNombre = document.getElementById(DenInicio + 'TxtNombre').value
    var TextoEmail = document.getElementById(DenInicio + 'TxtEmail').value
    var TextoSugerencia = document.getElementById(DenInicio + 'TxtSugerencia').value
    
    if (TextoNombre == "" || TextoEmail == "" || TextoSugerencia == "")
    {
        document.getElementById(DenInicio + 'LblValidarSugerencia').innerHTML = IdiomaTextosJS(0, 0) //"Se deben cumplimentar todos los campos."
        return false
    }
    else
    {
        var CaracterArroba = TextoEmail.indexOf("@")
        var CaracterPunto = TextoEmail.lastIndexOf(".")

        if (CaracterArroba == -1)
        {
            document.getElementById(DenInicio + 'LblValidarSugerencia').innerHTML = IdiomaTextosJS(0, 1) //"El Email no es correcto."
            return false
        }
        
        if (CaracterPunto == -1)
        {
            document.getElementById(DenInicio + 'LblValidarSugerencia').innerHTML = IdiomaTextosJS(0, 1) //"El Email no es correcto."
            return false
        }
        
        if (CaracterPunto < CaracterArroba)
        {
            document.getElementById(DenInicio + 'LblValidarSugerencia').innerHTML = IdiomaTextosJS(0, 1) //"El Email no es correcto."
            return false
        }
        
        return true
    }
}