function fale_conosco_enviar(){
	contato_nome = document.getElementById('nome_contato');
	contato_email = document.getElementById('email_contato');
	contato_tel = document.getElementById('tel_contato');
	contato_cel = document.getElementById('cel_contato');
	contato_cidade = document.getElementById('cidade_contato');
	contato_mensagem = document.getElementById('mensagem_contato');
	
	if(contato_nome.value==''){
		alert('Preencha seu nome');
		contato_nome.focus();
		return false;
		}
	if(contato_email.value==''){
		alert('Preencha seu email');
		contato_email.focus();
		return false;
		}
	if(contato_tel.value==''){
		alert('Preencha seu telefone');
		contato_tel.focus();
		return false;
		}
	if(contato_cel.value==''){
		alert('Preencha seu celular');
		contato_cel.focus();
		return false;
		}
	if(contato_cidade.value==''){
		alert('Preencha sua cidade');
		contato_cidade.focus();
		return false;
		}
	if(contato_mensagem.value==''){
		alert('Preencha sua mensagem');
		contato_mensagem.focus();
		return false;
		}
	carregaAjax('php/fale_conosco_insere.php?op=1&contato_nome='+contato_nome.value+'&contato_email='+contato_email.value+'&contato_tel='+contato_tel.value+'&contato_cel='+contato_cel.value+'&contato_cidade='+contato_cidade.value+'&contato_mensagem='+contato_mensagem.value,'dv_contato','dv_contato_carregando');
	
	}
//////////////////////////////////////////////////////////////

function enviar_cadastro(){
	
	cad_nome = document.getElementById('cadastro_nome');
	cad_email = document.getElementById('cadastro_email');
	cad_email_confere = document.getElementById('cadastro_email_confere');
	cad_cidade = document.getElementById('cadastro_cidade');
	cad_uf = document.getElementById('cadastro_uf');
	cad_pais = document.getElementById('cadastro_pais');
	cad_sexo_m = document.getElementById('cadastro_sexo_m');
	cad_sexo_f = document.getElementById('cadastro_sexo_f');
	cad_nasc = document.getElementById('cadastro_nasc');
	cad_login = document.getElementById('cadastro_login');
	cad_senha = document.getElementById('cadastro_senha');
	cad_senha_confere = document.getElementById('cadastro_senha_confere');
	
	if(cad_nome.value==''){
		alert('Preencha seu nome');
		cad_nome.focus();
		return false;
		}
	if(cad_email.value==''){
		alert('Preencha seu email');
		cad_email.focus();
		return false;
		}
	if(cad_email_confere.value==''){
		alert('Preencha sua confirmação de email');
		cad_email_confere.focus();
		return false;
		}
	if(cad_email.value!=cad_email_confere.value){
		alert('Sua confirmação de email não está correta');
		cad_email_confere.focus();
		return false;
		}
	if(cad_cidade.value==''){
		alert('Preencha sua cidade');
		cad_cidade.focus();
		return false;
		}
	if(cad_uf.value==''){
		alert('Preencha seu estado');
		cad_uf.focus();
		return false;
		}
	if(cad_pais.value==''){
		alert('Preencha seu pais');
		cad_pais.focus();
		return false;
		}
	if(cad_sexo_m.checked==false && cad_sexo_f.checked==false){
		alert('Informe seu sexo');
		return false;
		}
	if(cad_sexo_m.checked==true){
		sexo_envia='m';
		} else {
		sexo_envia='f';
		}
	if(cad_nasc.value==''){
		alert('Informe sua data de nascimento');
		cad_nasc.focus();
		return false;
		}
	if(cad_login.value==''){
		alert('Preencha seu login');
		cad_login.focus();
		return false;
		}
	if(cad_senha.value==''){
		alert('Preencha sua senha');
		cad_senha.focus();
		return false;
		}
	if(cad_senha_confere.value==''){
		alert('Preencha sua confirmação de senha');
		cad_senha_confere.focus();
		return false;
		}
	if(cad_senha.value!=cad_senha_confere.value){
		alert('Sua confirmação de senha não confere. Por favor digite sua senha novamente');
		cad_senha.focus();
		return false;
		}
		
	carregaAjax('php/cadastro_insere.php?op=1&cad_nome='+cad_nome.value+'&cad_email='+cad_email.value+'&cad_cidade='+cad_cidade.value+'&cad_uf='+cad_uf.value+'&cad_pais='+cad_pais.value+'&cad_sexo='+sexo_envia+'&cad_nasc='+cad_nasc.value+'&cad_login='+cad_login.value+'&cad_senha='+cad_senha.value,'dv_cadastro','dv_cadastro_carregando');
	
	}

