function ContaCaracteres(Campo, QtdMaxima) {
	QtdMaxima = parseInt(QtdMaxima);
	if($('#CONTA_CARACTERES_'+Campo).size() > 0) {
		if($('#'+Campo).val().length > QtdMaxima) {
			$('#CONTA_CARACTERES_'+Campo).html(0);
			$('#'+Campo).val($('#'+Campo).val().substring(0, QtdMaxima));
			alert('O número de caracteres permitidos foi ultrapassado.');
		} else {
			var qtd = (QtdMaxima - $('#'+Campo).val().length);
			$('#CONTA_CARACTERES_'+Campo).html(qtd);
		}
		
	}
}
function CarregaFotoCapaGaleria(Galeria, Src) {
	var QtdFotos = parseInt($('#Galeria_'+Galeria+'_QtdFotos').val());
	if(QtdFotos > 9) {
		var i = 9;
		for(i=9; i<=QtdFotos; i++) {
			CarregaThumbGaleria(Galeria, i);
		}
	}	

	$("#BackgroundImageLoader_"+Galeria).image(Src,function(){		

		$("#DivFotoSelecionada_Galeria_"+Galeria).removeClass('GaleriaImageLoading');

		$("#FotoSelecionada_Galeria_"+Galeria).attr('src', Src);

		$("#FotoSelecionada_Galeria_"+Galeria).fadeIn();
		
		

	},function(e){ });		

}

function CarregaThumbGaleria(Galeria, Posicao, QtdLoop) {

	if($("#Galeria_"+Galeria+"_Thumb_"+Posicao)) {

		if($("#Galeria_"+Galeria+"_Thumbsrc_"+Posicao+":visible")) {

			var Src = $("#Galeria_"+Galeria+"_Thumb_"+Posicao).val();

			$("#BackgroundImageLoader_"+Galeria+"_Thumb_"+Posicao).image(Src,function(){		

				$("#Div_"+Galeria+"_Thumb_"+Posicao).removeClass('GaleriaImageLoading');

				$("#Galeria_"+Galeria+"_Thumbsrc_"+Posicao).attr('src', Src);

				$("#Galeria_"+Galeria+"_Thumbsrc_"+Posicao).fadeIn();

			},function(e){ });	

			if(QtdLoop && QtdLoop != 0) {

				QtdLoop--;

				Posicao++;

				CarregaThumbGaleria(Galeria, Posicao, QtdLoop);

			}			

		}

	}

}

function GaleriaSalvarFoto(Galeria) {



}

