// SOLUÇÃO PARA O SCRIPT DO JQUERY QUE ENTRA EM CONFLITO COM O SCRIPT DO PROTOTYPE.
// FOI SUBSTTITUIDO O $ PARA $foo PARA SOLUCIONAR O PROBLEMA DO CONFLITO ENTRE OS SCRIPTS.
var $foo = jQuery.noConflict();

//escreve o flash na div desejada para que nao precise clicar nele antes de usa-lo
function montaFlash(destino, flavez, width, height, trans, scale){

	var myFlash =
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+flavez+'" align="middle">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="swf/'+flavez+'.swf" />'
	;
	if (trans == "yes"){
		myFlash += '<param name="wmode" value="transparent" />';
	}
	if (scale == "yes"){
		myFlash += '<param name="scale" value="noscale" />';
	}
	myFlash +=
	'<param name="quality" value="high" />'+
	'<embed src="swf/'+flavez+'.swf" wmode="transparent" quality="high" width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>'
	;
	document.getElementById(destino).innerHTML = myFlash;
}


//escreve o flash na div desejada para que nao precise clicar nele antes de usa-lo
function montaFlashParams(width, height, arquivo, params, destino){

	var parametro = false;
	
	if(params != null || params != "" || params != "none"){
		parametro = true;
	}
	
	var myFlash =
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+arquivo+'" align="middle">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="swf/'+arquivo+'.swf';if(parametro){ myFlash += '?'+params;} myFlash += '" />'+
	'<param name="wmode" value="transparent" />'+
	'<param name="scale" value="noscale" />'+
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value="#ffffff" />'+
	'<embed src="swf/'+arquivo+'.swf'; if(parametro){ myFlash += '?'+params;} myFlash += '" wmode="transparent" quality="high" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>'
	;
	document.getElementById(destino).innerHTML = myFlash;
}


/*function redimensionaInternas() {
	var ie = /msie/i.test(navigator.userAgent);
	var ieBox = ie && (document.compatMode == null || document.compatMode == "BackCompat");

	var w, h; // Contem o width e o height da janela
	var canvasEl = ieBox ? document.body : document.documentElement;
	w = window.innerWidth || canvasEl.clientWidth;
	h = window.innerHeight || canvasEl.clientHeight;
	//ih = document.getElementById('internas').innerHeight || document.getElementById('internas').clientHeight;
	if(parseInt(h-283)>0){
		//document.getElementById('rodape').setAttribute('style','margin-top:'+parseInt(h-384-315)+'px');
		//document.getElementById('rodape').style.margin = parseInt(h-384-315)+'px 0 0 0';
		$foo('#rodape').css({marginTop:parseInt(h-283)+'px'});
	}
}*/

function abreSite() {
	$foo("#topo_site").slideDown("slow");
	$foo("#global").slideDown("slow", fimAbreSite);
}

function fimAbreSite(){
	$foo('#rodape').css({marginTop:-150+'px'});
}


function irTopo(){
	scrollTo(0,0);	
}

function buscaAvancada(param){
	$foo.ajax({
		type: "POST",
		url: "ctrlImplementa.php",
		data: "acao=buscaAvancada"+param,
		beforeSend: function() {						
			//mensagem de carregando aqui
		},
		success: function(txt) {												
			//atualizando os grupos de mensalidade
			$foo('#internas').html(txt);
		},
		error: function(txt) {
			//mensagem de erro aqui
		}
	});	
}

function submitBusca(){
	var busca = document.getElementById('txtBusca');
	if(busca.value==""){
		alert("Por favor, preencha o campo busca.");
		busca.focus();
		return false;
	}
	ajax('resultados&busca='+busca.value);
}



//  CONTROLE GERAL DE FONTES DO SITE

var fontAtual = 14;
var contraste = "normal";

function fontePadrao(){
	$foo("body").css("fontSize","14px");	
	fontAtual = 14;
}

function aumentaFont(){
	if(fontAtual<16){
		fontAtual = fontAtual+1;
		$foo("body").css("fontSize",""+fontAtual+"px");
	}
}

function diminuiFont(){
	if(fontAtual>10){
		fontAtual = fontAtual-1;
		$foo("body").css("fontSize",""+fontAtual+"px");
	}
}