////////////////////////////////////////////////////////

function mascara(alvo,formato,e){
		//L = letras
		//9 = números
		//onKeyPress="return mascara('id_campo','LLL-9999',event);"
		
		if (e.keyCode) { 
			 tecla = e.keyCode;   
		  }  else if (e.which) { 
			 tecla = e.which;   
		  }  else {    
			 return false;   
		  }
	
		if(tecla==8 || tecla==9 || tecla==46 || tecla==37 || tecla==39){
			return true;
			}
	
		alvo = document.getElementById(alvo);
		texto = alvo.value;
		
		tamanho_texto = texto.length;
		tamanho_formato = formato.length;
		
		if(tamanho_texto>(tamanho_formato-1)){
			return false;
			}
		
		charAtual = String.fromCharCode(tecla);
		
		i=tamanho_texto;
		formatoAtual = formato.charAt(i);
		formatoProximo = formato.charAt((i+1));
			
			if(formatoAtual!='L' && formatoAtual!='9'){
					alvo.value = texto+formatoAtual;
					formatoAtual = formatoProximo;
					}
			
			if(formatoAtual=='L'){
				
					busca=/[a-zA-Z]/;
					if(charAtual.search(busca)==-1){
						return false;
				  		} 
				
				} else if (formatoAtual=='9'){
				
					busca=/\d/;
					if(charAtual.search(busca)==-1){
						return false;
				  		}
				
				} else {
					return false;
				}
		
		return true
	
	}

////////////////////////////////////////////

function parada_out(id){

	oculta('btn_down_'+id);
	mudarCor('parada_lista_'+id,'#EEEEEE');
	
	}

////////////////////////////////////////////

function parada_sobre(id){

	exibe('btn_down_'+id);
	mudarCor('parada_lista_'+id,'#E9DFDF');
	
	}

////////////////////////////////////////////
function lancamento_out(id){

	oculta('btn_down_'+id);
	mudarCor('lancamento_lista_'+id,'#EEEEEE');
	
	}

////////////////////////////////////////////

function lancamento_sobre(id){

	exibe('btn_down_'+id);
	mudarCor('lancamento_lista_'+id,'#E9DFDF');
	
	}

////////////////////////////////////////////

function mudarCor(id_elem,cor) {
	alvo = document.getElementById(id_elem);
	if (alvo.style) {
		alvo.style.backgroundColor = cor
	}
}

////////////////////////////////////////////

function cadastrar_radio(){
	nome = document.getElementById('cp_radio_nome');
	responsavel = document.getElementById('cp_radio_responsavel');
	endereco = document.getElementById('cp_radio_endereco');
	telefone = document.getElementById('cp_radio_telefone');
	bairro = document.getElementById('cp_radio_bairro');
	cidade = document.getElementById('cp_radio_cidade');
	uf = document.getElementById('cp_radio_uf');
	site = document.getElementById('cp_radio_site');
	cad_email = document.getElementById('cp_radio_email');
	

	
	if(nome.value==''){
		alert('Preencha seu nome');
		nome.focus();
		return false;
		} 
	if(responsavel.value==''){
		alert('Preencha o nome do responsável');
		responsavel.focus();
		return false;
		} 
	if(endereco.value==''){
		alert('Preencha o endereço da rádio');
		endereco.focus();
		return false;
		} 
	if(telefone.value==''){
		alert('Preencha o telefone da rádio');
		telefone.focus();
		return false;
		} 
	if(bairro.value==''){
		alert('Preencha o bairro da rádio');
		bairro.focus();
		return false;
		} 
	if(cidade.value==''){
		alert('Preencha a cidade da rádio');
		cidade.focus();
		return false;
		}
	if(uf.value==''){
		alert('Preencha o nome do Estado de sua cidade');
		uf.focus();
		return false;
		}
	if(site.value==''){
		alert('Preencha o site da rádio');
		site.focus();
		return false;
		} 
	if(cad_email.value==''){
		alert('Preencha o email da rádio');
		cad_email.focus();
		return false;
		} 
		
	carregaAjax('php/radios_insere.php?insere=1&rad_nome='+nome.value+'&rad_responsavel='+responsavel.value+'&rad_endereco='+endereco.value+'&rad_tel='+telefone.value+'&rad_bairro='+bairro.value+'&rad_cidade='+cidade.value+'&rad_uf='+uf.value+'&rad_site='+site.value+'&rad_email='+cad_email.value,'dv_radios_cadastro','dv_radios_cadastro_carregando');
	
	}