function SelecionaFotoGaleria(Galeria, Posicao, Url, Prev, Next) {

	//document.getElementById('FotoSelecionada_Galeria_'+Galeria+'_'+Posicao).src = Url;

	//var i=Posicao;

	//while(i<(Posicao+6)) {

	//	CarregaThumbGaleria(Galeria, i);

	//	i++;

	//}

	//CarregaThumbGaleria(Galeria, Posicao, 5);

	$("#Galeria_"+Galeria+"_Posicao").val(Posicao);

	$('.Download_Galeria_'+Galeria).attr("href", "php/foto_download.php?Galeria="+Galeria+"&Arquivo="+Url);

	var QtdFotos = parseInt($('#Galeria_'+Galeria+'_QtdFotos').val());

	var api = $("#Galeria_"+Galeria+"_scrollable").data("scrollable");

	/*if(Prev == 1) {

		api.move(-1);

	} else if(Next == 1) {

		api.move(1);

	}*/

	if(QtdFotos > 4) {

		if(Posicao > 0) {

			var Pagina = Posicao / 5;

			Paginax = Pagina+"";

			if(Paginax.indexOf(".") != -1) {

				var Split = Paginax.split(".");

				Pagina = parseInt(Split[0]);

			} else {

				//CarregaThumbGaleria(Galeria, (Pagina*5), 10);				

			}

			Pagina++;

			var PosicaoPagina = (Pagina*5)-5;	

		} else if(Posicao == 0) {

			var PosicaoPagina = 0;

		}

		api.seekTo(PosicaoPagina);			

				

	} else {

		//api.seekTo(Posicao,1);

	}

	$('.li_Galeria_'+Galeria).removeClass('ThumbGaleriaActive');

	$('.li_Galeria_'+Galeria+'_'+Posicao).addClass('ThumbGaleriaActive');

	$('#NumeroFotoSelecionada_'+Galeria).html(Posicao+1);

	var FotosCarregadas = $('#Galeria_'+Galeria+'_FotosCarregadas').val();

	if(FotosCarregadas.indexOf("|"+Posicao+"|") != -1) {

		$('#FotoSelecionada_Galeria_'+Galeria).attr('src', Url);	

	} else {

		$('#FotoSelecionada_Galeria_'+Galeria).hide();

		$('#DivFotoSelecionada_Galeria_'+Galeria).addClass('GaleriaImageLoading');

		$('#FotoSelecionada_Galeria_'+Galeria).attr('src', Url);

		$("#BackgroundImageLoader").image(Url,function(){	

			FotosCarregadas += Posicao+"|";

			$('#Galeria_'+Galeria+'_FotosCarregadas').val(FotosCarregadas);			

			$('#DivFotoSelecionada_Galeria_'+Galeria).removeClass('GaleriaImageLoading');

			$('#FotoSelecionada_Galeria_'+Galeria).attr('src', Url);

			$('#FotoSelecionada_Galeria_'+Galeria).fadeIn();	

		},function(e){

		});	

		

	}

	

	

	

	$('#Legendas_Galeria_'+Galeria).hide();

	$('.Legenda_Galeria_'+Galeria).hide();

	var LegendaHtml = $('#Legenda_Galeria_'+Galeria+'_'+Posicao).html();

	if(LegendaHtml != "" && LegendaHtml != "legenda" && LegendaHtml != "Legenda") {

		$('#Legenda_Galeria_'+Galeria+'_'+Posicao).show();

		$('#Legendas_Galeria_'+Galeria).fadeIn('slow');

	}

	

	

}

function MovePrevGaleria(Galeria) {

	

	var QtdFotos = parseInt($('#Galeria_'+Galeria+'_QtdFotos').val());

	if(QtdFotos > 4) {

		var Posicao = $("#Galeria_"+Galeria+"_Posicao").val();

		if(Posicao != 0) {

			Posicao--;

			var Url = $("#Galeria_"+Galeria+"_Foto_"+Posicao).val();

			SelecionaFotoGaleria(Galeria, Posicao, Url,1,0);	

		}		

	} else {

		var Posicao = $("#Galeria_"+Galeria+"_Posicao").val();

		if(Posicao == 0) {

			Posicao = parseInt($('#Galeria_'+Galeria+'_QtdFotos').val());

		} else {

			Posicao--;

		}

		var Url = $("#Galeria_"+Galeria+"_Foto_"+Posicao).val();

		SelecionaFotoGaleria(Galeria, Posicao, Url);		

	}

	

}

function MoveNextGaleria(Galeria) {

	var Posicao = $("#Galeria_"+Galeria+"_Posicao").val();

	if(Posicao != $('#Galeria_'+Galeria+'_QtdFotos').val()) {

		if(Posicao == parseInt($('#Galeria_'+Galeria+'_QtdFotos').val())) {

			Posicao = 0;

		} else {

			Posicao++;

		}

		var Url = $("#Galeria_"+Galeria+"_Foto_"+Posicao).val();

		SelecionaFotoGaleria(Galeria, Posicao, Url,0,1);

	}

}

function MovePrevPageGaleria(Galeria) {

	var QtdFotos = parseInt($('#Galeria_'+Galeria+'_QtdFotos').val());

	if(QtdFotos > 4) {	

		var api = $("#Galeria_"+Galeria+"_scrollable").data("scrollable");

		api.move(-5);

	} else {

		MovePrevGaleria(Galeria);

	}

}

