
// Se o navegador não for ie6, substitiu as fontes -------------------
function detectBrowser(){
	var b_version=navigator.appVersion;
	if (b_version!="4.0 (compatible; MSIE 6.0; Windows NT 5.1)") {
		FLIR.init();
		FLIR.auto(['h1']);
	}
}
//---------------------------------------------------------------------

// SELEÇÃO DE MENU ------------------
function setActiveTab(tabID) {
	var currTabElem = document.getElementById(tabID);
	currTabElem.setAttribute("class", "atual");
	currTabElem.setAttribute("className", "atual");
	return;
}
//-----------------------------------


function Proximo(idAlvo){
	valorAlvo = idAlvo + 1;
	alvo1 = 'setas'+idAlvo;
	alvo2 = 'setas'+valorAlvo;
	document.getElementById(alvo1).style.display='none';
	document.getElementById(alvo2).style.display='';
//	alert (alvo2);
}
function Anterior(idAlvo){
	valorAlvo = idAlvo - 1;
	alvo1 = 'setas'+idAlvo;
	alvo2 = 'setas'+valorAlvo;
	document.getElementById(alvo1).style.display='none';
	document.getElementById(alvo2).style.display='';
}
	
function Mostrar(alvo){
	alvo1='Mensagem';
	document.getElementById(alvo).style.display='block';
//	alert (alvo2);
}
function Esconder(alvo){
	alvo1='Mensagem';
	document.getElementById(alvo).style.display='none';
//	alert (alvo2);
}

// Pop-up Dreamweaver ---------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-----------------------------------------------------



// CSS Selector --------------------------------------
/*
CSS Browser Selector v0.2.7
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();

//-----------------------------------------------------




// AJAX básico ---------------


function Reposicao(url) {
        var httpRequest;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            httpRequest = new XMLHttpRequest();
            if (httpRequest.overrideMimeType) {
                httpRequest.overrideMimeType('text/xml');
                // See note below about this line
            }
        } 
        else if (window.ActiveXObject) { // IE
            try {
                httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } 
                catch (e) {
                           try {
                                httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                               } 
                             catch (e) {}
                          }
                                       }

        if (!httpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        httpRequest.onreadystatechange = function() { Escrever(httpRequest); };
        httpRequest.open('GET', url, true);
        httpRequest.send('');

    }

    function Escrever(httpRequest) {

        if (httpRequest.readyState == 4) {
            if (httpRequest.status == 200) {
                document.getElementById('ConteudoAjax').innerHTML =	httpRequest.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }

    }

//-----------------------------------------------------



// Correctly handle PNG transparency in Win IE 5.5 or higher.
// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004

function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
window.attachEvent("onload", correctPNG);

//-----------------------------------------------------

function OnFocus(id, cor, valor_atual){
	var obj = document.getElementById(id);
	if (obj.value==valor_atual){
		obj.value='';
		obj.style.color = cor;
	}
}
function OnBlur(id, cor, valor_atual){
	var obj = document.getElementById(id);
	if (obj.value==''){
		obj.style.color = cor;
		obj.value=valor_atual;
		
	}
}
function Validar() {
	var strNome = document.getElementById('nome');
	var strEmail = document.getElementById('email');
	var strAemail = document.getElementById('aemail');
	
	if (!strNome.value) { alert('Campo nome faltando.'); strNome.focus(); return (false); }
	if (!strEmail.value) { alert('Campo email faltando.'); strEmail.focus(); return (false); }
	if (!strAemail.value) { alert('Campo email do destinatário faltando.'); strAemail.focus(); return (false); }
}
function ValidarComentario() {
	var strNome = document.getElementById('nome');
	var strEmail = document.getElementById('email');
	var strTexto = document.getElementById('texto');
	
	if (!strNome.value) { alert('Campo nome faltando.'); strNome.focus(); return (false); }
	if (!strEmail.value) { alert('Campo email faltando.'); strEmail.focus(); return (false); }
	if (!strTexto.value) { alert('Campo texto faltando.'); strTexto.focus(); return (false); }
}

function validaForm(){
	d = document.reserva;
	//validar nome
	if (d.nome.value == ""){
			 alert("O campo Nome deve ser preenchido!");
			 d.nome.focus();
			 return false;
	}
	//validar telefone
	if (d.telefone.value == ""){
			 alert("O campo Telefone deve ser preenchido!");
			 d.telefone.focus();
			 return false;
	}
	//validar data pretendida
	if (d.data_pretendida.value == ""){
			 alert("O campo Data Pretendida deve ser preenchido!");
			 d.data_pretendida.focus();
			 return false;
	}
	//validar quantidade de adultos
	if (d.qtd_adultos.value == ""){
			 alert("O campo Quantidade de Adultos deve ser preenchido!");
			 d.qtd_adultos.focus();
			 return false;
	}
}
