function CarregaFlashBg(caminho,largura,altura,corBg)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
	document.write('width="'+largura+'" height="'+altura+'">');
	document.write('<param name="movie" value="'+caminho+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="'+corBg+'">');
	document.write('<param name="wmode" value="opaque">');
	document.write('<param name="menu" value="false">');
	document.write('<embed src="'+caminho+'" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer"');
	document.write('type="application/x-shockwave-flash" bgcolor="'+corBg+'" width="'+largura+'" height="'+altura+'"></embed>');
	document.write('</object>');
}

<!-- Copyright 2000 - Galichon Enterprises, Inc.  rich@galichon.net  http://www.galichon.net
// Permission granted to SimplytheBest.net to list the script in the DHTML scripts library
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function banner(img_source,url,alt,title,chance)
{
   this.img_source = img_source;
   this.url = url;
   this.alt = alt;
   this.title = title;
   this.chance = chance;
}

function display()
{
   with (this) document.write("<a href=" + url + "><img src='" + img_source + "' width=468 height=60 border=0 alt='" + alt + "' + title='" + title + "'></a>");
}

banner.prototype.display = display;
banners = new Array();
banners[0] = new banner("img/buzios.gif",
                        "http://buzioshostel.com.br/ target='_blank'",
                        "Albergue de B&uacute;zios",
						"Albergue de B&uacute;zios",
                        10);
banners[1] = new banner("img/forte_principe.gif",
                        "http://www.forteprincipe.com.br/ target='_blank'",
                        "Albergue Forte Pr&iacute;ncipe",
						"Albergue Forte Pr&iacute;ncipe",
                        10);
banners[2] = new banner("img/maracaia.gif",
                        "http://www.maracaiahostel.com.br/ target='_blank'",
                        "Albergue Maracaia",
						"Albergue Maracaia",
                        10);
banners[3] = new banner("img/marina_dos_anjos.gif",
                        "http://www.marinadosanjos.com.br/ target='_blank'",
                        "Albergue Marina dos Anjos", 
						"Albergue Marina dos Anjos",
                        10);
banners[4] = new banner("img/na_toca.gif",
                        "http://www.natocahostel.com.br/ target='_blank'",
                        "Albergue Na Toca", 
						"Albergue Na Toca",
                        10);
banners[5] = new banner("img/olinda.gif",
                        "http://www.alberguedeolinda.com.br/ target='_blank'",
                        "Albergue de Olinda",
						"Albergue de Olinda",
                        10);
banners[6] = new banner("img/arraial.gif",
                        "http://www.arraialdajudahostel.com.br/ target='_blank'",
                        "Albergue de Arraial D'Ajuda",
						 "Albergue de Arraial D'Ajuda", 
                        10);
banners[7] = new banner("img/portal_do_pantanal.gif",
                        "http://www.portaldopantanal.com.br/ target='_blank'",
                        "Albergue Portal do Pantanal", 
						"Albergue Portal do Pantanal",
                        10);
banners[8] = new banner("img/porto_salvador.gif",
                        "http://www.alberguedoporto.com.br/ target='_blank'",
                        "Albergue Porto Salvador",
						"Albergue Porto Salvador",
                        10);
banners[9] = new banner("img/porto_seguro.gif",
                        "http://www.portosegurohostel.com.br/ target='_blank'",
                        "Albergue de Porto Seguro",
						"Albergue de Porto Seguro",
                        10);
banners[10] = new banner("img/praca_da_arvore.gif",
                        "http://www.spalbergue.com.br/ target='_blank'",
                        "Albergue Pra&ccedil;a da &Aacute;rvore",
						"Albergue Pra&ccedil;a da &Aacute;rvore",
                        10);
banners[11] = new banner("img/praia_do_ferrugem.gif",
                        "http://www.hostelferrugem.hpg.ig.com.br/ target='_blank'",
                        "Albergue Praia do Ferrugem",
						"Albergue Praia do Ferrugem",
                        10);
banners[12] = new banner("img/praia_do_forte.gif",
                        "http://www.albergue.com.br/ target='_blank'",
                        "Albergue Praia do Forte",
						"Albergue Praia do Forte",
                        10);
banners[13] = new banner("img/campos_do_jordao.gif",
                        "http://www.camposdojordaohostel.com.br/ target='_blank'",
                        "Albergue de Campos do Jord&atilde;o",
						"Albergue de Campos do Jord&atilde;o",
                        10);

sum_of_all_chances = 0;

for (i = 0; i < banners.length; i++) 
	{
   		sum_of_all_chances += banners[i].chance;
	}
	
function display_banner(id) 
{
   chance_limit = 0;
   randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
   for (i = 0; i < banners.length; i++) 
   {
      chance_limit += banners[i].chance;
      if (randomly_selected_chance <= chance_limit) 
	  	{
         document.getElementById(id).innerHTML = "<a href=" + banners[i].url + "><img src='" + banners[i].img_source + "' width=468 height=60 border=0 alt='" + banners[i].alt + "' title='" + banners[i].title + "'></a>";
         return banners[i]; 
         break;
      }
   }
}

setInterval("display_banner('banner')", 5000);
//-->

//  VALIDA O FORMULARIO
function trim(texto) {

  MAX_LOOP = 1000;

  resultado = texto.toString();

  i=0;

  while (resultado.lastIndexOf(' ')==(resultado.length-1)) {

      resultado = resultado.substr(0,resultado.length-1);

      if (resultado=='') { return ''; }

      i++;

      if (i>MAX_LOOP) { return ''; }

  }

  i=0;

  while (resultado.substr(0,1)==' ') {

      resultado = resultado.substr(1,resultado.length-1);

      if (resultado=='') { return ''; }

      i++;

      if (i>MAX_LOOP) { return ''; }

  }

  return resultado;

}

//------------------------------------------------------------------------------

function validar ( )

{

  nome = trim(document.contato.nome.value);

  if (nome=='') { alert('Digite seu nome'); document.contato.nome.focus(); return false; }

  email = trim(document.contato.email.value); 

  if (email=='') { alert('Digite seu e-mail'); document.contato.email.focus(); return false; }

  if (document.contato.email.value.indexOf('@',0) == -1) { alert('Preencha seu e-mail corretamente'); document.contato.email.focus(); return false; }

  if (document.contato.email.value.indexOf('.',0) == -1) { alert('Preencha seu e-mail corretamente'); document.contato.email.focus(); return false; }

  mensagem = trim(document.contato.mensagem.value);

  if (mensagem=='') { alert('Digite sua mensagem'); document.contato.mensagem.focus(); return false; }

}