
var	valor = 30;

function fecharPopUp(){
	valor = valor-1
	if(valor == 9){
		document.getElementById('pop').style.display = 'none';
		document.getElementById("divAlpha").style.display = 'none';					
		return false;
	}
	setTimeout ('fecharPopUp()', 1);
	document.getElementById("pop").style.filter = "alpha(opacity="+valor+");";		
	document.getElementById("pop").style.opacity = "."+valor+"";
	//
	document.getElementById("divAlpha").style.filter = "alpha(opacity="+valor+");";		
	document.getElementById("divAlpha").style.opacity = "."+valor+"";
	
}



// Aqui definimos o tempo para fechar o pop-up automaticamente
function abrirPopUp(){
	document.getElementById("pop").style.display = 'block'
	document.getElementById("divAlpha").style.display = 'block';					

	setTimeout ('fecharPopUp()', 2000);
}






// JavaScript Document

/********************************************************************/
/* FUNÇÃO PARA APARECER E DESEPARECER PALHETA DE CORES (TEMAS)      */	
/********************************************************************/

window.document.onkeydown =  KeyPressAscCode;
function KeyPressAscCode(e) { 
 	var tecla
	
	if(!e){
		e=window.event;
	}
//pega o código da tecla
	if(e.keyCode){ 
		tecla = e.keyCode;
	}else if(e.which){
        tecla = e.which;
    }else if(e.charCode){
        tecla = e.charCode;
    }else{
        tecla = void(0);
    }
	
	if(tecla == 27){
		sumirTudo('divAlpha');
		}
 } 

function sumirTudo(id){

	var ids = new Array() 
	ids[0] = 'subRolley'
	ids[1] = 'subQuadra'
	ids[2] = 'subInfra'
	ids[3] = 'subEscol'	
	ids[4] = 'mapa'
	ids[5] = 'divAlpha'
	ids[6] = 'video'	
	

	for (i=0;i<7;i++){
		document.getElementById(ids[i]).style.visibility = 'hidden'
	}

	//
	
	divMapa = ids[5]
	document.getElementById(divMapa).style.display = 'none';					
	document.getElementById(divMapa).style.visibility = 'hidden';						
}

function aparecer(div){
	cancelar_hide();
	document.getElementById(div).style.visibility = 'visible';
		//se o objeto chamado for a div id="mapa" aparece a div transparente
		if(div == "mapa"){
		document.getElementById("divAlpha").style.display = 'block';					
		document.getElementById("divAlpha").style.visibility = 'visible';
		carregaMapa()
		}
		
		if(div == "video"){
		document.getElementById("divAlpha").style.display = 'block';					
		document.getElementById("divAlpha").style.visibility = 'visible';
		carregaVideo()
		}		
}

function sumir(div){
	div_aux = div
	time = setTimeout ("document.getElementById(div_aux).style.visibility = 'hidden'", 1000);

}

function cancelar_hide(){
	try{
	clearTimeout(time);
	}catch(e){}
}


function valida()
	{
	vazio = "false";
	if (document.form1.nome.value=="")
		{
		alert("O nome tem que ser preenchido");
		document.form1.nome.focus();
		return false;
		}
	if(document.form1.telefone.value=="")
		{
		alert("O Telefone deve ser preenchido");
		document.form1.telefone.focus();
		return false;
		}
	if(document.form1.email.value=="")
		{
		alert("O e-mail deve ser preenchido");
		document.form1.email.focus();
		return false;
		}
	if(document.form1.mensagem.value=="")
		{
		alert("A Mensagem deve ser preenchido");
		document.form1.mensagem.focus();
		return false;
		}
		document.form1.submit();
}

function reset_form()
{
	document.form1.reset();
}

function carregaMapa(){
	var maps = '<a href="javaScript:;" onClick="sumirTudo()"><img src="images/closelabel.gif" alt="Fechar" /></a><iframe width="500" height="411" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=rolley+ball&amp;sll=-23.66807,-46.705048&amp;sspn=0.013423,0.019312&amp;ie=UTF8&amp;ll=-23.655846,-46.700649&amp;spn=0.013423,0.019312&amp;z=14&amp;iwloc=A&amp;cid=-23666690,-46704836,9080453736710719396&amp;output=embed&amp;s=AARTsJpZuoWGlf9Av9UFam5rrjQyw_1bzA"></iframe><br /><small><a href="http://maps.google.com.br/maps?f=q&amp;source=embed&amp;hl=pt-BR&amp;geocode=&amp;q=rolley+ball&amp;sll=-23.66807,-46.705048&amp;sspn=0.013423,0.019312&amp;ie=UTF8&amp;ll=-23.655846,-46.700649&amp;spn=0.013423,0.019312&amp;z=14&amp;iwloc=A&amp;cid=-23666690,-46704836,9080453736710719396" style="color:#;text-align:left">Exibir mapa ampliado</a></small>'
		
		document.getElementById('mapa').innerHTML = maps;
	
}
function carregaVideo(){
	var vdo = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/qAzOWNWtaPE&hl=pt-br&fs=1&color1=0x234900&color2=0x4e9e00">              </param>              <param name="allowFullScreen" value="true">              </param>              <param name="allowscriptaccess" value="always">              </param>              <embed src="http://www.youtube.com/v/qAzOWNWtaPE&hl=pt-br&fs=1&color1=0x234900&color2=0x4e9e00" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>            </object>'		
		document.getElementById('video').innerHTML = vdo;
	
}