var map = null;
$(document).ready(function(e) {
	CarregarMapa();
})
function CarregarMapa() 
{
	if (GBrowserIsCompatible())
	{
		map = new GMap2(document.getElementById("mapa"));
		var oIcone = new GIcon();
		oIcone.image = "http://www.go2web.com.br/go2web/imagens/marcador.png";
		oIcone.shadow = "http://www.go2web.com.br/go2web/imagens/sombra.png";
		oIcone.iconSize = new GSize(20, 34);
		oIcone.shadowSize = new GSize(20, 34);
		oIcone.iconAnchor = new GPoint(9, 34);
		oIcone.infoWindowAnchor = new GPoint(9, 2);
		oIcone.infoShadowAnchor = new GPoint(9, 2);
		oIcone.transparent = "http://www.go2web.com.br/go2web/marcador_transparente.png";
		oIcone.printImage = "coldmarkerie.gif";
		oIcone.mozPrintImage = "coldmarkerff.gif";
		map.setCenter(new GLatLng(-23.003503,-43.316705), 12);
		//map.setUIToDefault();
		map.addControl(new GSmallMapControl());
		var oPontoInicial = Plotar('<h1 class="mapa"><img src="/imagens/logogo2web.gif" alt="Go2web" align="absmiddle"/></h1><div>Barra da Tijuca - Shopping Downtown</div><div>Av. das Américas, 500 - Bloco 16, portaria B, sala 302</div>',oIcone,new GLatLng(-23.003503,-43.316705), 2);
		map.addOverlay(oPontoInicial);
		map.addOverlay(Plotar('<h1 class="mapa"><img src="/imagens/logogo2web.gif" alt="Go2web" align="absmiddle"/></h1><div>Barra da Tijuca - Shopping Downtown</div><div>Av. das Américas, 500 - Bloco 16, portaria B, sala 302</div>',oIcone,new GLatLng(-23.003503,-43.316705), 2));
		//Mostrar o balao do ponto inicial
		GEvent.trigger(oPontoInicial,"click");
		//SobreescreverImagem('inicio');
	}
}

function Plotar(titulo, oIcone, latlng, codigo) 
{
	var oPonto = new GMarker(latlng,oIcone);
	oPonto.value = codigo;
	GEvent.addListener(oPonto,"click", function() {
		var sHtmlPonto = titulo;
		map.openInfoWindowHtml(latlng, sHtmlPonto);
	});
	return oPonto;
}

/*
function SobreescreverImagem(ref)
{
	if (!ref)
		$($('#mapa img').get(22)).attr('src','imagens/mapa_sobreescrita_downtown.png');
	else
		setTimeout("SobreescreverImagem()",2000);	
}
*/

function critica(frm)
{
	var texto, msgaux, erro;
	 
	msgaux = 'Os campos listados abaixo são de preenchimento obrigatório.\n' 
	erro=false;
	
	//Campo Nome
	
	texto = frm.txtDescricao.value; 
 	if (texto.length == 0)  
 	{ 
        msgaux+='\n. Nome';      
        erro=true;
 	} 

	//Campo E-mail

	texto = frm.txtEmail.value; 
 	if (texto.length == 0)  
 	{ 
        msgaux+='\n. e-mail';      
        erro=true;
 	} 
	
	//Campo Telefone

	texto = frm.txtTelefone.value; 
 	if (texto.length == 0)  
 	{ 
        msgaux+='\n. Telefone';      
        erro=true;
 	} 

	//Campo Assunto

	texto = frm.txtAssunto.value; 
 	if (texto.length == 0)  
 	{ 
        msgaux+='\n. Assunto';      
        erro=true;
 	} 
	
	//Campo Mensagem
	
	texto = frm.txtMensagem.value; 
 	if (texto.length == 0)  
 	{ 
        msgaux+='\n. Mensagem';
        erro=true;
 	} 
	
	if  (!EmailValido(frm.txtEmail))
	{
		msgaux+='\n. e-mail inválido';      
        erro=true;
	}
	if (erro) alert(msgaux);
	
    return !(erro);
} 