function autoContraste(){
	if(contraste == "normal"){
		$foo("link#estilo").attr({ href: "css/estilosContraste.css"});
		$foo("link#estFormularios").attr({ href: "css/formulariosContraste.css"});
		contraste = "preto";
	}else{
		$foo("link#estilo").attr({ href: "css/estilos.css"});
		$foo("link#estFormularios").attr({ href: "css/formularios.css"});
		contraste = "normal";
	}
}

/* FUNÇÃO PARA CONTROLAR AS NOTICAS EM DESTAQUES DA HOME */

var lastOpenDest = 0;
var proximo = 1;

function trocaDestaques(num){
	$foo("#"+lastOpenDest).removeClass("over");
	$foo("#"+num).addClass("over");
	$foo('#dest'+lastOpenDest).hide();
	$foo('#dest'+num).show();
	lastOpenDest = num;
}

function autoTrocaDestaque(numDest){	
	//se nao tiver mais na home
	if(!document.getElementById("destaques")){
		clearInterval(setIntervalAutoDest);
	}
	
	if(proximo==numDest){
		proximo = 0;
	}
	
	trocaDestaques(proximo);
	proximo++;
}

function criaIntervalo(num){
	setIntervalAutoDest = window.setInterval('autoTrocaDestaque('+num+')',5000);
}


function verificaHome(){
	var urlAtual = window.location.href;
	var array = urlAtual.split("#");
	var tamanho = array.length;
	if(tamanho > 1){
		var param = array[tamanho-1];
	}else{
		var param = "";
	}
	if(param=="" && tamanho <= 2){
		carregapagina("home");
	}
}


//carrega a pagina solicitada
function carregapagina(pagina){
	show_loading();
	setTimeout("pausa('"+pagina+"')",1000);
}

function pausa(pagina) {
	if(pagina=="revenda"){
		$foo("#internas").load("internas/"+pagina+".php", hide_loading);	
	}else{
		$foo("#internas").load("ctrlImplementa.php?acao="+pagina, hide_loading);
	}
}


//mostra a mensagem de carregando
show_loading = function() {
	$foo("#ajax_loader").show();
	$foo("#internas").slideUp("fast");
}

/* FUNÇÃO PARA CONTROLAR AS ÚLTIMAS NOTICAS DA HOME */

var lastOpenNot = 0;

function trocaNoticias(num){
	$foo(".titNot"+lastOpenNot).removeClass("over");
	$foo(".titNot"+num).addClass("over");
	$foo(".ultnot"+lastOpenNot).slideUp("normal");
	$foo(".ultnot"+num).slideDown("normal");
	lastOpenNot = num;
}

/* FUNÇÃO PARA CONTROLAR AS ABAS DE FOTOS E VIDEOS DO CONTEUDO */
var lastDisplay = Array();
lastDisplay["fotos"]  = "";
lastDisplay["videos"] = "";

function trocaAbas(variavel){
	if(lastDisplay[variavel]==""){
		$foo("dd."+variavel).slideUp("normal");
		$foo("dt."+variavel).removeClass("over");
		lastDisplay[variavel] = "none";
	}else{
		$foo("dd."+variavel).slideDown("normal");
		$foo("dt."+variavel).addClass("over");
		lastDisplay[variavel] = "";
	}
}

/*
FUNÇÃO ANTIGA ONDE ABRIA AS FOTOS E FECHAVA OS VIDEOS

var lastOpenAba = "fotos";
function trocaAbas(variavel){
	/*
	if(variavel == lastOpenAba){				
		$foo("dd."+variavel).slideUp("normal");
		$foo("dt."+variavel).removeClass("over");
		lastOpenAba = "";
	}else{		
		if(lastOpenAba == ""){
			$foo("dd."+variavel).slideDown("normal");
			$foo("dt."+variavel).addClass("over");
			lastOpenAba = variavel;
		}else{
			$foo("dt."+lastOpenAba).removeClass("over");
			$foo("dt."+variavel).addClass("over");
			$foo("dd."+lastOpenAba).slideUp("normal");
			$foo("dd."+variavel).slideDown("normal");
			lastOpenAba = variavel;
		}
	}
}
*/

/* FUNÇÃO PARA CONTROLAR O EFEITO DO MENU */

var aberto = -1;

function abreFechaMenu(id){
	$foo("#submenu"+id).slideToggle("normal");
	$foo("#menu"+id).addClass("atual");
	if(aberto > 0){
		if(aberto != id){
			$foo("#submenu"+aberto).slideUp("normal");
		}
	}
	$foo("#menu"+aberto).removeClass("atual");
	aberto=id;
}