function MoveNextPageGaleria(Galeria) {

	var QtdFotos = parseInt($('#Galeria_'+Galeria+'_QtdFotos').val());

	if(QtdFotos > 4) {

		var api = $("#Galeria_"+Galeria+"_scrollable").data("scrollable");

		var Index = api.getIndex()+5;

		//var i=Index;

		//while(i<(Index+5)) {

		//	CarregaThumbGaleria(Galeria, i);

		//	i++;

		//}				

		api.move(5);

		//CarregaThumbGaleria(Galeria, Index, 10);

	} else {

		MoveNextGaleria(Galeria);

	}		

}

function IsIe() {

	try {

		var isIE = (navigator.appName=="Microsoft Internet Explorer");

		var IEversion = navigator.appVersion;

		if(isIE) {

			IEversion = parseInt(IEversion.substr(IEversion.indexOf("MSIE")+4));

		} else {

			IEversion = 0;

		}

		return IEversion;		

	} catch(err) {

		return 0;		

	}	

	//if(isIE == true) {

	//	alert("isIE=" + isIE + ", version=" + IEversion);

	//}

}

function selecionaCategoriaServico(Categoria) {

	document.getElementById("CategoriaServico").value = Categoria;

	document.getElementById("TextoPesquisa").value = "";

	Buscar(13,1);	

}
function loadBanner(tipoBanner) {
	if($("#Banners"+tipoBanner).size() > 0) {
		$("#Banner"+tipoBanner+"Loader").html('');
		var bannerIndex = parseInt($("#Banner"+tipoBanner+"Index").val());
		var bannerOldIndex = parseInt($("#Banner"+tipoBanner+"OldIndex").val());
		var countBanners = parseInt($("#CountBanners"+tipoBanner).val());
	
		if(bannerIndex == countBanners) { bannerIndex = 0; }
		if(bannerIndex == 0) { bannerOldIndex = countBanners - 1; } else { bannerOldIndex = bannerIndex - 1; }
		var bannerPath = $('#Banner'+tipoBanner+bannerIndex+"Path").val();
		if(bannerPath.indexOf('.swf') != -1) {
			$('#Banner'+tipoBanner+bannerOldIndex).hide();
			$('#Banner'+tipoBanner+bannerIndex).show();
			bannerIndex++;
			$("#Banner"+tipoBanner+"Index").val(bannerIndex);
			if(countBanners > 1) {
				setTimeout("loadBanner('"+tipoBanner+"')", 5000);
			}
		} else {
			$("#Banner"+tipoBanner+"Loader").image(bannerPath,function(){
				$('#Banner'+tipoBanner+bannerIndex+' img').attr('src', bannerPath);
				$('#Banner'+tipoBanner+bannerOldIndex).hide();
				$('#Banner'+tipoBanner+bannerIndex).show();
				bannerIndex++;
				$("#Banner"+tipoBanner+"Index").val(bannerIndex);
				if(countBanners > 1) {
					setTimeout("loadBanner('"+tipoBanner+"')", 5000);
				}
			},function(e){
				alert(e);
			});
		}
	}
}

