function gerarNoticias(pagina){	
	$.ajax({
            // Usando metodo Post
            type: 'POST',

            // this.action pega o script para onde vai ser enviado os dados
            url: './ajax/gera_noticias.php?random='+unique_requestid(),

            // os dados que pegamos com a função serialize()
            data: {pag: pagina},

            success: function(data){
				$("#noticias").html(unescape(data));
            },

            // Se acontecer algum erro é executada essa função
            error: function(txt){
                $('#noticias').html("");
            }
        })
	
	// efeito show na div
	$("#noticias").show("slow");
}

function mostrarNoticias(id){	
	$.ajax({
            // Usando metodo Post
            type: 'POST',

            // this.action pega o script para onde vai ser enviado os dados
            url: './ajax/mostra_noticias.php?random='+unique_requestid(),

            // os dados que pegamos com a função serialize()
            data: {idNoticia: id},

            success: function(data){
				$("#noticia").html(unescape(data));
            },

            // Se acontecer algum erro é executada essa função
            error: function(txt){
                $('#noticia').html("");
            }
        })
	
	// efeito show na div
	$("#noticia").show("slow");
}

function unique_requestid() {
	var timestamp = Number(new Date()).toString();
	var random = Math.random() * (Math.random() * 100000 * Math.random() );
	var unique = new String();
	unique = timestamp + random;
	return unique;
}