function sorteioPalavras(){
	var lis = new Array();
	var tamanho = $foo("ul.palavras").find("li").length;
	var numero = 0;
	
	for(i=0; i<tamanho; i++){
		numero = parseInt(Math.random() * 30);
		while(numero<10){
			numero = parseInt(Math.random() * 30);
		}
		$foo("ul.palavras li").eq(i).css("fontSize",""+numero+"px");
	}
}







// 1 VARIÁVEL (VETOR) E 2 METODOS PARA CONTROLAR AS LISTAS DE CATEGORIAS NA GALERIA DE FOTOS DO SITE

//abre a categoria de fotos se ela estiver fechada
function abreFecha(id) {
	$foo("#categ"+id).slideToggle("normal");
}

//abre a categoria de fotos se ela estiver fechada
function abreFechaVideos(id) {
	//busca as categorias e as galerias que tem relacionamento com a categoria passada como parametro
	$foo('#categ'+id).load("ctrlImplementa.php?acao=loadSubCateVideos&id_cate="+id);
	$foo("#categ"+id).slideToggle("normal");
}

function abreFechaFotos(id) {
	$foo('#categ'+id).load("ctrlImplementa.php?acao=loadSubCateGalerias&id_cate="+id);
	$foo("#categ"+id).slideToggle("normal");
}

this.screenshotPreview = function(){
	//distancia(x,y) do cursor do tooltip
	var xOffset = 30;
	var yOffset = 150;
	
	//pega em todos os links da classe screenshot
	$foo("a.screenshot").mouseover(function(e){
		//guarda o titulo do link
		this.t = this.title;
		//coloca o titulo do link como vazio
		this.title = "";
		//verifica se o titulo não é vazio
		var c = (this.t != "") ? "<br />" + this.t : "";
		//cria a previsualização
		$foo("body").append("<p id='screenshot'>"+ c +"<br /><br /><img src='"+ this.rel +"' alt='url preview' /></p>");
		//posisiona em relação ao mouse
		$foo("#screenshot").css({top:parseInt(e.pageY - yOffset)+"px",left:parseInt(e.pageX + xOffset)+"px"}).fadeIn("fast");
    });
	
	//função que retira a previsualização
	$foo("a.screenshot").mouseout(function(){
		//coloca o titulo novamente no link
		this.title = this.t;
		//remove o componente criado
		$foo("#screenshot").remove();
    });
	
	//função que segue o mouse
	$foo("a.screenshot").mousemove(function(e){
		//reposiciona a previsualização perto do mouse
		$foo("#screenshot").css({top:parseInt(e.pageY - yOffset)+"px",left:parseInt(e.pageX + xOffset)+"px"});
	});
}


//verifica se o email informada eh valido
function validaEmail(email){
	ER = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]{2,64}(\.[a-z0-9-]{2,64})*\.[a-z]{2,4}$");
	if (ER.test(email)){
		return true;
	}else{
		return false;
	}
}

//cadastra o email informado no newsletter
function cadNews(email){
	if(email=="informe seu e-mail aqui" || email==""){
		alert("Informe seu e-mail");
		//return false;
	}else{
		if(!validaEmail(email)){
			alert("E-mail invalido!");
			//return false;
		}else{
			$foo("#submitHidden").load("ctrlImplementa.php?acao=addNews&email="+email);
		}
	}
}

function validaFrmContato(form){
	document.getElementById("resposta").style.display = "block";
	if(form.txtNome.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo NOME!";
		form.txtNome.focus();
		return false;
	}
	if(form.txtEmail.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo EMAIL!";
		form.txtEmail.focus();
		return false;
	}else{
		if(!validaEmail(form.txtEmail.value)){
			document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
			form.txtEmail.focus();
			return false;
		}
	}	
	if(form.txtFone.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo TELEFONE!";
		form.txtFone.focus();
		return false;
	}
	if(form.txtMensagem.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo MENSAGEM!";
		form.txtMensagem.focus();
		return false;
	}
	$foo("#resposta").load('ctrlImplementa.php?'+$foo("#frmContato").formSerialize());
}

