// JavaScript Document


function fecha(){
	
	$("#quadro").fadeOut('slow');
	
	
	}
	
	
	
	function fechaft(){
	
	$("#fts").fadeOut('slow');
	
	}
	
	
function foto(url){

	
var url = "http://www.pousadavilla3lagos.com.br/fotos.php?foto=" + url;




  var width = 1000;
  var height = 600;

  var left = 99;
  var top = 99;

  window.open(url ,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=yes');


}
	
	
	





function mostra(url,tipo){

$("#quadro").fadeIn('slow');
	
var url = "http://www.pousadavilla3lagos.com.br/album.php?album=" + url +"&tipo="+tipo;


req = null; 
// Procura por um objeto nativo (Mozilla/Safari) 
if (window.XMLHttpRequest) { 
req = new XMLHttpRequest(); 
req.onreadystatechange = processReqChange; 
req.open("GET",url,true); 
req.send(null); 
// Procura por uma versao ActiveX (IE) 
} else if (window.ActiveXObject) { 
req = new ActiveXObject("Microsoft.XMLHTTP"); 
if (req) { 



req.onreadystatechange = processReqChange; 
req.open("GET",url,true); 

req.send(); 
} 
} 
} 

function processReqChange() 
{ 


// apenas quando o estado for "completado" 
if (req.readyState == 4) { 

// apenas se o servidor retornar "OK" 

if (req.status ==200) { 

// procura pela div id="pagina" e insere o conteudo 
// retornado nela, como texto HTML 

	resultado = req.responseText.replace(/\+/g," "); 
						resultado = unescape(req.responseText);
document.getElementById('bloco').innerHTML = resultado ; 
tumb();
$("#bt_send").fadeTo("slow", 0.20);
} else { 
alert("Houve um problema ao obter os dados:n" + req.statusText); 
}}

	
	}
	
	
	
	
	function envia() {

var validacao = document.getElementById('valida').value;
 if(validacao=='true'){ $("#alerta").fadeIn('slow')
document.getElementById('alerta').innerHTML="Sua mensagem esta sendo enviada...";


var nome = document.getElementById('nome').value;
var email = document.getElementById('mail').value;
var msg = document.getElementById('msg').value;

var envia = "http://www.pousadavilla3lagos.com.br/envia.php?nome=" + nome +"&email="+email+"&msg="+msg;




  var width = 400;
  var height = 200;

  var left = 99;
  var top = 99;

  window.open(envia ,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

fecha();

}
}




function limpa(campo){
	
	var campo_va = document.getElementById(campo).value;
	
	if(campo == 'nome'){
		
		
		if(campo_va == 'Seu nome'){
			
			document.getElementById(campo).value='';
			
			}
			
				if(campo_va == ''){
			
			document.getElementById(campo).value='Seu nome';
			
			}
		
		
		}
		
		
			if(campo == 'mail'){
		
		
		if(campo_va == 'Seu e-mail'){
			
			document.getElementById(campo).value='';
			
			}
		if(campo_va == ''){
			
			document.getElementById(campo).value='Seu e-mail';
			
			}
		
		}
		
		
					if(campo == 'msg'){
		
		
		if(campo_va == 'Sua mensagem'){
			
			document.getElementById(campo).value='';
			
			}
		if(campo_va == ''){
			
			document.getElementById(campo).value='Sua mensagem';
			
			}
		
		}
		
	
	
	}
	
	
	 function fns(){
		 
		 $("#alerta").fadeOut('slow');
		 
		 }
	
	
	function verifica(campo){
		
		$("#alertad").fadeIn('slow');
		var conteudo = document.getElementById(campo).value;
		var validacao = document.getElementById('valida').value;
		
		if(campo == 'nome'){
		
		var conteudo = document.getElementById(campo).value;
		
		if(conteudo !='Seu nome'){
		var contar = parseInt(conteudo.length);
		
		var total = 8;
		
		if(contar < total){
		var falta = total - contar;
		  
		  document.getElementById('alertad').innerHTML="Seu nome ainda esta muito curto( "+contar+" de "+total+")";
		document.getElementById('valida').value='false';
		}
		if(contar >= total){
			
		document.getElementById('alertad').innerHTML="Agora digite seu e-mail";
		document.getElementById('valida').value='true';
			}
		
		}
		if(conteudo =='Seu nome'){document.getElementById('alertad').innerHTML="Por favor digite seu nome";}
		document.getElementById('valida').value='false';
		}
		
		
		
		if(campo == 'mail'){
			
			
			if(conteudo==""||conteudo.indexOf('@')=="-1"||conteudo.indexOf('.')=="-1"){
				
				document.getElementById('alertad').innerHTML="Seu e-mail esta invalido";
				document.getElementById('valida').value='false';
				}
				
				else{
					document.getElementById('alertad').innerHTML="Agora digite sua mensagem";
				    document.getElementById('valida').value='true';
					
					
					var msgv = document.getElementById('msg').value;
					
					var contar = parseInt(msgv.length);
		
		var total = 20;
		
		if(contar < total){
		var falta = total - contar;
		  
		  document.getElementById('alertad').innerHTML="Suam mensagem ainda esta muito curta( "+contar+" de "+total+")";
		document.getElementById('valida').value='false';}
					
					
					
					
					
					}
			
			if(conteudo =='Seu e-mail'){document.getElementById('alertad').innerHTML="Por favor digite e-mail";
			document.getElementById('valida').value='false';
			}
			
			}
			
			if(campo == 'msg'){
				
				var contar = parseInt(conteudo.length);
		
		var total = 20;
		
		if(contar < total){
		var falta = total - contar;
		  
		  document.getElementById('alertad').innerHTML="Suam mensagem ainda esta muito curta( "+contar+" de "+total+")";
		document.getElementById('valida').value='false';
		}
		
		if(contar >= total){
			
			document.getElementById('alertad').innerHTML="Sua mensagem pode ser enviada";
			 document.getElementById('valida').value='true';
	
			}
		
		}
		if(conteudo =='Sua mensagem'){document.getElementById('alertad').innerHTML="Por favor digite sua mensagem";document.getElementById('valida').value='false';

		}
			
			
			if(validacao == 'true'){
	   $("#bt_send").fadeTo("slow", 1.00);
	   $("#bt_send").addClass("cursor");
	 setTimeout('fns()', 3000);
			}
			
				
				}
				
				
