﻿//Última actualización de la página Web
function UltimaActualizacion() {
var fecha = new Date( document.lastModified )
document.write("<div class='fechaUltima'>&Uacute;ltima actualizaci&oacute;n del portal: ")
var hrs=fecha.getHours();
hrs -= 5;
var res= fecha.setHours(hrs)
MostrarFecha( fecha)
document.write("</div>")
}


function UltimaActualizacionEnglish() {
var fecha = new Date( document.lastModified )
document.write("<div class='fechaUltima'>Last update: ")
var hrs=fecha.getHours();
hrs -= 5;
var res= fecha.setHours(hrs)
MostrarFechaEnglish( fecha)
document.write("</div>")
}

function MostrarFechaEnglish( fecha ) {
var nombres_dias = new Array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday")
var nombres_meses = new Array("january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december")

var dia_mes = fecha.getDate()	//dia del mes
var dia_semana = fecha.getDay()	//dia de la semana
var mes = fecha.getMonth() + 1
var anio = fecha.getFullYear()	//año de 4 digitos
//escribe en pagina
document.write(nombres_dias[dia_semana] + ", " + dia_mes + " " + nombres_meses[mes - 1] + " " + anio)
}


function MostrarFecha( fecha ) {
var nombres_dias = new Array("domingo", "lunes", "martes", "mi&eacute;rcoles", "jueves", "viernes", "s&aacute;bado")
var nombres_meses = new Array("enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre")

var dia_mes = fecha.getDate()	//dia del mes
var dia_semana = fecha.getDay()	//dia de la semana
var mes = fecha.getMonth() + 1
var anio = fecha.getFullYear()	//año de 4 digitos
//escribe en pagina
document.write(nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio)
}
//Fin última actualización de la página Web

//Mostrar fecha actual

function MostrarFechaActual(){
var nombres_dias = new Array("s&aacute;bado", "Lunes", "Martes", "Mi&eacute;rcoles", "Jueves", "Viernes", "S&aacute;bado")
var nombres_meses = new Array("enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre")
var fecha_actual = new Date()
dia_mes = fecha_actual.getDate()		//dia del mes
dia_semana = fecha_actual.getDay()		//dia de la semana
mes = fecha_actual.getMonth() + 1
anio = fecha_actual.getFullYear()
//escribe en pagina
document.write("<div class='fechaActual'>")
document.write(nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio)
document.write("</div>")
}

//Fin fecha actual


function cargaContenidoInf(parametro){
if(parametro==1){
document.getElementById('tabInf1').className='tabInfOn1';
document.getElementById('tabInf2').className='tabInfOff2';
document.getElementById('tabInf3').className='tabInfOff3';
document.getElementById('tabInf4').className='tabInfOff4';
document.getElementById('div_contenido1').style.display = '';
document.getElementById('div_contenido2').style.display = 'none';
document.getElementById('div_contenido3').style.display = 'none';
document.getElementById('div_contenido4').style.display = 'none';
}
if(parametro==2){
document.getElementById('tabInf1').className='tabInfOff1';
document.getElementById('tabInf2').className='tabInfOn2';
document.getElementById('tabInf3').className='tabInfOff3';
document.getElementById('tabInf4').className='tabInfOff4';
document.getElementById('div_contenido1').style.display = 'none';
document.getElementById('div_contenido2').style.display = '';
document.getElementById('div_contenido3').style.display = 'none';
document.getElementById('div_contenido4').style.display = 'none';
}
if(parametro==3){
document.getElementById('tabInf1').className='tabInfOff1';
document.getElementById('tabInf2').className='tabInfOff2';
document.getElementById('tabInf3').className='tabInfOn3';
document.getElementById('tabInf4').className='tabInfOff4';
document.getElementById('div_contenido1').style.display = 'none';
document.getElementById('div_contenido2').style.display = 'none';
document.getElementById('div_contenido3').style.display = '';
document.getElementById('div_contenido4').style.display = 'none';
}
if(parametro==4){
document.getElementById('tabInf1').className='tabInfOff1';
document.getElementById('tabInf2').className='tabInfOff2';
document.getElementById('tabInf3').className='tabInfOff3';
document.getElementById('tabInf4').className='tabInfOn4';
document.getElementById('div_contenido1').style.display = 'none';
document.getElementById('div_contenido2').style.display = 'none';
document.getElementById('div_contenido3').style.display = 'none';
document.getElementById('div_contenido4').style.display = '';
}
// Cambio el estado de la pestaña que se ha clickeado a activo
this.className='tabInfOn';
}


function OpenDialog(url, ext) {

if(ext!="Sí"){
    var options = SP.UI.$create_DialogOptions();
    url = url.replace("http://www.minproteccionsocial.gov.co", "");
    url = url.replace("/videoAudio", "");
    options.url = "/videoAudio" + url;
    //options.width = 700;
    //options.height = 620;
    SP.UI.ModalDialog.showModalDialog(options);
    }else{
    var options = SP.UI.$create_DialogOptions();
    options.url = url;
    SP.UI.ModalDialog.showModalDialog(options);
    }
}
// Dialog callback
function CloseCallback(result, target) {
    if (result === SP.UI.DialogResult.OK) 
    {
        var ruta = getQueryVariable('idItem');
        ruta = ruta.split("/");
        top.location = "http://" + ruta[2];
    }
    if (result === SP.UI.DialogResult.cancel) 
    {
        var ruta = getQueryVariable('idItem');
        ruta = ruta.split("/");
        top.location = "http://" + ruta[2];
    }
}

function zoomText(accion){
var obj=document.getElementById('bodySite');
var menu=document.getElementById('menuVerdeSup');
if( accion=="reestablecer" ){
obj.style.fontSize="1em";
menu.style.fontSize="1em";
}else if( accion=="aumentar" ){
obj.style.fontSize="1.2em";
menu.style.fontSize="0.83em";
}else if( accion=="disminuir" ){
obj.style.fontSize="0.8em";
menu.style.fontSize="1em";
}
}


function buscar(){
var bus=document.getElementById('txtBuscar');
if(bus.value!=""){
window.location.href='/buscar/Results.aspx?k='+ bus.value;
}else{
alert("Ingrese una palabra para realizar la búsqueda")
}
}







