function abrir_video(){
	exibe('dv_video');
	document.all.dv_video_player.play();
	}

///////////////////////////////////////////////////////////	

function fechar_video(){
	oculta('dv_video');
	document.all.dv_video_player.stop();
	}	

///////////////////////////////////////////////////////////	

function abas_programacao(j){

	for(i=0;i<7;i++){
				estilo('menu_aba_'+i,'aba_off');
			if(document.getElementById('dv_semana_'+i)){
				oculta('dv_semana_'+i);
				}
		}
	
	estilo('menu_aba_'+j,'aba_on');
	if(document.getElementById('dv_semana_'+j)){
		exibe('dv_semana_'+j);
		}
	}	
	
	
///////////////////////////////////////////////////////////	
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 peca_musica(){
		nome_musica = document.getElementById('nome');
		email_musica = document.getElementById('email');
		tel_musica = document.getElementById('telefone');
		cidade_musica = document.getElementById('cidade');
		musica = document.getElementById('musica');
		cantor_musica = document.getElementById('cantor');
		mensagem_musica = document.getElementById('mensagem');		
		
		if(nome_musica.value==''){
			alert('Preencha o campo NOME');
			nome_musica.focus();
			return false;
			}	
		if(email_musica.value==''){
			alert('Preencha o campo EMAIL');
			email_musica.focus();
			return false;
			}	
		if(tel_musica.value==''){
			alert('Preencha o campo TELEFONE');
			tel_musica.focus();
			return false;
			}
		if(cidade_musica.value==''){
			alert('Preencha o campo CIDADE');
			cidade_musica.focus();
			return false;
			}
		if(musica.value==''){
			alert('Preencha o campo MÚSICA');
			musica.focus();
			return false;
			}	
		if(cantor_musica.value==''){
			alert('Preencha o campo NOME DO CANTOR');
			cantor_musica.focus();
			return false;
			}	
		if(mensagem_musica.value==''){
			alert('Preencha o campo MENSAGEM');
			mensagem_musica.focus();
			return false;
			}	
			
		carregaAjax('php/peca.php?enviar=sim&nome='+nome_musica.value+'&email='+email_musica.value+'&telefone='+tel_musica.value+'&cidade='+cidade_musica.value+'&musica='+musica.value+'&cantor='+cantor_musica.value+'&mensagem='+mensagem_musica.value,'dv_palco');
}
/////////////////////////////////////////////////
function envia_msg_mural(){
		titulo = document.getElementById('titulo_livro');
		msg = document.getElementById('mensagem_livro');
		nome_livro = document.getElementById('nome_livro');
		email = document.getElementById('email_livro');
		cidade = document.getElementById('cidade_livro');
		
		if(titulo.value==''){
			alert('Preencha o título da mensagem');
			titulo.focus();
			return false;
			}
		if(msg.value==''){
			alert('Preencha sua mensagem');
			msg.focus();
			return false;
			}
		if(nome_livro.value==''){
			alert('Preencha o campo nome');
			nome_livro.focus();
			return false;
			}
		if(email.value==''){
			alert('Preencha o campo email');
			email.focus();
			return false;
			}
		if(cidade.value==''){
			alert('Preencha o campo cidade');
			cidade.focus();
			return false;
			}
			
		carregaAjax('php/mural.php?insere=sim&titulo_livro='+titulo.value+'&mensagem_livro='+msg.value+'&nome_livro='+msg.value+'&email_livro='+email.value+'&cidade_livro='+cidade.value,'dv_palco');
}

/////////////////////////////////////////////////
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');
	}

///////////////////////////////////////////////////

function executalogin(){
	login = document.getElementById('cp_email');
	senha = document.getElementById('cp_senha');

	if(login.value==''){
		alert('Preencha seu email');
		login.focus();
		return false;
		}
	if(login.value=='Email'){
		alert('Preencha seu email');
		login.focus();
		return false;
		}
	if(senha.value==''){
		alert('Preencha sua senha');
		senha.focus();
		return false;
		}

	carregaAjax('php/form_login.php?entra_log='+login.value+'&entra_pwd='+senha.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(tipo,id){
	
	pos_zoom = document.getElementById("dv_zoom");
	pos_zoom.style.marginTop=document.body.scrollTop;
	
	exibe("dv_zoom");
	carregaAjax('php/exibe_conteudo.php?tipo='+tipo+'&id_busca='+id,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: false,
		  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"
	}
	
/////////////////////////////////////////////////////   	