var homejs = {

	'vars' : {'curPage' : 1, 'lastpage' : 0}, //Variables

	'setArrows' : function() { //Fijar la posición de las flechas y eventos
	
		var baset = $("#pagtophome").offset();
		$(".comentarrows").css({"left":(baset.left+930)+"px", "top":"505px", "z-index":5, "display":"block"});
		
		$("#comentbtiz > img").hover(function() {
				$(this).attr("src", $(this).attr("src").replace('_off','_on'));
			},
			function() {
				$(this).attr("src", $(this).attr("src").replace('_on','_off'));
			}
		)
		.click(function() {
		
			homejs.vars['curPage'] = homejs.vars['curPage'] - 1 < 1 ? homejs.vars['lastpage'] : homejs.vars['curPage'] - 1;
			homejs.loadComent();
		
		});
		
		$("#comentbtder > img").hover(function() {
				$(this).attr("src", $(this).attr("src").replace('_off','_on'));
			},
			function() {
				$(this).attr("src", $(this).attr("src").replace('_on','_off'));
			}
		)
		.click(function() {
		
			homejs.vars['curPage'] = homejs.vars['curPage'] + 1 > homejs.vars['lastpage'] ? 1 : homejs.vars['curPage'] + 1;
			homejs.loadComent();
		
		});

	},
	
	'loadComent' : function() { //Cargar una noticia nueva
	
			$.get(thisPage, {"accion":"getComent", "page": homejs.vars['curPage']}, function(data) {
			
				$(".scroll-pane p").html("<img src='images/ajax-loader_lt.gif' align='center' style='margin:60px 0 0 105px' alt='' />");		
			
				var thehtml = '<span class="openquot"><img src="images/home_coment_openquotes.gif" alt="" /></span> '+data.opinion+' <span><img src="images/home_coment_closequotes.gif" class="closequot" alt="" /></span><br /><br /><span class="cftxblue4 fnt15">'+data.autor+'</span><br /><span class="cftxblue4 fnt15">'+data.hotel+'</span>';

				$(".scroll-pane p").html(thehtml);
				
			
			
			}, "json");
			
	}

}
