function listarnoticias(idsecc){
    var rnd = Math.random()*11;
    
    var f = new Date();
    var anio = f.getFullYear();
    var mess = f.getMonth();
    var mes = eval(mess)+1
    if (mes<10) {
        var meses= 0+""+mes;
    } else {
        var meses = mes;
    }
    var dia = f.getDate();
    if (dia<10) {
        var dias= 0+""+dia;
    } else {
        var dias = dia;
    }
    var fechas = anio+""+meses+""+dias;
    
    
       
    document.getElementById("ultnoticias").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Cargando...</td></tr></table>";
    $.post("listanoticias.php",{
        rnd:rnd,fechas:fechas,idsecc:idsecc
        
    },
    function(data){
        $("#ultnoticias").html(data);
    });
}


function listarnoticiasx(){
    var rnd = Math.random()*11;

    var f = new Date();
    var anio = f.getFullYear();
    var mess = f.getMonth();
    var mes = eval(mess)+1
    if (mes<10) {
        var meses= 0+""+mes;
    } else {
        var meses = mes;
    }
    var dia = f.getDate();
    if (dia<10) {
        var dias= 0+""+dia;
    } else {
        var dias = dia;
    }
    var fechas = anio+""+meses+""+dias;

    document.getElementById("ultnoticias").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Cargando...</td></tr></table>";
    $.post("listanoticiasx.php",{
        rnd:rnd,fechas:fechas

    },
    function(data){
        $("#ultnoticias").html(data);
    });
}

//$(function(){
//    $('#datepicker').datepicker({inline: true,
//        onSelect: function(date) {                
//            $.get("edicionesanteriores.php", {fechas:date}, function(data){
//            $("#contenido").html(data);
//            });
//        }
//    });
//});

$(function(){
    $('#datepicker').datepicker({inline: true,
        onSelect: function(date) {
            var fechas = date;
            location.href="ediciones-anteriores-"+fechas+"";
        }
    });
});

function imprSelecx(cuerpo)
{
  var ficha = document.getElementById(cuerpo);
  document.getElementById('parte1').style.visibility = "hidden";
  document.getElementById('comentarios').style.visibility = "hidden";
  var ventimp = window.open(' ', 'popimpr');
  ventimp.document.write( ficha.innerHTML );
  ventimp.document.close();  
  ventimp.print( );
  document.getElementById('parte1').style.visibility = "visible";
  document.getElementById('comentarios').style.visibility = "visible";
  ventimp.close();
}

function verpelicula(nidpeliculas){
    var rnd = Math.random()*11;
    document.getElementById("peli").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Cargando...</td></tr></table>";
    $.post("verpelicula.php",{rnd:rnd,nidpeliculas:nidpeliculas},
        function(data){
            $("#peli").html(data);
        });
}

function veryoutube(nidyoutube){
    var rnd = Math.random()*11;
    document.getElementById("youtube").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Cargando...</td></tr></table>";
    $.post("veryoutube.php",{rnd:rnd,nidyoutube:nidyoutube},
        function(data){
            $("#youtube").html(data);
        });
}

function respuestas(nid){
    var rnd = Math.random()*11;
    document.getElementById("resultado").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Cargando...</td></tr></table>";
    $.post("respuestas.php",{rnd:rnd,nid:nid},
        function(data){
            $("#resultado").html(data);
        });
}

function votar(nid){
    var rnd = Math.random()*11;
    var ip = $("#ip").val();
    var opciones = $("input[@name='opciones']:checked").val();    
    if (opciones==null){
        alert("Seleccione una respuesta");
    }else{
    document.getElementById("resultado").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Espere un momento por favor...</td></tr></table>";
    $.post("resultado.php",{rnd:rnd,opciones:opciones,ip:ip,nid:nid},
        function(data){
            $("#resultado").html(data);
        });
}}

function verresultado(nid){
    var rnd = Math.random()*11;    
    document.getElementById("resultado").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Espere un momento por favor...</td></tr></table>";
    $.post("verresultado.php",{rnd:rnd,nid:nid},
        function(data){
            $("#resultado").html(data);
        });
}

function volver(nid){
    var rnd = Math.random()*11;    
    document.getElementById("resultado").innerHTML = "<table><tr><td><img src='cargando.gif' width='25px' height='25px' align='middle' /></td><td>Espere un momento por favor...</td></tr></table>";
    $.post("encuesta.php",{rnd:rnd,nid:nid},
        function(data){
            $("#resultado").html(data);
        });
}
