	function validarAssinatura(){
		if(document.assinatura.Nome.value==''){
			alert("ATENÇÃO!\nNome - Campo obrigatório.");
			document.assinatura.Nome.focus();
			return false;
		}
		if(document.assinatura.DataNascimento.value !=''){
			if(isData(document.assinatura.DataNascimento.value) == false){
				alert("ATENÇÃO!\nData Nascimento inválida.");
				document.assinatura.DataNascimento.focus();
				return false;
			}
		}
		if(document.assinatura.Email.value==''){
			alert("ATENÇÃO!\nE-mail - Campo obrigatório.");
			document.assinatura.Email.focus();
			return false;
		}else{
			if(isEmail(document.assinatura.Email.value)==false){
				alert("ATENÇÃO!\nE-mail inválido.");
				document.assinatura.Email.focus();
				return false;
			}
		}
		if(document.assinatura.Sexo[0].selected==true){
			alert("ATENÇÃO!\nSexo - Campo obrigatório.");
			document.assinatura.Sexo[0].selected;
			return false;
		}
		if(document.getElementById('PessoaF').style.display == 'block'){
			if(document.assinatura.PessoaF.value==''){
				alert("ATENÇÃO!\nCPF - Campo obrigatório.");
				document.assinatura.PessoaF.focus();
				return false;
			}else{
				if(isCPF(document.assinatura.PessoaF.value)==false ){
					alert("ATENÇÃO!\nCPF inválido.");
					document.assinatura.PessoaF.focus();
					return false;
				}
			}
		}
		if(document.getElementById('PessoaJ').style.display == 'block'){
			if(document.assinatura.PessoaJ.value==''){
				alert("ATENÇÃO!\nCNPJ - Campo obrigatório.");
				document.assinatura.PessoaJ.focus();
				return false;
			}else{
				if(isCNPJ(document.assinatura.PessoaJ.value)==false){
					alert("ATENÇÃO!\nCNPJ inválido.");
					document.assinatura.PessoaJ.focus();
					return false;
				}
			}
		}
		if(document.assinatura.Endereco.value==''){
			alert("ATENÇÃO!\nEndereço - Campo obrigatório.");
			document.assinatura.Endereco.focus();
			return false;
		}
		if(document.assinatura.Numero.value==''){
			alert("ATENÇÃO!\nNúmero - Campo obrigatório.");
			document.assinatura.Numero.focus();
			return false;
		}
		if(document.assinatura.CEP.value==''){
			alert("ATENÇÃO!\nCEP - Campo obrigatório.");
			document.assinatura.CEP.focus();
			return false;
		}
		if(document.assinatura.Bairro.value==''){
			alert("ATENÇÃO!\nBairro - Campo obrigatório.");
			document.assinatura.Bairro.focus();
			return false;
		}
		if(document.assinatura.Cidade.value==''){
			alert("ATENÇÃO!\nCidade - Campo obrigatório.");
			document.assinatura.Cidade.focus();
			return false;
		}
		if(document.assinatura.Estado.value==''){
			alert("ATENÇÃO!\nEstado - Campo obrigatório.");
			document.assinatura.Estado.focus();
			return false;
		}
		if(document.assinatura.Telefone.value==''){
			alert("ATENÇÃO!\nTelefone - Campo obrigatório.");
			document.assinatura.Telefone.focus();
			return false;
		} 	
		
		var erro = 0;		
		for(i=0; i<document.assinatura.QtdFormaPagamentoParcela.value; i++){
			if(document.assinatura.Pagamento[i].checked == true){					
				erro = 1;
			}
		}
		if(erro == 0){
			alert("ATENÇÂO!\nFormas de Pagamento - Campo obrigatório");
			erro = 0;
			return false;				
		}		
		return true;
	}
	
	function validarEmailNewsletter(){
		if(document.emailnewsletter.Email.value==''){
			alert("ATENÇÃO!\nE-mail - Campo obrigatório.");
			document.emailnewsletter.Email.focus();
			return false;
		}else{
			if(isEmail(document.emailnewsletter.Email.value)==false){
				alert("ATENÇÃO!\nE-mail inválido.");
				document.emailnewsletter.Email.focus();
				return false;
			}
		}
		return true;
	}
	
	function validarContato(){
		if(document.contato.Nome.value==''){
			alert("ATENÇÃO!\nNome - Campo obrigatório.");
			document.contato.Nome.focus();
			return false;
		}
		if(document.contato.Email.value==''){
			alert("ATENÇÃO!\nE-mail - Campo obrigatório.");
			document.contato.Email.focus();
			return false;
		}else{
			if(isEmail(document.contato.Email.value)==false){
				alert("ATENÇÃO!\nE-mail inválido.");
				document.contato.Email.focus();
				return false;
			}
		}
		if(document.contato.Comentarios.value==''){
			alert("ATENÇÃO!\nMensagem - Campo obrigatório.");
			document.contato.Comentarios.focus();
			return false;
		}
		return true;
	}
	
	function validarNewsLetter(){
		if(document.newsletter.Nome.value==''){
			alert("ATENÇÃO!\nNome - Campo obrigatório.");
			document.newsletter.Nome.focus();
			return false;
		}
		if(document.newsletter.Email.value==''){
			alert("ATENÇÃO!\nE-mail - Campo obrigatório.");
			document.newsletter.Email.focus();
			return false;
		}else{
			if(isEmail(document.newsletter.Email.value)==false){
				alert("ATENÇÃO!\nE-mail inválido.");
				document.newsletter.Email.focus();
				return false;
			}
		}
		if(document.newsletter.Telefone.value == '' && document.newsletter.Celular.value == ''){
			alert("ATENÇÃO!\n Preecha pelo menos um dos campos Telefone e/ou Celular.");
			document.newsletter.Telefone.focus();
			return false;
		}
		if(document.newsletter.NewsLetterDiario.checked == false && document.newsletter.NewsLetterSemanal.checked == false){
			alert("ATENÇÃO!\n Preecha pelo menos um tipo de NewsLetter.");
			document.newsletter.NewsLetterDiario.focus();
			return false;
		}
		return true;
	}
	
	function validarAnuncie(){
		if(document.anuncie.Nome.value==''){
			alert("ATENÇÃO!\nNome - Campo obrigatório.");
			document.anuncie.Nome.focus();
			return false;
		}
		if(document.anuncie.Email.value==''){
			alert("ATENÇÃO!\nE-mail - Campo obrigatório.");
			document.anuncie.Email.focus();
			return false;
		}else{
			if(isEmail(document.anuncie.Email.value)==false){
				alert("ATENÇÃO!\nE-mail inválido.");
				document.anuncie.Email.focus();
				return false;
			}
		}
		if(document.anuncie.Comentarios.value==''){
			alert("ATENÇÃO!\nMensagem - Campo obrigatório.");
			document.anuncie.Comentarios.focus();
			return false;
		}
		return true;
	}
	
	function validarLocalizar(){
		if(document.localizar.Localizar.value == '' && document.localizar.Localizar.value == 'Encontre no site:'){
			alert("ATENÇÃO!\nNome - Campo obrigatório.");
			document.localizar.Localizar.focus();
			return false;
		}		
		return true;
	}
	
	function validarReceita(){
		if(document.receita.Titulo.value==''){
			alert("ATENÇÃO!\nTítulo - Campo obrigatório.");
			document.receita.Titulo.focus();
			return false;
		}	
		if(document.receita.Ingredientes.value==''){
			alert("ATENÇÃO!\nIngredientes - Campo obrigatório.");
			document.receita.Ingredientes.focus();
			return false;
		}
		if(document.receita.ModoPreparo.value==''){
			alert("ATENÇÃO!\nModoPreparo - Campo obrigatório.");
			document.receita.ModoPreparo.focus();
			return false;
		}
		if(document.receita.Autor.value==''){
			alert("ATENÇÃO!\nAutorReceita - Campo obrigatório.");
			document.receita.Autor.focus();
			return false;
		}
		if(document.receita.Fonte.value==''){
			alert("ATENÇÃO!\nFonte - Campo obrigatório.");
			document.receita.Fonte.focus();
			return false;
		}
		return true;
	}
	
	function busca_noticia(){		
		
		var nameNode, nameTextNode, url;
		
		var xmlhttp   = false;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
	    	xmlhttp = new XMLHttpRequest();
	        if(xmlhttp.overrideMimeType){
	        	xmlhttp.overrideMimeType('text/xml');
			}
		}else if (window.ActiveXObject){ // IE
			try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	            } catch (e) {}
	        }
	    }
		url = "xml/noticia.php";
		xmlhttp.open("GET", url,true);
		xmlhttp.onreadystatechange = function(){ 
			if(xmlhttp.readyState == 4){ 
				if(xmlhttp.status == 200){
			//	alert(xmlhttp.responseText);					
					if(xmlhttp.responseText == 'false'){																							
					}else{	
						var tam = xmlhttp.responseXML.getElementsByTagName('IdNoticia'); 																
						for(var i=0; i<tam.length-1; i++){							
							nameNode = xmlhttp.responseXML.getElementsByTagName("IdNoticia")[i]; 
							nameTextNode = nameNode.childNodes[0];
							var IdNoticia = nameTextNode.nodeValue;

							nameNode = xmlhttp.responseXML.getElementsByTagName("TituloNoticia")[i]; 
							nameTextNode = nameNode.childNodes[0];
							var TituloNoticia = nameTextNode.nodeValue;	
							
							nameNode = xmlhttp.responseXML.getElementsByTagName("Resumo")[i]; 
							nameTextNode = nameNode.childNodes[0];
							var Resumo = nameTextNode.nodeValue;				
						
							nameNode = xmlhttp.responseXML.getElementsByTagName("ExtImagem")[i]; 
							nameTextNode = nameNode.childNodes[0];
							var ExtImagem = nameTextNode.nodeValue;													
							
							nameNode = xmlhttp.responseXML.getElementsByTagName("AlturaImagem")[i]; 
							nameTextNode = nameNode.childNodes[0];
							var AlturaImagem = nameTextNode.nodeValue;			
							
							nameNode = xmlhttp.responseXML.getElementsByTagName("LarguraImagem")[i]; 
							nameTextNode = nameNode.childNodes[0];
							var LarguraImagem = nameTextNode.nodeValue;														
											
							document.getElementById('slide'+i).style.backgroundImage = 'url(img/noticias/'+IdNoticia+'.'+ExtImagem+')';							
							document.getElementById('slide'+i).style.width 		     = LarguraImagem+'px';
							document.getElementById('slide'+i).style.height 	     = AlturaImagem+'px';						
																					
							document.getElementById('titulo'+i).innerHTML	 = "<a href=\"javascript:link('index.php?ctt=noticia.php&IdNoticia="+IdNoticia+"')\" style='color: #FF6600'>"+TituloNoticia+"</a>";
							document.getElementById('resumo'+i).innerHTML	 = "<a href=\"javascript:link('index.php?ctt=noticia.php&IdNoticia="+IdNoticia+"')\">"+Resumo+"</a>";												
						}						
					}					
				}
			} 
			return true;
		}
		xmlhttp.send(null);
	}
	
	function troca_slide(i,total){		
		if(i == '' || i > total){
			i = 0;
		}		
		setTimeout("muda_noticia_quadro("+i+","+total+")",5000);
	}
		
	function muda_noticia_quadro(pos,total){		
		status_slide(pos);
		pos = parseInt(pos)+1;
		troca_slide(pos,total);
	}	
	
	function click_troca_slide(pos){
		status_slide(pos)
	}
	
	function status_slide(pos){
		document.getElementById('botao10').style.backgroundColor    = "#666666";
		document.getElementById('botao11').style.backgroundColor    = "#666666";
		document.getElementById('botao12').style.backgroundColor    = "#666666";
		document.getElementById('botao13').style.backgroundColor    = "#666666";
		document.getElementById('botao14').style.backgroundColor    = "#666666";
		document.getElementById('botao1'+pos).style.backgroundColor = "#069807";
		
		document.getElementById('botao20').style.backgroundColor    = "#666666";
		document.getElementById('botao21').style.backgroundColor    = "#666666";
		document.getElementById('botao22').style.backgroundColor    = "#666666";
		document.getElementById('botao23').style.backgroundColor    = "#666666";
		document.getElementById('botao24').style.backgroundColor    = "#666666";
		document.getElementById('botao2'+pos).style.backgroundColor = "#069807";
		
		document.getElementById('botao30').style.backgroundColor    = "#666666";
		document.getElementById('botao31').style.backgroundColor    = "#666666";
		document.getElementById('botao32').style.backgroundColor    = "#666666";
		document.getElementById('botao33').style.backgroundColor    = "#666666";
		document.getElementById('botao34').style.backgroundColor    = "#666666";
		document.getElementById('botao3'+pos).style.backgroundColor = "#069807";
		
		document.getElementById('botao40').style.backgroundColor    = "#666666";
		document.getElementById('botao41').style.backgroundColor    = "#666666";
		document.getElementById('botao42').style.backgroundColor    = "#666666";
		document.getElementById('botao43').style.backgroundColor    = "#666666";
		document.getElementById('botao44').style.backgroundColor    = "#666666";
		document.getElementById('botao4'+pos).style.backgroundColor = "#069807";
		
		document.getElementById('botao50').style.backgroundColor    = "#666666";
		document.getElementById('botao51').style.backgroundColor    = "#666666";
		document.getElementById('botao52').style.backgroundColor    = "#666666";
		document.getElementById('botao53').style.backgroundColor    = "#666666";
		document.getElementById('botao54').style.backgroundColor    = "#666666";
		document.getElementById('botao5'+pos).style.backgroundColor = "#069807";
		
		document.getElementById('slide0').style.display    = "none";
		document.getElementById('slide1').style.display    = "none";
		document.getElementById('slide2').style.display    = "none";
		document.getElementById('slide3').style.display    = "none";
		document.getElementById('slide4').style.display    = "none";
		document.getElementById('slide'+pos).style.display = "block";
		
		document.getElementById('titulo0').style.display    = "none";
		document.getElementById('titulo1').style.display    = "none";
		document.getElementById('titulo2').style.display    = "none";
		document.getElementById('titulo3').style.display    = "none";
		document.getElementById('titulo4').style.display    = "none";
		document.getElementById('titulo'+pos).style.display = "block";
		
		document.getElementById('resumo0').style.display    = "none";
		document.getElementById('resumo1').style.display    = "none";
		document.getElementById('resumo2').style.display    = "none";
		document.getElementById('resumo3').style.display    = "none";
		document.getElementById('resumo4').style.display    = "none";
		document.getElementById('resumo'+pos).style.display = "block";
	}
	
	/////////////////////////////////////////Codigo para trocar foto da galeria do index/////////////////////////////
	function troca_foto(i1, i2, Qtd, id1, id2){
		if((verifica_existencia(i1)) && (verifica_existencia(i2))){						
			setTimeout("muda_galeria_quadro("+i1+","+i2+","+Qtd+","+id1+","+id2+")",5000);
		}
	}
		
	function muda_galeria_quadro(pos1, pos2, Qtd, id1, id2){
		status_galeria(pos1, pos2, 0, Qtd);		
		ramdomize(pos1, pos2, Qtd);
	}
	
	function ramdomize(id1, id2, Qtd){
		var n = 0;
		do{
			pos = Math.floor(Math.random()*Qtd)
			pos = String(pos);
			var aux = pos.split('.');
			pos = aux[0];
			if(verifica_existencia(pos) != false){
				if(n == 0 && pos != id1){
					pos1 = pos;
					n++;
				} else if((n == 1 && pos != id2) && pos != pos1){
					pos2 = pos;
					n++;
				}
			}
		}while(n<2);
		
		troca_foto(pos1,pos2,Qtd,id1,id2);
	}
	
	function status_galeria(pos1,pos2, i, Qtd){
//		alert('pri '+pos1+'-'+pos2+' / del '+id1+'-'+id2)
		while(i<Qtd){
			if(verifica_existencia(i) != false){
				document.getElementById('foto'+i).style.display = 'none';
			}
			i++;
		}
		
		document.getElementById('foto'+pos1).style.display	= 'block';
		document.getElementById('foto'+pos2).style.display	= 'block';
	}
	
	function verifica_existencia(pos){
		if(document.getElementById('foto'+pos) != null){
			return true;
		} else{
			return false;
		}
	}
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	
	/*
	function troca_foto(i,total,id,cont){		
		if(i == 1){					
			cont=0;
		}
		if(i > total-cont){						
			total -= cont;			
			i = 0;
		}			
		if(verifica_existencia(i)){							
			setTimeout("muda_galeria_quadro("+i+","+total+","+id+","+cont+")",5000);
		}else{			
			i++;
			total++;
			cont++;			
			troca_foto(i,total, id, cont);			
		}
	}
		
	function muda_galeria_quadro(pos,total,id, cont){
		status_galeria(pos, 0, total, id);		
		do{
			pos = parseInt(pos)+1;			
			pos = (Math.random() * total);
			pos = String(pos);
			var aux = pos.split('.');
			pos = aux[0];
		}while(!verifica_existencia(pos));
		document.galeria.NumRand.value = pos;
		troca_foto(pos,total,id,cont);
	}
	
	function status_galeria(pos, i, total, id){		
		while(i < total){
			if(verifica_existencia(i)){				
				if(i != pos && document.getElementById('foto1'+id).style.display != 'block'){						
					document.getElementById('foto1'+i).style.display   = 'none';				
					document.getElementById('titulo1'+i).style.display = 'none';				
				}
			}
			i++;
		}	
		if(verifica_existencia(pos)){
							
			document.getElementById('foto1'+id).style.display   = 'none';				
			document.getElementById('titulo1'+id).style.display = 'none';
	
			document.getElementById('foto1'+pos).style.display   = 'block';				
			document.getElementById('titulo1'+pos).style.display = 'block';			
		}	
		
	}
	
	function verifica_existencia(pos){
		if(document.getElementById('foto1'+pos) != null){
			return true;
		}
		return false;
	} 	
	
	//////////////////////////////Galeria no index quadro da direita//////////////////////////////////////


	function troca_foto2(i,total,id,cont){		
		if(i == total-1){					
			cont=0;
		}
		if(i == -1){						
			total -= cont;			
			i = total;
		}		
		//alert("i "+i+" total "+total+" id "+id+" cont "+cont);			
		if(verifica_existencia2(i)){							
			setTimeout("muda_galeria_quadro2("+i+","+total+","+id+","+cont+")",5000);
		}else{			
			i--;
			total++;
			cont ++;			
			troca_foto2(i,total, id, cont);			
		}
	}
		
	function muda_galeria_quadro2(pos,total,id, cont){
		status_galeria2(pos, 0, total, id);		
		do{
			pos = parseInt(pos)-1;
			pos = (Math.random() * total);
			pos = String(pos);
			var aux = pos.split('.');
			pos = aux[0];
		}while(!verifica_existencia(pos));		
		troca_foto2(pos,total,id,cont);
	}
	
	function status_galeria2(pos, i, total, id){		
		while(i < total){
			if(verifica_existencia2(i)){				
				if(i != pos && document.getElementById('foto2'+id).style.display != 'block'){						
					document.getElementById('foto2'+i).style.display   = 'none';				
					document.getElementById('titulo2'+i).style.display = 'none';				
				}
			}
			i++;
		}	
		if(verifica_existencia2(pos)){
							
			document.getElementById('foto2'+id).style.display   = 'none';				
			document.getElementById('titulo2'+id).style.display = 'none';
	
			document.getElementById('foto2'+pos).style.display   = 'block';				
			document.getElementById('titulo2'+pos).style.display = 'block';			
		}	
		
	}
	
	function verifica_existencia2(pos){
		if(document.getElementById('foto2'+pos) != null){
			return true;
		}
		return false;
	}*/ 