function popup(url, width, height, rola){						
	if (rola==""){
		rola="yes"
	}
	window.open(url,"_blank","resizable=no,toolbar=no,status=no,top=" + (window.screen.height - height)/2 + ",left=" + (window.screen.width - width)/2 + ",menubar=no,scrollbars=" + rola + ",width=" + width + ",height=" + height);
}

function validaFrmVotaEnquete(form){
	var flag = 0;
	var resp = 0;
	
	for(i=0;i<form.elements.length;i++){
		if(form.elements[i].type=="radio"){
			if(form.elements[i].checked==true){
				resp = form.elements[i].value;
				flag++;
			}
		}
	}

	if(flag==0){
		alert('Por favor, escolha uma das opções!');
		form.elements[0].focus();
		return false;
	}
	
	popup('ctrlImplementa.php?acao=resultado&resposta='+resp,250,300,'no');
}

function mudaMes(mes,ano){
	$foo("#calendario").load("ctrlImplementa.php?acao=calendario&mes="+mes+"&ano="+ano);
}

function mudaVideo(url,titulo,descricao){
	$foo("#carregaVideoInt").load("ctrlImplementa.php?acao=video&url="+url+"&titulo="+titulo+"&descricao="+descricao);
}

function selecionaTodos(id,newStatus){		
	var form = document.getElementById(id);	
	
	for (i=0;i<form.elements.length;i++){
		//se for um checkebox
		if(form.elements[i].type == "checkbox"){
			form.elements[i].checked = newStatus;	
		}		
	}
}


/*
	função para trocar as abas do painel de controle
*/

function trocaAba(aba){
	if(aba=="WEBMAIL"){
		document.getElementById('abaAtual').innerHTML = 'WEBMAIL';
		document.getElementById('abaSecundaria').innerHTML = 'PAINEL DE CONTROLE';
		document.getElementById('frmAcesso').action = 'http://www.raionet.com.br:2095/login/';
		document.getElementById('txtUsuario').name = 'user';
		document.getElementById('txtSenha').name = 'pass';
	}else{
		document.getElementById('abaAtual').innerHTML = 'PAINEL DE CONTROLE';
		document.getElementById('abaSecundaria').innerHTML = 'WEBMAIL';
		document.getElementById('frmAcesso').action = 'http://www.grupogedoor.com.br/boleto/ctrlUsuarios?acao=logarExterno';
		document.getElementById('txtUsuario').name = 'usuario';
		document.getElementById('txtSenha').name = 'senha';
	}
}

function validaFrmAcesso(form){
	if(form.txtUsuario.value==""){
		alert("Por favor, preencha o campo USUARIO!");
		form.txtUsuario.focus();
		return false;
	}
	if(form.txtSenha.value==""){
		alert("Por favor, preencha o campo SENHA!");
		form.txtSenha.focus();
		return false;
	}
}








/**
 * 
 * INICIO - SCRIPTS USADOS NO IMOBSYS - IMOVEISGOIAS
 *
 */

//submita a busca horizontal do imoveis goias
function mudaCor(myTr,myCor){
	myTr.className=myCor;
}

function abreDet(url2){
	if (window.screen.height > "600"){
		rola2="no";
		width2="773";
		height2="587";
		posTop2=(window.screen.height - height2)/2;
		posLeft2=(window.screen.width - width2)/2;
	}
	else{
		rola2="yes";
		width2="792";
		height2="510";
		posTop2="0";
		posLeft2="0";
	}
	window.open(url2,"_blank","resizable=no,toolbar=no,status=yes,top=" + posTop2 + ",left=" + posLeft2 + ",menubar=no,scrollbars=" + rola2 + ",width=" + width2 + ",height=" + height2);
}
function submitBusca(obj,destino){
	objAux = obj.elements;
	parametros = "";
	//alert(obj);
	for(var i=0; i < objAux.length; i++) {
		if(obj[i].type=="select-one" || obj[i].type=="text" || obj[i].type=="hidden") {
			parametros += obj[i].name+"="+obj[i].value+"&";
		}
	}
	consultaAjaxText("internas/gedoor_list.php", parametros, "get", ""+destino+"", "Carregando Aguarde...");
}
function Limpa_Campo(campo){
	if(campo.value=="Pesquisa Rápida"){
		campo.value="";
	}
}
function abreDentro(url){
	if (window.screen.height > 600){
		rola="no";
		width="660";
		height="356";
		posTop=(window.screen.height - height)/2;
		posLeft=(window.screen.width - width)/2;
	}
	else{
		rola="yes";
		width="792";
		height="510";
		posTop="0";
		posLeft="0";
	}
	window.open(url,"_blank","resizable=no,toolbar=NO,status=yes,top=" + posTop + ",left=" + posLeft + ",menubar=no,scrollbars=" + rola + ",width=" + width + ",height=" + height);
}