function UpdateHeights() {

	/*var Faz = 0;

	var Refaz = 0;

	var Conteudo = "";

	var HeightBusca = 0;

	

	if(document.getElementById("ConteudoBusca")) {

		if(document.getElementById("ConteudoPaginaRight")) {

			if($('#ConteudoBusca').outerHeight() > $('#ConteudoPaginaRight').outerHeight()) {

				HeightBusca = $('#ConteudoBusca').outerHeight()+$('#DivBusca').outerHeight()+200;

			} else {

				HeightBusca = $('#ConteudoPaginaRight').outerHeight()+$('#DivBusca').outerHeight()+200;

			}

		} else {

			HeightBusca = $('#ConteudoBusca').outerHeight()+$('#DivBusca').outerHeight()+200;

		}

		if(HeightBusca != $('#Conteudo').outerHeight()) {

			$('#Conteudo').css("height", HeightBusca+"px");

			Refaz = 1;

		}

	}

	if($('#Conteudo').outerHeight() != $('#MenuRepeat').outerHeight()) {



		var heightConteudo = $('#Conteudo').outerHeight()+"px";

		heightConteudo = heightConteudo.replace("px", "");

		heightConteudo = parseInt(heightConteudo);



		var heightMenu = $('#MenuRepeat').outerHeight()+"px";

		heightMenu = heightMenu.replace("px", "");

		heightMenu = parseInt(heightMenu);

		var FinalHeight;

		if(heightConteudo > heightMenu) {

			FinalHeight = heightConteudo;

			$('#MenuRepeat').css("height", heightConteudo+"px");

		} else if(heightConteudo < heightMenu) {

			FinalHeight = heightMenu;

			$('#Conteudo').css("height", heightMenu+"px");

		} else {

			FinalHeight = heightMenu;

		}

		//$('#RodapeMasterDiv').css("margin-top",$('#MenuRepeat').outerHeight()+20);

		$('#RodapeMasterDiv').css("margin-top",FinalHeight+20);

		//alert("Finalheight: "+FinalHeight+"\n\nConteudo: "+$('#Conteudo').outerHeight()+"\n\nMenu: "+$('#MenuRepeat').outerHeight());		

		if($('#Conteudo').outerHeight() != $('#MenuRepeat').outerHeight()) {

			Refaz = 1;																																		 

		}

	}	

	

	if(document.getElementById("ConcursoLeft")) {

		if($('#ConcursoLeft').outerHeight() != ($('#ConcursoRight').outerHeight()+20)) {

			var ConcursoRight = $('#ConcursoRight').outerHeight()+"px";	

			ConcursoRight = ConcursoRight.replace("px", "");

			ConcursoRight = parseInt(ConcursoRight);

			

			$('#ConcursoLeft').css("height", ConcursoRight+20+"px");

			if($('#ConcursoLeft').height() != ($('#ConcursoRight').outerHeight()+20)) {

				Refaz = 1;																																			 

			}

		}

	}

	if(Refaz == 1) {

		setTimeout("UpdateHeights()", 1000);

	}*/

}



function formatar(campo, mask, key) {

      var n = campo.value.length;

      var saida = mask.substring(0,1);

      var texto = mask.substring(n);

      if ((texto.substring(0,1) != saida) && key != 8)  {

         campo.value += texto.substring(0,1);

      }

}

function MudaDestaqueLoop() {

	var DestaqueSelecionado =  parseInt(document.getElementById("DestaqueSelecionado").value);

	var CountDestaques =  parseInt(document.getElementById("CountDestaques").value);

	if(document.getElementById("LoopDestaques").value == 1) {

			DestaqueSelecionado = DestaqueSelecionado + 1;

			if(DestaqueSelecionado > CountDestaques) {

				document.getElementById("DestaqueSelecionado").value = 1;

				DestaqueSelecionado = 1;

			}

			MudaFotoDestaque(DestaqueSelecionado);

			setTimeout("MudaDestaqueLoop()", 8000);	

	}

}

function MudaFotoDestaque(Index) {

	$(".MenuFotosDestaque").each(function(intIndex) {

			$(this).removeClass("MenuFotosDestaqueActive");

	});			

	$("#FotoDestaque"+Index).addClass("MenuFotosDestaqueActive");

	//$("#DivDestaques").addClass("ImageLoading");

	//alert(document.getElementById("SrcFotoDestaque_"+Index).value);

	$("#BackgroundImageLoader").image(document.getElementById("SrcFotoDestaque_"+Index).value,function(){

		$(".LinkDestaque").attr("href", document.getElementById("LinkFotoDestaque_"+Index).value);

		$("#FotoDestaque").attr("title", document.getElementById("TitleFotoDestaque_"+Index).value);

		$("#TituloDestaque").html($("#TituloFotoDestaque_"+Index).html());

		document.getElementById("DestaqueSelecionado").value = Index;

		$('.ResumoDestaque').hide();

		$('#ResumoDestaque_'+Index).show();

		document.getElementById("FotoDestaque").src = document.getElementById("SrcFotoDestaque_"+Index).value;

	},function(e){

		//alert(e);

	});				

	

}

