$(document).ready (function(){
	if ($("body").attr("id") != "home"){
		$(window).load( function(){
			ReposTelaInt();
		}).resize( function(){
			ReposTelaInt();
		});
	}
	$("#menu a:last").css("marginRight",0);
    //alert('site ok');
	
	setInterval("RodaRSS()",8000);
	var total = $("#rssnot input.noticiat").size();
	$("#rssnot").append("<input type='hidden' id='rsstotal' name='rsstotal' value='" + total + "' /><input id='rssatual' type='hidden' name='rssatual' value='0' />");
	
});

function ConverterTexto(elem){
	var e = $(elem.parentNode.parentNode).prev().find("textarea").get(0);
	var v = e.value.replace(/\+/g,"§§§");
	$(e).val(v);
}

function RodaRSS(){
	var rsstotal = parseInt($("#rsstotal").val());
	var rssatual = parseInt($("#rssatual").val());
    
	rssatual++;
	if (rssatual >= rsstotal) rssatual = 0;
	$("#rssatual").val(String(rssatual));
    var link = $("#rsslink"+rssatual).val();
    var titulo = $("#rsstitulo"+rssatual).val();
	
	$("#rssnot .scroller").fadeOut(1000,function(){
        $("#rssplace").attr("href",link);
        $("#rssplace .noticia").text(titulo);
        $(this).fadeIn();
    });
}

function Receita(cont){
	$("#receitasinner").animate({scrollLeft:$("#receitasinner").scrollLeft()+(cont*215)},250);
}

function ReposTelaInt(){
	var telah = $(window).height();
	var conth = telah - 272;
	if (telah<600) conth = 328;
	
	if ($.browser.msie && parseInt($.browser.version)==6){
		$("#conteudoint").height(conth);
	} else {
		$("#conteudoint").css("minHeight", String(conth)+"px");
	}
}

function MudaHor(val){
	$("#conthor").html("carregando texto...");
	$("#imghor").attr("src","mestri/bancoarquivos/imagens/signos/"+val+".jpg");
	$.ajax({
		type: "GET",
		url: "mestri/funcoes/includes/hor.php",
		data: {signo:val},
		cache: false,
		success: function(obj){ 
			$("#conthor").html(obj);
			
		},
		error: function(obj, status, erro){
			alert("ERRO: " + obj.statusText);
		}

	});
}