function abreUrlNew(url, width, height, scrools){
	win=window.open(url,"","width="+width+",height="+height+",top=100, left=200, scrollbars="+scrools+", resizable=YES, status=no");
	return win;
}

function abreUrlHidden(url, width, height,scrools){
	win=window.open(url,"","width="+width+",height="+height+",top=200, left=200, scrollbars="+scrools+", resizable=NO");
	return win;
}

/*fim SCRIPT PARA O IMOBSYS FUNCIONAR*/



function Abre(url, width, height, rola)	{
	if (rola==""){rola="yes"}
	window.open(url,"_blank","resizable=no,toolbar=no,status=no,top=" + (window.screen.height - height)/2 + ",left=" + (window.screen.width - width)/2 + ",menubar=no,scrollbars=" + rola + ",width=" + width + ",height=" + height);
}

/* valida o e-mail */
function validaEmail(email){
	ER = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]{2,64}(\.[a-z0-9-]{2,64})*\.[a-z]{2,4}$");
	if (ER.test(email)){
		return true;
	}
	else{
		return false;
	}
}

/* oculta a div conteudo qndo clicar em principal */
function ocultaConteudo(){
	document.getElementById("conteudo").style.display = "none";
}

/* função que gera mascara para input */
function mascara(src, mask) {
	var i = src.value.length;
	var saida = mask.substring(0,1);

	var texto = mask.substring(i)

	if (texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

/* @author fernando & wesley */
var controlerImagem;
var i = 0;
function percorre(img){
	mudarImagem(i);
	if(arrayFotos.length-2==i){
		i=0;
	}else{
		++i;
	}
	controlerImagem=setTimeout("percorre()",25000);
}
function mudarImagem(i){
	var obj = document.getElementById('foto');
	if(obj){
		obj.src=arrayFotos[i];
	}
}
function mapinha(){
	
	Mapinhas.setImobiliaria(clientes);
	Mapinhas.setImoveis(codimovel);
	Mapinhas.setCidade(cidades);
	Mapinhas.setUf(uf);
	Mapinhas.setQuartos(quarto);
	Mapinhas.setSuites(suite);
	Mapinhas.setGaragem(garagem);
	Mapinhas.setBairros(setor);
	Mapinhas.setComercializacao(comercializacao);

	Mapinhas.setValor(valores);
	Mapinhas.setSite(urls);
	setTimeout("Mapinhas.CriarMapa('')",0);
}


function mudaImagem(imagem, div){
	immggg = document.getElementById(div);
	immggg.style.display = 'block'
	immggg.src = imagem;
}

var xmlhttp
function loadXMLDoc(url, idWrite, tRequest)
{
	if(tRequest!="GET" || tRequest!="POST")
	tRequest = "GET";
	element	=  document.getElementById(idWrite);
	element.innerHTML  = "<div style=\"width:100%; padding-top:70px; text-align:center;\"><div style=\"width:150px;\"><div style=\"float:left; padding-top:5px;\">Carregando Aguarde...</div><div style=\"float:left;\"><img src=\"img/clocks.gif\" style=\"margin-left:10px;\" align=\"center\"></div></div</div>";
	// código para Firefox, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4)
			{
				// if OK
				if (xmlhttp.status==200)
				{
					element.innerHTML=xmlhttp.responseText
				}
				else
				{
					alert("Problem Ao Tentar Abrir Arquivo:" + xmlhttp.statusText+" "+url )
				}
			}
		}
		xmlhttp.open(tRequest,url,true)
		xmlhttp.send(null)
	}
	// código para IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=function(){
				if (xmlhttp.readyState==4)
				{
					// if OK
					if (xmlhttp.status==200)
					{
						element.innerHTML=xmlhttp.responseText
					}
					else
					{
						alert("Problem Ao Tentar Abrir Arquivo:" + xmlhttp.statusText+" "+url)
					}
				}
			}
			xmlhttp.open(tRequest,url,true)
			if(tRequest=="POST")
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlhttp.send()
		}
	}
}