function EntrarDestaque() {

	var Index = document.getElementById("DestaqueSelecionado").value;

	//var Link = document.getElementById("LinkFotoDestaque_"+Index).value;

	//window.location = Link;

}

function setaTipoBusca(Pagina,TituloPagina) {

	$(".Extra").hide();

	if(Pagina == 9) {

		//$("#TituloBusca").html("Busca");

	} else {

		if(TituloPagina != "false") {

			//$("#TituloBusca").html(TituloPagina);

		}

		if(Pagina == 4) {

			$(".Noticias").show();

		} else  if(Pagina == 7) {

			$(".Servicos").show();

		} else  if(Pagina == 8) {

			$(".Agenda").show();

		}

	}

}

function Buscar(Key,Pagina,AncorarALista) {

	if(Key == 13) {

		if(AncorarALista != 0) {

			var top = $('#BotaoBusca').offset().top - 100;

			$('html,body').animate({scrollTop: top}, 200);

		}

		var TextoPesquisa = $('#TextoPesquisa').val();

		var TipoBusca = $('#TipoBusca').val();

		var CategoriaNoticia = $('#CategoriaNoticia').val();

		var CategoriaServico = $('#CategoriaServico').val();

		var De = $('#De').val();

		var Ate = $('#Ate').val();

		var APartirDe = $('#APartirDe').val();

		var Pid = $('#Pid').val();

		document.getElementById("ConteudoBusca").innerHTML = "";

		$('#CarregandoBusca').show();

		//$('#Conteudo').height($('#MenuUl').outerHeight()+200);

		//$('#MenuRepeat').height($('#MenuUl').outerHeight()+200);



		/*$("#ConteudoBusca").load("paginas/Ajax.php", { Acao: "Busca", TextoPesquisa: TextoPesquisa, Pagina: Pagina, TipoBusca: TipoBusca, CategoriaNoticia: CategoriaNoticia, CategoriaServico: CategoriaServico, De: De, Ate: Ate, APartirDe: APartirDe } , function(datax) {

																																																																

				$('#CarregandoBusca').hide();

				//alert($('#ConteudoBusca').outerHeight());

				$('#Conteudo').height($('#ConteudoBusca').outerHeight()+300);

				//alert($('#Conteudo').height());

				UpdateHeights();

				

		});*/

		

		$.post('paginas/Ajax.php',  {Acao: "Busca", TextoPesquisa: TextoPesquisa, Pagina: Pagina, TipoBusca: TipoBusca, CategoriaNoticia: CategoriaNoticia, CategoriaServico: CategoriaServico, De: De, Ate: Ate, APartirDe: APartirDe, Pid: Pid }, function(data){

																																																											

					$('#CarregandoBusca').hide();

					$("#ConteudoBusca").html(data);

					//$('#Conteudo').height($('#ConteudoBusca').outerHeight()+$('#DivBusca').outerHeight()+200);

					UpdateHeights();

					

		});

		

		

	}

}







function votarEnquete() {

	if($(".respostaenquete:checked").size() == 0) {

		alert("Escolha uma das repostas da enquete para votar!");

	} else {
	  Recaptcha.destroy();	
	  Recaptcha.create("6Lez_L8SAAAAAF7BZSJgPavTVuPtDwjp8dsuv8he",
		"CaptchaEnquete",
		{
		  theme: "white",
		  lang : 'pt',
		  callback: Recaptcha.focus_response_field
		}
	  );	
	  $('#ModalCaptchaEnquete').center();		
	  $('#ModalCaptchaEnquete').jqmShow(); 

		/*if(JaVotou == 1) {

			alert("Apenas um voto por visita. Obrigado por participar!");

		} else {

			$.get('paginas/Ajax.php',  { Acao: "VotarEnquete", Enquete: Enquete, RespostaEscolhida: RespostaEscolhida, Humano: Humano }, function(data){

				 $('#JaVotou').val(1);

				 alert("Obrigado por participar!");

			});		

		}*/

	}

}

