//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//** FUNÇÃO  ABRE PAGINAS **//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	function abre_msnlink(){
		document.getElementById('link_msn').style.display = "";
	}
	function fecha_msnlink(){
		document.getElementById('link_msn').style.display = "none";
	}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//** FUNÇÂO AJAXPAGE - CHAMA A OUTRA PAGINA COM DIV **//////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname
    
    function ajaxpage(url, containerid){
    document.getElementById('cont2').style.display = "none";
    /*document.getElementById('cont3').style.display = "none";*/
    document.getElementById('cont').style.display = "";
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e){}
    }
    }
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    if (bustcachevar) //if bust caching of external page
    var bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
    page_request.open('GET', url+bustcacheparameter, true)
    page_request.send(null)
    }
    
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    var texto = page_request.responseText;
    texto = texto.replace(/\+/g," ");
    texto = unescape(texto);
    document.getElementById(containerid).innerHTML = texto;
    }
    function abre_fotos(){
        document.getElementById('cont2').style.display = "";
        document.getElementById('cont').style.display = "none";
        document.getElementById('cont3').style.display = "none";
    }
    /*function abre_inscricao(){
        document.getElementById('cont3').style.display = "";
        document.getElementById('cont2').style.display = "none";
        document.getElementById('cont').style.display = "none";
    }*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//** FUNÇÃO  TROCA IMAGENS ( topo.php ) **//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		function muda1(a,b){ a.src = "img/bt_"+ b +"_ov.jpg"; }
		function muda2(a,b){ a.src = "img/bt_"+ b +".jpg"; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//** FUNÇÂO Troca Foto - ( fotos.php ) **//////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    function trocaFoto (imagem, comentario) {
	    document.images["foto"].src=imagem;
        document.images["foto"].alt=comentario;
        document.getElementById('descricao').innerHTML = comentario ;
    
    }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//** PARA ENQUETE - ( enquete.php ) **//////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	try{
		xmlhttp = new XMLHttpRequest();
	}
	catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    	}
		catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(E){
         	 xmlhttp = false;
			}
    	}
	}
    function enviar_enquete(){
		var form = document.votacao;
		var pergunta = form.pergunta.value;
		//window.alert(pergunta);
		
		var Radio= form.opcao;
		for(var i=0;i<Radio.length;i++){
        	if(Radio[i].checked){
           		var selecionado = Radio[i].id;	
       		} 
		}
		xmlhttp.open("GET","votar.php?voto="+selecionado+"&eqtId="+pergunta,true);
		xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState==4){
    		var mensagem    = xmlhttp.responseText;
            mensagem        = mensagem.replace(/\+/g," ");
            mensagem        = unescape(mensagem);
            document.getElementById('votacao').innerHTML=mensagem;
        	}
    	}
    	xmlhttp.send(null)
    	return false;
	}


///////////////////////////////////////////////////////////
	//** FUNÇÃO  FORMULARIO - Contato **//
////////////////////////////////////////////////////////////
  var emailInvalido = false;
    var form_contato = document.frm_contato;
        
    function enviar_contato(){
        if (validaCamposObrigatorios_contato()){
        document.getElementById( 'form_in_contato' ).innerHTML = '';
        document.getElementById('botao').disabled=true;
        document.getElementById('enviando').style.display = "";
        document.frm_contato.submit();
        }
    }
    function validaCamposObrigatorios_contato(){
        var msgAlerta = alertas;
        var flagErro = true;
        document.getElementById( 'contato_nome' ).innerHTML = '';
        document.getElementById( 'contato_email' ).innerHTML = '';
        document.getElementById( 'contato_assunto' ).innerHTML = '';
        document.getElementById( 'contato_mensagem' ).innerHTML = '';
/******** NOME **************************************************************************
****************************************************************************************/
        if (document.frm_contato.nome.value == '') {
            document.getElementById( 'contato_nome' ).innerHTML = nomeAlerta;
            msgAlerta = msgAlerta + '.Por favor insira seu nome<br />';
            flagErro = false;
        }
        else{
            document.getElementById( 'contato_nome' ).innerHTML = nomeNormal;
        }
/******** E-MAIL **************************************************************************
******************************************************************************************/
        if (document.frm_contato.email.value == '') { 
            document.getElementById( 'contato_email' ).innerHTML = emailAlerta;    
            msgAlerta = msgAlerta + '.Por favor preencha corretamente seu e-mail<br />';         
            flagErro = false; 
        }
        else{     
            document.getElementById( 'contato_email' ).innerHTML = emailNormal; 
        }
/******** Assunto **********************************************************
************************************************************************************/
        if (document.frm_contato.assunto.value == ''){	
            document.getElementById( 'contato_assunto' ).innerHTML = assuntoAlerta;
            msgAlerta = msgAlerta + '.Por favor digite o assunto<br />';
            flagErro = false;
        }
        else{
            document.getElementById( 'contato_assunto' ).innerHTML = assuntoNormal;
        }
/******** MENSAGEM *****
*******************/
        if (document.frm_contato.mensagem.value == ''){
            document.getElementById( 'contato_mensagem' ).innerHTML = mensagemAlerta;
            msgAlerta = msgAlerta + '.Por favor digite sua mensagem<br />';
            flagErro = false;
        }
        else{
            document.getElementById( 'contato_mensagem' ).innerHTML = mensagemNormal;
        }

        msgAlerta = msgAlerta + '</span>';
        document.getElementById( 'form_in_contato' ).innerHTML = '';
        document.getElementById( 'form_in_contato' ).innerHTML = msgAlerta;

        /*
        Se NAO passou pela validacao dos campos validos, e status é de erro no envio, 
        nao mostrar mensagem de erro do envio!
        */
        if ((!flagErro) && (form.statusTela.value == '2' || form.statusTela.value == '1')) {
            document.getElementById( 'inicioErroEnvioEmail' ).innerHTML = ''; 
            }
            msgAlerta = '';
                return flagErro;
    }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//** FUNÇÂO Troca musica - (index.php ) **//////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    function trocaMusica (autor, musica, arquivo) {
        document.getElementById('desc_musica').innerHTML = "<div style='position:absolute; padding-top:72px; padding-left:40px;width:75px; height:20px;'><embed id=tocador name=tocador type=application/x-mplayer2 pluginspage=http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/ filename=http://www.ongrace.com/movimentojovem/"+arquivo+" src=http://www.ongrace.com/movimentojovem/"+arquivo+" width=35 height=20 showcontrols=0 showcontrols=false showtracker=1 showdisplay=0 showstatusbar=1 videoborder3d=1 designtimesp=5311></embed></div><div id='nomeArtista' style='margin:32px 0px 0px 88px;'><b style='color:white'>"+autor+"</b></div><div id='nomeMusica' style='margin:2px 0px 0px 88px;'><b style='color:white'>"+musica+"</b></div><img src='img/bt_fotoMarcio.jpg' alt='Se Liga No Som' border='0' usemap='#CmdMusicas' style='margin:3px 0px 0px 160px; cursor:hand' /><map name='CmdMusicas' id='CmdMusicas' style='cursor:hand;'><area shape='circle' coords='24,16,10' onClick='javascript:paraMusica()' /><area shape='circle' coords='47,18,9' onClick='javascript:tocaMusica()' /></map> ";
    }
	function paraMusica(){
		document.tocador.stop();
	}
	function tocaMusica(){
		document.tocador.play();
	}