var raiz;
$(function(){
	$(".topo").click(function(evt){
		$("body").stop().scrollTo({top:0,left:0}, 500);
		evt.preventDefault();
	});

	$('a[rel="external"]').click(function(){
		window.open($(this).attr('href'));
		return false;
	});

	// MENU DESLIZANTE
	if (!$(".secProfissional .menuDesl")[0]) {
		$(".menuDesl dt.ativo").next().show();
		$(".menuDesl > dd").hide();
		$(".menuDesl dt.ativo").next().show();
		$(".menuDesl dt > a").click(function(){
			var vt= $(this);
			if(!$(this).parent().hasClass("ativo")) {
				$(".menuDesl > dd").slideUp(function(){
					$(this).prev().removeClass("ativo");
				});
				$(this).parent().addClass("ativo").next().slideDown(function(){
					$.scrollTo(vt, 300);
				});
			} else {
				$(vt).parent().next("dd").slideUp(function(){
					$(vt).parent().removeClass("ativo");
				})
			}
		})

		//abre o item em que o id é passado como ancora
		var href = location.href;
		if(href.indexOf("#") > 0){
			var arrHref = href.split('#');
			$("#"+arrHref[1]+"").click();
		}
	}

	// IMG zoom nas imagens
	if (raiz == "home"){raiz="_img"}else{raiz="../_img"}
	$("a[rel!=external]").each(function(){
		if($(this).attr("rel") != ""){
			$(this).css({"display" : "block", "position" : "relative"}).prepend("<img src='"+raiz+"/bg_detalhe_zoom.png' style='position:absolute;right:0;bottom:0' alt='zoom' />");
		}
	});
	
	// ALTERNANDO OS PARCEIROS
	$(".altParceiros").jCarouselLite({
		visible: 1,
		start: 0,
		auto: 4000,
		speed: 2000,
		easing: "expoout"
	});
})