function finalizaVotoEnquete() {
	
	var Humano = "Sim";

	var Enquete = $('#Enquete').val();

	var JaVotou = $('#JaVotou').val();

	var RespostaEscolhida = "";

	var RespostaEscolhida = $(".respostaenquete:checked").attr("id");		
	
	$.post('paginas/Ajax.php', 
	{
		Acao: "VotarEnquete", Enquete: Enquete, RespostaEscolhida: RespostaEscolhida, Humano: Humano,
		recaptcha_challenge_field: Recaptcha.get_challenge(),
		recaptcha_response_field: Recaptcha.get_response()
	}, 
	function(data) {
		if(data) {
			alert(data);	
		} else {
			alert("Voto computado com sucesso.\nObrigado por participar!");
			Recaptcha.destroy();
			$(".respostaenquete").attr('checked', false);
			$('#ModalCaptchaEnquete').jqmHide();
		}
	});
}

function verificaDadosConcurso() {

	var Humano = "Sim";

	var Concurso = $('#Concurso').val();

	var Nome = $("#NomeConcurso").val();

	var Email = $("#EmailConcurso").val();	

	var Rg = $("#RgConcurso").val();

	var Telefone = $("#TelefoneConcurso").val();	

	var Estado = $("#EstadoConcurso").val();

	var Cidade = $("#CidadeConcurso").val();

	var Bairro = $("#BairroConcurso").val();

	var Resposta = $("#RespostaConcurso").val();	

	$.post('paginas/Ajax.php',  { 
	
		Acao: "verificaDadosConcurso", Concurso: Concurso, Email: Email, Nome: Nome, Rg: Rg, Telefone: Telefone, Estado: Estado, Cidade: Cidade, Bairro: Bairro, Resposta: Resposta, Humano: Humano 
	
	}, function(data){																																										  

		 if(data == "") {
			 Recaptcha.destroy();
			  Recaptcha.create("6Lez_L8SAAAAAF7BZSJgPavTVuPtDwjp8dsuv8he",
				"CaptchaConcurso",
				{
				  theme: "white",
				  lang : 'pt'/*,
			  callback: Recaptcha.focus_response_field*/
				}
			  );
			$('#Regulamento_'+Concurso).center();			  
			$('#Regulamento_'+Concurso).jqmShow();

		 }  else {

			alert(data);	 

		 }

	});

}

function abreParticiparConcurso() {

	$('#PBotaoParticiparConcurso').hide();

	$('#ParticiparConcurso').show();

	UpdateHeights();

	setTimeout('UpdateHeights()',200);	

}

function escondeParticiparConcurso() {

	$('#PBotaoParticiparConcurso').hide();

	$('#ParticiparConcurso').hide();

	UpdateHeights();

	setTimeout('UpdateHeights()',200);	

}

function participarConcurso() {

	var Humano = "Sim";

	var Concurso = $('#Concurso').val();

	var Email = $("#EmailConcurso").val();	

	var Nome = $("#NomeConcurso").val();

	var Rg = $("#RgConcurso").val();

	var Telefone = $("#TelefoneConcurso").val();

	var Estado = $("#EstadoConcurso").val();

	var Cidade = $("#CidadeConcurso").val();

	var Bairro = $("#BairroConcurso").val();	

	var Resposta = $("#RespostaConcurso").val();	

	$('#Regulamento_'+Concurso).jqmHide();

	$.post('paginas/Ajax.php',  { 
		recaptcha_challenge_field: Recaptcha.get_challenge(),
		recaptcha_response_field: Recaptcha.get_response(),	
		Acao: "participarConcurso", Concurso: Concurso, Email: Email, Nome: Nome, Rg: Rg, Telefone: Telefone, Estado: Estado, Cidade: Cidade, Bairro: Bairro, Resposta: Resposta, Humano: Humano 
	}, function(data){																																										  

		 if(data) {

			var Split = data.split("|");

			if(Split[0] != "") {

				alert(Split[0]);
				$('#Regulamento_'+Concurso).center();
				$('#Regulamento_'+Concurso).jqmShow();

			} else {

				if(Split[2] != "Multi") {

					alert("Seu código de inscrição é:  "+Split[1]+"\nObrigado por participar!");

					escondeParticiparConcurso();

				} else {

					alert("Seu código de inscrição é:  "+Split[1]+"\nObrigado por participar e inscreva-se quantas vezes quiser!");

					$('#RespostaConcurso').val('');

				}				
				if($('#QtdCaracteresRespostaConcurso').size() > 0) {
					ContaCaracteres("RespostaConcurso", $('#QtdCaracteresRespostaConcurso').val());
				}
			}

		 } 

	});		

}

