﻿// JScript File
function NuevoAjax(){
        var xmlhttp=false;
        try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
                try{
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(E){
                        xmlhttp = false;
                }
        }

        if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}

function Cargar(url){       
        var contenido, preloader;
        contenido = document.getElementById('contenido');
        preloader = document.getElementById('preloader');
        //creamos el objeto XMLHttpRequest
        ajax=NuevoAjax(); 
        //peticionamos los datos, le damos la url enviada desde el link
        ajax.open("GET", url,true); 
        ajax.onreadystatechange=function(){
                if(ajax.readyState==1){
                    //preloader.innerHTML = "Cargando...";
                    //modificamos el estilo de la div, mostrando una imagen de fondo
                    preloader.style.background = "url('images/loader32x32-blue.gif') no-repeat";     
                    
                    preloader.style.top= "10px"; 
                    preloader.style.left="10px";  
                    preloader.style.padding= "10px";
                    preloader.style.margin="10px";    
                    preloader.style.display="block";   
                    preloader.style.height="64px";
                    preloader.style.width="110px";                   
                    contenido.style.display = "none";
                }else if(ajax.readyState==4){
                        if(ajax.status==200){
                                //mostramos los datos dentro de la div
                                //contenido.innerHTML = ajax.responseText; 
                                //preloader.innerHTML = "Cargado...";                                
                                location.href = url;
                        }else if(ajax.status==404){
                                preloader.innerHTML = "La página no existe";
                        }else{
                                //mostramos el posible error
                                preloader.innerHTML = "Error:".ajax.status; 
                        }
                }
        }
        ajax.send(null);
}

 function ConfiguraModalPopupExtender(TargetControlID,titulo,descripcion)
    {
        var modal = $find('mpeNoticia1'); 
        modal.TargetControlID = TargetControlID;     
        document.getElementById('TituloNoticia').innerHTML = titulo;        
        document.getElementById('DescripcionNoticia').innerHTML = descripcion;
        modal.show();    
    }
    
 function EstableceVacanteID(VacanteID)
 {     
    document.getElementById('hIdVacante').value = VacanteID; 
    muestraDiv('pnlCurriculo');
 }
 
 function ocultaMuestra(idMostrar,idOcultar)
{   
    var divAMostrar = document.getElementById(idMostrar); 
        divAMostrar.style.display = (divAMostrar.style.display == 'none') ? 'block' : 'none';       
    var divAOcultar = document.getElementById(idOcultar); 
        divAOcultar.style.display = (divAOcultar.style.display == 'none') ? 'block' : 'none';         
}


                function ocultaDiv(id) 
{        
   if (document.getElementById) // DOM3 = IE5, NS6
   { 
        document.getElementById(id).style.display = 'none';
   }
   else 
   {
        if (document.layers) // Netscape 4
        { 
            document.id.display = 'none';
        }
        else // IE 4
        { 
            document.all.id.style.display = 'none';
        }
   }
}

function muestraDiv(id) 
{
    if (document.getElementById) 
    { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'block';
    }
    else 
    {
        if (document.layers) // Netscape 4
        { 
            document.id.display = 'block';
        }
        else // IE 4
        { 
         document.all.id.style.display = 'block';
        }
   }
}
