// JavaScript Document

<!--
if(Browser == undefined){
var Browser = {
isIE: function(){ return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
}
}

var Flash = function(movie, id, width, height, initParams){

this.html = "";
this.attributes = this.params = this.variables = null;

this.variables = new Array();
this.attributes = {
"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0",
"type": "application/x-shockwave-flash"
}
this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer_br" };
this.params = { "wmode": "transparent" };

if(movie) {
this.addAttribute("data", movie);
this.addParameter("movie", movie);
}

if(id && id != null) this.addAttribute("id", id);
if(width) this.addAttribute("width", width);
if(height) this.addAttribute("height", height);

if(initParams != undefined){
for(var i in initParams){
this.addParameter(i.toString(), initParams[i]);
}
}

}
Flash.version = "1.2b";
Flash.getObjectByExceptions = function(obj, excep){
var tempObj = {};
for(var i in obj){
var inclui = true;
for(var j=0; j<excep.length; j++)
if(excep[j] == i.toString()) { inclui = false; break; };
if(inclui) tempObj[i] = obj[i];
}
return tempObj;
}
Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; }
Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; }
Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); }
Flash.prototype.getFlashVars = function(){
var tempString = new Array();

for(var i=0; i<this.variables.length; i++)
tempString.push(this.variables[i].join("="));

return tempString.join("&");
}
Flash.prototype.toString = function(){

this.params.flashVars = this.getFlashVars();
if(Browser.isIE()){
//IE
this.html = "<ob" + "ject";
var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
this.html += "> ";
var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
this.html += " </obj" + "ect>";
} else {
//non-IE
this.html = "<!--[if !IE]> <--> <obj" + "ect";
var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
this.html += "> ";
var params = Flash.getObjectByExceptions(this.params, ["extend"]);
for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
this.html += " </obj" + "ect> <!--> <![endif]-->";
}

return this.html;

}
Flash.prototype.write = Flash.prototype.outIn = Flash.prototype.writeIn = function(w){
if(typeof w == "string" && document.getElementById) var w = document.getElementById(w);
if( w != undefined && w ) w.innerHTML = this.toString();
else document.write( this.toString() );
}
//-->

<!--jumpmenu
function MM_jumpMenu(targ,selObj,restore, url){ //v3.0
if(url != undefined) open(url, '', '_blank');
else
   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->

/* favoritos - alterar */
function addFav(){
    var url      = "http://www.agualindahotel.com.br";
    var title    = "Agualinda Hotel - Alter do Chao - PA";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}


/* recomenda */
function indique(url)
{

	window.open(url, "indicacao",'top=100,left=100,height=220,width=400,location=no,resizable=no,scrollbars=no,status=no'); 
}


//here you place the ids of every element you want.
var ids=new Array('1','2','3');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


function abre(url,janela,larg,alt,scroll,pos1,pos2){
window.open(url,janela,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=no,copyhistory=no,top='+pos1+',left='+pos2+',screenY='+pos1+',screenX='+pos2+',width='+larg+',height='+alt);
}


function menu_over(src,clrOver) {
 if (!src.contains(event.fromElement)) {
  src.style.cursor = 'hand';
  src.bgColor = clrOver;
 }
}
function menu_out(src,clrIn) {
 if (!src.contains(event.toElement)) {
  src.style.cursor = 'default';
  src.bgColor = clrIn;
 }
}

function janela(param,w,h,nome) {
   var nomearq = param;
   var windowvar = window.open(nomearq,nome,"scrollbars=yes,location=no,directories=no,status=yes,menubar=no,resizable=no,toolbar=no,top=0,left=0,width="+ w + ",height=" +h );
}

function erro(msg) {
	alert(msg);
	return false;
}

function erro_focus(msg, obj) {
	alert(msg);
	obj.focus();
	return false;
}

//valida data
function validDate(obj){
 date=obj.value
if (/[^\d/]|(\/\/)/g.test(date))  {obj.value=obj.value.replace(/[^\d/]/g,'');obj.value=obj.value.replace(/\/{2}/g,'/'); return }
if (/^\d{2}$/.test(date)){obj.value=obj.value+'/'; return }
if (/^\d{2}\/\d{2}$/.test(date)){obj.value=obj.value+'/'; return }
if (!/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(date)) return

 test1=(/^\d{1,2}\/?\d{1,2}\/\d{4}$/.test(date))
 date=date.split('/')
 d=new Date(date[2],date[1]-1,date[0])
 test2=(1*date[0]==d.getDate() && 1*date[1]==(d.getMonth()+1) && 1*date[2]==d.getFullYear())
 if (test1 && test2) return true
 alert("Data inválida")
 obj.select();
 obj.focus()
 return false
}

// verifica o email digitado.
function emailValido(mail) {
	return mail.match(/[0-9A-Za-z\.\_\-]+\@{1,1}[0-9A-Za-z\_\-]+\.{1,1}[0-9A-Za-z\_\-]+/);
}

// retorna se um campo está vazio desconsiderando espaços no início e no final
function vazio(valor) {
	s = new String(valor);
	s = s.replace(/^ +/, '');
	s = s.replace(/ +$/, '');
	return s.length == 0;
}

// retorna se um identificador contém apenas caracteres válidos
function idValido(id) {
	s = new String(id);
	validos = new String('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_');
	valido = true;
	for (i = 0; i < s.length; i++) valido = valido && validos.indexOf(s.charAt(i)) != -1;
	return valido && !vazio(id);
}




/* limpa form */
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 


/* limpa form e restaura padrões se nada for inserido */
function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}
function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}



/* valida email */

function valida_news (form1)

{

if (form1.Nome.value=="Nome")

{ alert ("Erro! Voce deve informar seu nome para continuar."); return false; }

if (form1.Email.value=="E-mail")

{ alert ("Erro! Voce deve informar um e-mail para continuar."); return false; }

if (form1.Email.value.indexOf('@', 0) == -1 )

{ alert ("Erro! Informe o e-mail corretamente para continuar."); return false; }

return true;

}