function recuperarInscricaoConcurso() {

	var Humano = "Sim";

	var Concurso = $('#Concurso').val();

	var Rg = $("#RgConcursoRecuperarCodigo").val();	



	$.get('paginas/Ajax.php',  { Acao: "recuperarInscricaoConcurso", Concurso: Concurso, Rg: Rg, Humano: Humano }, function(data){



		 if(data) {

			var Split = data.split("|");

			if(Split[0] != "") {

				alert(Split[0]);

			} else {

				//alert("Seu código de inscrição é:  "+Split[1]);

				$('#CodigosRecuperados').html(Split[1]);

				$('#PCodigosRecuperados').show();

				$('#RecuperarCodigoConcurso').hide();

				setTimeout('UpdateHeights()',200);				

			}

		 } 

	});	

}

function enviarNoticiaParaAmigo(Noticia) {

	var Clicado = "Clicado";

	var EmailAmigo = $('#EmailAmigo').val();

	var NomeAmigo = $('#NomeAmigo').val();
	
	var Remetente = $('#Remetente').val();

	var MensagemAmigo = $('#MensagemAmigo').val();

	var Url = $('#Url').val();

	$.get('paginas/Mailer.php', {Acao: "EnviarNoticiaParaAmigo", EmailAmigo: EmailAmigo, NomeAmigo: NomeAmigo, Remetente: Remetente, MensagemAmigo: MensagemAmigo, Noticia: Noticia, Url: Url, Clicado: Clicado },

	function(data){

		var Split = data.split("[xox]");

		if(Split[0] == "Erro") {

			alert(Split[1]);

		} else {

			alert("Email enviado com sucesso!");

			$('#ModalEnviarParaAmigo').jqmHide();

		}

	});	

}

function enviarEventoParaAmigo(Evento) {

	var Clicado = "Clicado";

	var EmailAmigo = $('#EmailAmigo').val();

	var NomeAmigo = $('#NomeAmigo').val();
	
	var Remetente = $('#Remetente').val();

	var MensagemAmigo = $('#MensagemAmigo').val();

	var Url = $('#Url').val();

	$.get('paginas/Mailer.php', {Acao: "EnviarEventoParaAmigo", EmailAmigo: EmailAmigo, NomeAmigo: NomeAmigo, Remetente: Remetente, MensagemAmigo: MensagemAmigo, Evento: Evento, Url: Url, Clicado: Clicado },

	function(data){

		var Split = data.split("[xox]");

		if(Split[0] == "Erro") {

			alert(Split[1]);

		} else {

			alert("Email enviado com sucesso!");

			$('#ModalEnviarEventoParaAmigo').jqmHide();

		}

	});	

}

