Event.observe(window, "load", initToc);
function initToc() {
	if(!$("toc-container")) return;
	var toc = document.getElementsByClassName("toc")[0];
	var newToc = toc.cloneNode(true);
	newToc.id = "toc";
	$("body").appendChild(newToc);
	hideToc();
	//Element.hide("toc-container");
	Event.observe("toc", "click", hideToc);
	Event.observe("wrapper", "mouseover", gHideToc);
	var anchors = document.getElementsByClassName("toc-anchor");
	for(var i=0;i<anchors.length;i++) {
		Event.observe( anchors[i], "click", showToc );
	}
}
function gHideToc(e) {
	var firstDiv = Event.findElement(e, "div");
	if(firstDiv.id == "toc") return;
	else hideToc();
}
function hideToc(e) {
	Element.hide("toc");
}
function showToc(e) {
	var theAnchor = Event.element(e);
	var anchorPos = Position.cumulativeOffset(theAnchor);
	$("toc").style.top = ( anchorPos[1] + Element.getHeight(theAnchor) - 5 ).toString() + "px";
	$("toc").style.left = anchorPos[0].toString() + "px";
	Element.show("toc");
	theAnchor.blur();
	Event.stop(e);
}

function url_imagem() {
	  num_imagens = 8
	  ran = Math.round(Math.random() * (num_imagens-1))+1;
	  if (ran == "1"){url_imagem= "img/fotoDestaque/1.jpg";}
	  if (ran == "2"){url_imagem= "img/fotoDestaque/2.jpg";}
	  if (ran == "3"){url_imagem= "img/fotoDestaque/3.jpg";}
	  if (ran == "4"){url_imagem= "img/fotoDestaque/4.jpg";}
	  if (ran == "5"){url_imagem= "img/fotoDestaque/5.jpg";}
	  if (ran == "6"){url_imagem= "img/fotoDestaque/6.jpg";}
	  if (ran == "7"){url_imagem= "img/fotoDestaque/7.jpg";}
	  if (ran == "8"){url_imagem= "img/fotoDestaque/8.jpg";}
	  return url_imagem;
	}

function audio (audio,numero) {
				AC_FL_RunContent(
					'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0',
					'width', '187',
					'height', '24',
					'src', 'player',
					'movie', 'player',
					'id','audioplayer'+numero,
					'quality','high',
					'pluginspage', 'https://www.macromedia.com/go/getflashplayer',
					'menu', 'false',
					'wmode', 'transparent',
					'FlashVars', 'playerID='+numero+'&amp;bg=0xf8f8f8&amp;leftbg=0x009999&amp;lefticon=0x000000&amp;rightbg=0x000000&amp;rightbghover=0x999999&amp;righticon=0x009999&amp;righticonhover=0xFFFFFF&amp;text=0x666666&amp;slider=0x666666&amp;track=0xFFFFFF&amp;border=0x666666&amp;loader=0x9FFFB8&amp;soundFile=http://www.photomundi.com.br/mapamundi/audios/'+audio,
					'allowScriptAccess','sameDomain'
				);
				
				document.write ('<br /><a href="http://www.photomundi.com.br/mapamundi/audios/'+audio+'"><img src="img/download.gif" border="0" onmouseover=""></a>');
}


function validarContato()
{
	msgErros = '';
	cntErros = 0;
	with (document.formContato)
	{
		if (Nome.value.length < 3)
		{
			msgErros += "-> Nome\n";
			cntErros++;
		}
		
		if (Email.value.length < 6)
		{
			msgErros += "-> Email\n";
			cntErros++;
		}
		else
		{
			if (Email.value.indexOf('@',0)==-1 ||
				Email.value.indexOf('@',0)== 0 ||
				Email.value.indexOf('.',0)==-1)
      	{
            msgErros += "-> Email (é inválido)\n";
				cntErros++;
      	}
		}
		
		if (Mensagem.value.length < 5)
		{
			msgErros += "-> Mensagem\n";
			cntErros++;
		}
	
		if (cntErros > 0)
		{
			alert("Você precisa preencher corretamente o(s) campo(s)\n abaixo para poder enviar o formulário:\n" + msgErros);
		}
		else
		{
			if (confirm("Você confirma as informações contidas no formulário?"))
			{
				action = "http://www.hospedageminteligente.com.br/formmail/envia_mail_hosts.php";
				submit();
			}
		}
	}

}