////////////////////////////////////////////

function executarAoEnter(e,funcao,vars){
	
	<!--  onKeyPress="return executarAoEnter(event,funcao,'vars');" !-->
  
  if (e.keyCode) { // IE   
    tecla = e.keyCode;   
  }  else if (e.which) { // Firefox   
    tecla = e.which;   
  }  else { // Sei lá! :P   
    return false;   
  }   
	
	if(tecla==13){
		if(funcao!=undefined){
				exec = funcao;
				exec(vars);
				}
		return false;
		}
}

////////////////////////////////////////////

function buscar(){
	busca = document.getElementById('cp_buscar');
	if(busca.value==''){
		alert('Preencha sua busca');
		busca.focus();
		return false;
		} 
	load_pg('php/busca.php?busca='+busca.value);
	}

///////////////////////////////////////////////////

function load_pg(arquivo){
	carregaAjax(arquivo,'dv_palco','dv_palco_carregando');
	}

///////////////////////////////////////////////////

function login_sair(){
	carregaAjax('php/form_login.php?sair=1','dv_login','dv_login_carregando',irParaInicial);
	}

///////////////////////////////////////////////////

function irParaInicial(){
	window.location.href='../index.php';
	}

///////////////////////////////////////////////////

function executalogin(){
	entre_login = document.getElementById('cp_email');
	entre_senha = document.getElementById('cp_senha');

	if(entre_login.value==''){
		alert('Preencha seu email');
		entre_login.focus();
		return false;
		}
	if(entre_login.value=='Email'){
		alert('Preencha seu email');
		entre_login.focus();
		return false;
		}
	if(entre_senha.value==''){
		alert('Preencha sua senha');
		entre_senha.focus();
		return false;
		}

	carregaAjax('php/form_login.php?entra_log='+entre_login.value+'&entra_pwd='+entre_senha.value,'dv_login','dv_login_carregando',irParaInicial);
	
	}

///////////////////////////////////////////////////

function load_form_lembrar_senha_envia(){
	email = document.getElementById('lembrar_senha');
	if(email.value==''){
		alert('Informe seu email');
		email.focus();
		return false;
		}
	carregaAjax('php/form_lembrar_senha.php?email_lembrar_senha='+email.value,'dv_login','dv_login_carregando');
	}
	
///////////////////////////////////////////////////

function load_form_lembrar_senha(){
	carregaAjax('php/form_lembrar_senha.php','dv_login','dv_login_carregando');
	}

///////////////////////////////////////////////////

function load_form_login(){
	carregaAjax('php/form_login.php','dv_login','dv_login_carregando');
	}

///////////////////////////////////////////////////

function calendario(alvo){
		var local = document.getElementById(alvo);
		$(function() {
			$(local).datepicker({ });
			});
		}

////////////////////////////////////////////////////	

function cadastro_newsletter(){
	var nome = document.getElementById('newsletter_nome');
	var email = document.getElementById('newsletter_email');
	
	if(nome.value==''){
		alert('Por favor preencha seu nome');
		nome.focus();
		return false
		}
	if(email.value==''){
		alert('Por favor preencha seu email');
		email.focus();
		return false
		}
	
	carregaAjax('php/newsletter_insere.php?nome_insere='+nome.value+'&email_insere='+email.value,dv_newsletter,dv_newsletter_carregando);

	
	}

////////////////////////////////////////////////////	

function cor_borda(alvo,cor) {
	var alvo = document.getElementById(alvo);
	alvo.style.borderColor = cor
}

////////////////////////////////////////////////////	

function confere_form(lista){
	var array=lista.split(",");
	for(i=0;i<array.length;i++){
		var campo=array[i];
		var alvo = document.getElementById(campo);
		if(alvo.value==""){
			alert('Preencha o campo selecionado!');
			alternaEstilo(campo,'borda_erro');
			alvo.focus();
			return false;
			} else {
			alternaEstilo(campo,'');	
			}
		}

	}
	
////////////////////////////////////////////////////	
	
function somenteNumeros(e){
	
  if (e.keyCode) { // IE   
    tecla = e.keyCode;   
  }  else if (e.which) { // Firefox   
    tecla = e.which;   
  }  else { // Sei lá! :P   
    return false;   
  }   

  if(tecla > 43 && tecla < 58) // numeros de 0 a 9
    return true;
  else {
      if (tecla != 8) // backspace
        return false;
      else
        return true;
    }
}