function enviarServicoParaAmigo(Servico) {

	var Clicado = "Clicado";

	var EmailAmigo = $('#EmailAmigo').val();

	var NomeAmigo = $('#NomeAmigo').val();
	
	var Remetente = $('#Remetente').val();

	var MensagemAmigo = $('#MensagemAmigo').val();

	var Url = $('#Url').val();

	$.get('paginas/Mailer.php', {Acao: "EnviarServicoParaAmigo", EmailAmigo: EmailAmigo, NomeAmigo: NomeAmigo, Remetente: Remetente, MensagemAmigo: MensagemAmigo, Servico: Servico, Url: Url, Clicado: Clicado },

	function(data){

		var Split = data.split("[xox]");

		if(Split[0] == "Erro") {

			alert(Split[1]);

		} else {

			alert("Email enviado com sucesso!");

			$('#ModalEnviarServicoParaAmigo').jqmHide();


		}

	});	

}

function faleConosco() {

	var Clicado = "Clicado";

	var nome = $('#nome').val();

	var email = $('#email').val();

	var tel_ddd = $('#tel_ddd').val();

	var tel_nmb = $('#tel_nmb').val();

	var mensagem = $('#mensagem').val();

	$.get('paginas/Mailer.php', {Acao: "FaleConosco", nome: nome, email: email, tel_ddd: tel_ddd, tel_nmb: tel_nmb, mensagem: mensagem, Clicado: Clicado },

	function(data){

		var Split = data.split("[xox]");

		if(Split[0] == "Erro") {

			alert(Split[1]);

		} else {

			alert("Email enviado com sucesso!");

			window.location = "index.php?p=2";

		}

	});	

}

function anuncieConosco() {

	var Clicado = "Clicado";

	var nome = $('#nome').val();

	var email = $('#email').val();

	var tel_ddd = $('#tel_ddd').val();

	var tel_nmb = $('#tel_nmb').val();

	var mensagem = $('#mensagem').val();

	$.get('paginas/Mailer.php', {Acao: "AnuncieConosco", nome: nome, email: email, tel_ddd: tel_ddd, tel_nmb: tel_nmb, mensagem: mensagem, Clicado: Clicado },

	function(data){

		var Split = data.split("[xox]");

		if(Split[0] == "Erro") {

			alert(Split[1]);

		} else {

			alert("Email enviado com sucesso!");

			window.location = "index.php?p=3";

		}

	});	

}

function maximizaFotoConcurso(Concurso) {

	$.get('paginas/Ajax.php', {Acao: "maximizaFotoConcurso", Concurso: Concurso },

	function(data){

		$('#MaximizarFotoConcursoModal').html(data);

		$("#MaximizarFotoConcurso_"+Concurso).jqm();
		$("#MaximizarFotoConcurso_"+Concurso).center();
		$("#MaximizarFotoConcurso_"+Concurso).jqmShow();

	});	

}

function getRegulamentoConcurso(Concurso) {

	$.get('paginas/Ajax.php', {Acao: "getRegulamentoConcurso", Concurso: Concurso },

	function(data){

		$('#RegulamentosModal').html(data);

		$("#BuscaRegulamento_"+Concurso).jqm();
		$("#BuscaRegulamento_"+Concurso).center();
		$("#BuscaRegulamento_"+Concurso).jqmShow();

	});	

}

function removeHTMLTags(Html){

	var NewHtml;

	Html = Html.replace(/&(lt|gt);/g, function (strMatch, p1){

		return (p1 == "lt")? "<" : ">";

	});

	var NewHtml = Html.replace(/<\/?[^>]+(>|$)/g, "");

	alert("Output text:\n" + NewHtml);	

	return NewHtml;

}

function mostraEnquete(Enquete) {

	$('#ResultadoEnquete').html('<div style="width: 550px; font-size: 15px; font-weight: bold; cursor:pointer; color:#FF8402;">Carregando enquete<span style="text-decoration: blink;">...</span></div>');

	

	$.ajax({

		url: "paginas/IncludeEnquete.php",

		type: 'GET',

		dataType: 'html',

		cache: false,

		beforeSend: function() {

		},

		success: function (txt){ $("#ResultadoEnquete").html(txt); }

	 });	

	
	$('#ResultadoEnquete').center();
	$('#ResultadoEnquete').jqmShow();



	//$('#ResultadoEnquete').load("paginas/IncludeEnquete.php");

}
