// JavaScript Document

$().ready(function(){
	$("#tapa_ventana_inicial").hide();
	//get_post_x_categoria();
	
	//OnClick Consulta
	$(".dejarConsulta").click(function (){
		if ($("#user_login").val() == 1){
			/*mostrar_tapa();
			scrollTo(0,0);
			centrar_ventana(".boxConsulta");
			$("#formularioConsulta").fadeIn("show");
			//HACER FOCO EN EL PRIMER TEXT
			document.getElementById('sen_nombre_consulta').focus();*/
			carga_pagina("formularioConsulta.php","#formularioConsulta",'get',0,"");
		} else {
			mostrar_alerta("Debes estar logueado para poder enviar tu consulta.",0);	
		}
	});
	
	//OnClick Proximamente
	/*$(".pasos").click(function (){
		mostrar_tapa();
		$("#formularioProximamente").fadeIn("show");
	});*/
})


function get_post_x_categoria(){
	$.ajax({
		url: config['path_internas_regional']+"/comunidad_posts.php",
		dataType: "xml",
		type: "POST",
		data: {cat_id:""},
		success:function envia_datos(xml){
			var cadena_arr = new Array();
			$('post',xml).each(function(i) {
				$("#titulo_"+(i+1)).html($(this).find("titulo").text());
				$("#titulo_"+(i+1)).attr({href:config['root_blogs']+lng+"/?p="+$(this).attr("id"),target:"_blank"});
				$("#contenido_"+(i+1)).html($(this).find("contenido").text());
				$("#comentarios_"+(i+1)).html($(this).find("cant_comentarios").text());
			})
		},
		error:function manejo_error(error,err){
			//mostrar_alerta("Error al cargar la informaci&oacute;n.",0);
		}
	});
}