/////////////////////////////////////////////////////

function confirma_url(msg,url){
	if(confirm(msg)){
					document.location.href=url;
				  } 
	
	}

/////////////////////////////////////////////////////

function ampliarConteudo(arquivo){
	
	pos_zoom = document.getElementById("dv_zoom");
	pos_zoom.style.marginTop=document.body.scrollTop;
	
	exibe("dv_zoom");
	carregaAjax(arquivo,dv_palco_zoom,dv_carregando_zoom);
	}

/////////////////////////////////////////////////////

function ampliarFoto(foto,legenda,credito){
	
	pos_zoom = document.getElementById("dv_zoom");
	pos_zoom.style.marginTop=document.body.scrollTop;

	exibe("dv_zoom");
	carregaAjax('php/exibe_foto.php?foto='+foto+'&legenda='+legenda+'&credito='+credito,dv_palco_zoom,dv_carregando_zoom);
	}

/////////////////////////////////////////////////////

function fechar_zoom(){
	oculta("dv_zoom");
	}

/////////////////////////////////////////////////////
	
function cookie(name,value,hours){
	var path='/';
	if (hours){
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name+"="+escape(value)+expires+"; path="+path;
}

/////////////////////////////////////////////////////

function lerCookie(name){   
	var nameEQ = name + "=";
   var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++){
		var c = ca[i];
		while (c.charAt(0)==' '){
			c = c.substring(1,c.length);
			}
      if (c.indexOf(nameEQ) == 0){
   		return unescape(c.substring(nameEQ.length,c.length));
   		}
	}
	return null;
}

/////////////////////////////////////////////////////

function limparCookie(name,path){
	var path = '/';
	var mac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;
	if(mac){
		createCookie(name,"",0.001,path);
 	}else{
		createCookie(name,"",-1,path);
	}
}

/////////////////////////////////////////////////////

function carregaAjax(url,alvo,carregando,funcao,vars){

	if(typeof(alvo)=='string'){
		alvo = document.getElementById(alvo);
		}
	if(typeof(carregando)=='string'){
		carregando = document.getElementById(carregando);
		}

	$.ajax(
		{
		  url: url,
		  cache: true,
		  beforeSend: function(){
			  	if((carregando!=undefined) && (carregando!='')){
		  			$(carregando).show();
					}
				if((alvo!=undefined) && (alvo!='')){	
					$(alvo).hide();
					}
		  		},
		  success: function(html){
		  		if((carregando!=undefined) && (carregando!='')){
					$(carregando).hide();
					}
				if((alvo!=undefined) && (alvo!='')){	
					$(alvo).show();
					$(alvo).html(html);
					}
				
				if(funcao!=undefined){
					exec = funcao;
					exec(vars);
					}
				
				}
			}
		);
	}

/////////////////////////////////////////////////////

function mudaImagem(alvo,imagem){
	alvo = document.getElementById(alvo)
	alvo.src=imagem;
	}
	
/////////////////////////////////////////////////////

function alternaImagens(alvo,imagem1,imagem2){
	
	alvo = document.getElementById(alvo);
	if(alvo.src.indexOf(imagem1)!=-1){
		alvo.src=imagem2;
		} else {
		alvo.src=imagem1;
		}
	}
	
/////////////////////////////////////////////////////

function alternaDisplay(alvo,estiloExibe){
	if(estiloExibe==undefined){
		estiloExibe = 'block';
		}
	alvo = document.getElementById(alvo)
	if(alvo.style.display==estiloExibe){
		alvo.style.display="none";
		} else {
		alvo.style.display=estiloExibe;
		}
	}

/////////////////////////////////////////////////////

function alternaEstilo(alvo,estilo1,estilo2){
	alvo = document.getElementById(alvo);
	if(alvo.className==estilo1){
			alvo.className=estilo2;
		} else {
			alvo.className=estilo1;
		}
	}

/////////////////////////////////////////////////////

function estilo(alvo,estilo){
	alvo = document.getElementById(alvo);
	alvo.className=estilo;
	}
   
/////////////////////////////////////////////////////   

function exibe(alvo){	
	alvo = document.getElementById(alvo)
	alvo.style.display="block"
	}

/////////////////////////////////////////////////////   	

function oculta(alvo){
	alvo = document.getElementById(alvo)
	alvo.style.display="none"
	}
	
/////////////////////////////////////////////////////   	