
function oShopping(pagina, descricao){

	$("#carregando").show();
	//consulta ajax
	$.get("ajax/ajaxOShopping.php",{pagina:pagina}, function(data){		



		destaque = "<li class=\"active\"> <a  style=\"cursor:pointer;\" onclick=\"oShopping('"+pagina+"', '"+descricao+"');\" title=\""+descricao+"\">"+descricao+"</a></li>";				
		
		apresentacao = '<li><a style="cursor:pointer;" onclick="oShopping(\'apresentacao\', \'Apresenta&ccedil;&atilde;o\');" title="Apresenta&ccedil;&atilde;o">Apresenta&ccedil;&atilde;o</a></li>';
		infra = '<li><a  style="cursor:pointer;" onclick="oShopping(\'infra-estrutura\', \'Infra-Estrutura\');" title="Infra-Estrutura">/ Infra-Estrutura</a></li>';
		servicos = '<li><a  style="cursor:pointer;" onclick="oShopping(\'servicos\', \'Servi&ccedil;os\');" title="Servi&ccedil;os">/ Servi&ccedil;os</a></li>';
		imprensa = '<li><a  style="cursor:pointer;" onclick="oShopping(\'imprensa\', \'Imprensa\');" title="Imprensa">/ Imprensa</a></li>';
		chegar = '<li><a  style="cursor:pointer;" onclick="oShopping(\'como-chegar\', \'Como Chegar\');" title="Como Chegar">/ Como Chegar</a></li>';
		cartao = '<li><a  style="cursor:pointer;" onclick="oShopping(\'cartao-estacionamento\', \'Cart&atilde;o de <br>Estacionamento\');" title="Cart&atilde;o de Estacionamento">/ Cart&atilde;o de Estacionamento</a></li>';		
		
		
		
		htmlDestaque = '<ul class="o-shopping">';		
		
		htmlDestaque += destaque;
		
		if(pagina != 'apresentacao')
			htmlDestaque += apresentacao;
		
		if(pagina != 'infra-estrutura')
			htmlDestaque += infra;
		
		if(pagina != 'servicos')
			htmlDestaque += servicos;
		
		if(pagina != 'imprensa')
			htmlDestaque += imprensa;
		
		if(pagina != 'como-chegar')
			htmlDestaque += chegar;
		
		if(pagina != 'cartao-estacionamento')
			htmlDestaque += cartao;			
	
		htmlDestaque += '</ul>';


		$("#opSelected").html(htmlDestaque);
		
		aplicaStyle();
		
		$("#ajaxOShopping").html(data);				
		$("#carregando").hide();	
	});
		
}


function pagina(pagina, complemento){	 

	//consulta ajax
	$.get("ajax/ajaxPagina.php"+complemento, {n:pagina}, function(data){		
				
		$("#ajaxCorpo").html(resultPagina);				
	});

}


//Carrega notícia
function carregaNoticia(id){
		
	$("#carregando").show();		
	//consulta ajax
	$.post("ajax/noticiaAjax.php", {id:id}, function(data){
		
		$("#carregando").hide();		
		//insere os dados
		$("#noticiaAjax").html(data);		
	});
}

//Carrega evento
function carregaEvento(id, patiuDe){

	// carrega evento no campo principal
	$("#carregando").show();			
	$.post("ajax/eventoAjax.php", {id:id, op:'principal'}, function(data){
		
		$("#carregando").hide();		
		//insere os dados
		$("#eventoAjax").html(data);		
	});

	// carrega eventos ma lateral
	if(patiuDe != 'lateral'){
		$("#carregandoLateral").show();		
		$.post("ajax/eventoAjax.php", {id:id, op:'lateral'}, function(data){			

				$("#carregandoLateral").hide();		
			//insere os dados
			$("#lateralAjax").html(data);		
		});
	}
}

// Carrega Loja
function carregaLoja(id, op){
 

	if(op == 'lojas'){
		
		$("#opSegmento").addClass("segmento");
		$("#opSegmento").removeClass("segmento-active");		
		
		$("#opLoja").addClass("alfabetica-active");
		$("#opLoja").removeClass("alfabetica");				
	}else		
	if(op == 'segmentos'){

		$("#opLoja").addClass("alfabetica");
		$("#opLoja").removeClass("alfabetica-active");		
		
		$("#opSegmento").addClass("segmento-active");
		$("#opSegmento").removeClass("segmento");				
	}	

	
	$("#carregando").show();		
	//consulta ajax
	$.get("ajax/lojaAjax.php", {cod:id, op:op}, function(data){
		
		$("#carregando").hide();		
		//insere os dados
		$("#lojaAjax").html(data);		
	});

}

//Enviando Newsletter
function cadastraNewsletter(obj){

	if(obj.email.value.search('@') == -1 || obj.email.value == '')
			alert('E-mail invalido!');
	else{	
			$("#carregandoCadNews").show();		
			$.post("ajax/newsletter.php", {email:obj.email.value}, function(data){		

				email:obj.email.value='';
				$("#carregandoCadNews").hide();				
				
				if(data == 1)
						alert('Seu contato foi cadastrado com sucesso!');
					else
						alert('Nao foi possivel cadastrar seu contato, por favor tente mais tarde!');			
			});
	}
}