/****
Curriculo
*/
function redimenIfra() {				
	var iframe = document.getElementById('iframeFrmFcc');	
	
	alert(iframe);
}


/* Mostrar e ocultar div */
function mostraEsconde(div){
	var status = document.getElementById(div).style.display;
	if(status=="none"){
		document.getElementById(div).style.display = "block";
	}else if((status=="block") || (status=="")){
		document.getElementById(div).style.display = "none";
	}
}

/* Abre e fecha div dos clientes */
function MostraClientes(div){
		document.getElementById(div).style.display = '';
}
function SomeClientes(div){
		document.getElementById(div).style.display = 'none';
}
function confirmar(){
	var submit
	submit=confirm("Você Confirma a Ação Selecionada?");

	if (submit==false){
		return false;
	}
	else{
		return true;
	}
}



function enviaFrmContatoHotsite(form){
	if(form.nome.value==""){
		alert("Preencha o campo nome!");
		form.nome.focus();
		return false;
	}
	if(form.ddd.value==""){
		alert("Preencha o campo DDD!");
		form.ddd.focus();
		return false;
	}
	if(form.tele.value==""){
		alert("Preencha o campo telefone!");
		form.tele.focus();
		return false;
	}
	if(form.email.value==""){
		alert("Preencha o campo email!");
		form.email.focus();
		return false;
	}else{
		if(!validaEmail(form.email.value)){
			alert("Por favor, informe um email valido!");
			form.email.focus();
			return false;
		}
	}
	if(form.mensagem.value==""){
		alert("Preencha o campo mensagem!");
		form.mensagem.focus();
		return false;
	}				
	
	return true;		
}


function validaFrmIndicaAmigo(form){
	document.getElementById("resposta").style.display = "block";
	if(form.txtSeuNome.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, informe seu nome!";
		form.txtSeuNome.focus();
		return false;
	}
	if(form.txtSeuEmail.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, informe seu email!";
		form.txtSeuEmail.focus();
		return false;
	}else{
		if(!validaEmail(form.txtSeuEmail.value)){
			document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
			form.txtSeuEmail.focus();
			return false;
		}
	}
	if(form.txtNomeAmigo.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, informe o nome do seu amigo!";
		form.txtNomeAmigo.focus();
		return false;
	}
	if(form.txtEmailAmigo.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, informe o email do seu amigo!";
		form.txtEmailAmigo.focus();
		return false;
	}else{
		if(!validaEmail(form.txtEmailAmigo.value)){
			document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
			form.txtEmailAmigo.focus();
			return false;
		}
	}
	$foo("#resposta").load('ctrlImplementa.php?'+$foo("#frmIndicaAmigo").formSerialize());
}

function validaFrmAgendaVisita(form){
	document.getElementById("resposta").style.display = "block";
	if(form.txtNome.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo nome!";
		form.txtNome.focus();
		return false;
	}
	if(form.txtEmail.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo email!";
		form.txtEmail.focus();
		return false;
	}else{
		if(!validaEmail(form.txtEmail.value)){
			document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
			form.txtEmail.focus();
			return false;
		}
	}
	if(form.txtDia.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, informe o dia para visita!";
		form.txtDia.focus();
		return false;
	}
	if(form.txtHora.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, informe o hor&aacute;rio para visita!";
		form.txtHora.focus();
		return false;
	}
	$foo("#resposta").load('ctrlImplementa.php?'+$foo("#frmAgendaVisita").formSerialize());
}

function validaFrmLigaremos(form){
	document.getElementById("resposta").style.display = "block";
	if(form.txtNome.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo nome!";
		form.txtNome.focus();
		return false;
	}
	if(form.txtEmail.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo email!";
		form.txtEmail.focus();
		return false;
	}else{
		if(!validaEmail(form.txtEmail.value)){
			document.getElementById("resposta").innerHTML = "Por favor, informe um EMAIL V&Aacute;LIDO!";
			form.txtEmail.focus();
			return false;
		}
	}
	if(form.txtPais.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, selecione o pa&iacute;s!";
		form.txtPais.focus();
		return false;
	}
	if(form.txtFone.value==""){
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo telefone!";
		form.txtFone.focus();
		return false;
	}
	$foo("#resposta").load('ctrlImplementa.php?'+$foo("#frmLigaremos").formSerialize());
}