// JavaScript Document
$(document).ready(function() {
	$("a[rel^='prettyPhoto']").prettyPhoto();
	$(".expandRecoil").click(function(){
		if($(this).hasClass('closed')){
			$(this).removeClass('closed');
			$(this).addClass('opened');
			$(this).parent('.formAtendimento').children('.hiddenForm').show('fast');
		}else{
			$(this).removeClass('opened');
			$(this).addClass('closed');
			$(this).parent('.formAtendimento').children('.hiddenForm').hide('fast');
		}
	});
	$('.logoCorpClick').click(function(){
		texto = $(this).attr('hide');
		imagem = $(this).children('img').attr('src');
		$('.logoCorp img').attr('src',imagem);
		$('.contentCorp').html(texto);
	});
	$('.moreMoreMORE').click(function(){
			page = $(this).attr('page');
			page = parseInt(page);
			way = $(this).attr('way');
			ajax = bodyContent = $.ajax({
													url: way,
													type: "POST",
													data: 'ajax_parameter_news='+page,
													dataType: "html",
													async:false
												}
											).responseText;
			if(ajax!="vazio"){
			$('.midleMaker').html($('.midleMaker').html()+ajax);
			page++;
			$(this).attr('page',page);
			}else{
				$(this).fadeOut('slow');
			}
		
		});
		$('.streetView').click(function(){
			$('.streetViewStage').toggle();
			$('.streetViewStage').html($('.streetViewStage').html());
		});
		autoTroca(1);
});
$(function() {

	// initialize scrollable
	$(".scrollable").scrollable({ circular: true});

});
function trocaBanner(alvo) {
	$(alvo).parent().parent().children('li').removeClass('ativo');
	$(alvo).parent('li').addClass('ativo');
	ver = "#banner_"+$(alvo).html();
	$("#banner_1").hide();
	$("#banner_2").hide();
	$("#banner_3").hide();
	$(ver).show();
}
function trocaBannerAuto(alvo) {
	li = '#ba'+alvo;
	$('#bannerMenu li').removeClass('ativo');
	$(li).addClass('ativo');
	ver = "#banner_"+alvo;
	$("#banner_1").hide();
	$("#banner_2").hide();
	$("#banner_3").hide();
	$(ver).show();
}
function autoTroca(i){
	trocaBannerAuto(i);
	i++;
	if(i>3){
		i=1;
	}
	comando ='autoTroca('+i+')';
	setTimeout(comando,5000);
}
function getMeTo(alvo){
	caminho = alvo.value;
	caminho = caminho.replace('http://','');
	window.open('http://'+caminho);
}
