var scroller = null;
function loadScroller(){
	var el = document.getElementById("Scroller-1");
	scroller = new jsScroller(el, 220, 250);
}

function exibeResposta(elemento,fcJQuery,texto){
	$(elemento).empty();
	if (fcJQuery == 1){
		$(elemento).append(texto);
	}else{
		$(elemento).load(texto);
	}
}

function cadastraNewsLetter(){
	var nome = $("#edtNome").val();
	var email = $("#edtEmail").val();
	
	$.ajax({
		type: "POST",
		dataType: 'json',
		data: {nome: nome, email: email},
		url: "sgc/newsletter_adm_op.php",
		success: function(data){
			$("#respNewsLetter").show();
			exibeResposta(data.elemento,data.fcJQuery,data.texto);
			setTimeout("apagarRespostaNewsLetter()",3000);
		}
	});

}

function apagarRespostaNewsLetter(){
	$("#respNewsLetter").empty();
	$("#respNewsLetter").hide();
	$("#edtNome").val("");
	$("#edtEmail").val("");
}

function carregarMapa(valor){

	if(valor != ''){
		//$("#teste").html('<pre>'+valor+'<pre>');
		$.ajax({
			type: "POST",
			url: "inc_mapa.php",
			data: "endereco="+valor,
			success: function(resposta){
				//alert(resposta);
				$("#mapas").html(resposta);
				var newValor = valor.replace(/xyz/g, '&');
				//alert(valor.lengt);
				$("#linkAmpliar").attr("href", newValor);
			}
		});
	}
}

$(document).ready(function(){
	
	jQuery('a[rel*=facebox]').facebox();
	
	$("a.products").click(function(){
	
		//$(this).parent().parent().find('ul:first').slideToggle('fast');
		$("a.products").find("span").html("+");
		$(this).find("span").html("-");
		$("a.products").parent().find("ul").slideUp("slow");
		if ($(this).hasClass('active') == false){
			$(this).parent().find("ul:first").slideDown("slow");
			$(this).addClass('active');
		} else {
			$("a.products").removeClass('active');
			$("a.products").find("span").html("+");
		}
			
	})

})

function frmBusca(){
	if ($("#edtBusca").val() == ''){
	
		alert('Informe uma palavra para busca!');
		$("#edtBusca").focus();
		return false;
	
	}
	return true;
}