﻿//scripts gospel 10

function abreFecha(id){

if (document.getElementById(id).style.display=='')
	document.getElementById(id).style.display='none';
else
	document.getElementById(id).style.display='';
}

function select(theField) {
var tempval=eval("document."+theField);
tempval.focus();
tempval.select();
}
function SegueMouse(texto,div,flagit) {

	var divName = div; // div that is to follow the mouse
			       // (must be position:absolute)
	var offX = 20;          // X offset from mouse position
	var offY = -15;          // Y offset from mouse position

	function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;}
	function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;}

	function follow(evt) {if (document.getElementById) {var obj = document.getElementById(divName).style; obj.visibility = 'visible';
	obj.left = (parseInt(mouseX(evt))+offX) + 'px';
	obj.top = (parseInt(mouseY(evt))+offY) + 'px';}}
	document.onmousemove = follow;
	document.getElementById(div).innerHTML=texto;
	if (flagit=="1"){
		if (document.layers) document.layers[div].display = ""
		else if (document.all) document.all[div].style.display = ""
		else if (document.getElementById) document.getElementById(div).style.display = ""
	}else
		if (flagit=="0"){
			if (document.layers) document.layers[div].display = "none"
			else if (document.all) document.all[div].style.display = "none"
			else if (document.getElementById) document.getElementById(div).style.display = "none"
	}
}
function abrirUsuariosOnline(){
window.open('usuarios_online.php', '', "status=no, width=1024, height=768");
}

function abrirLogUser(id){
window.open('logUser.php?id='+id, '', "status=no, width=900, height=768, scroll=yes");
}
function divFoto(url,leg,pos){

//document.getElementById('fundofoto').style.display = '';
document.getElementById('foto').style.display = '';
document.getElementById('fotos').style.display = 'none';
document.getElementById('foto').innerHTML = "<table style='width: 541px;  background-color:#FFFFFF;border:2px;  border-style:solid;  border-color:#0066CC; ' align=center  cellpadding='0' cellspacing='0'><tr><td  style='height=20px; text-align:left'><span class=tituloItensIgreja>"+leg+"</span></td><td><img src='images/voltar.gif' align='right'></td>	</tr><tr><td colspan='2'><img src="+url+" width='541' height='406'></td></tr>	</table>";
document.getElementById('foto').style.marginTop = pos+"px";

}

function fechar(){
document.getElementById('foto').style.display = 'none';
document.getElementById('fotos').style.display = '';
//document.getElementById('fundofoto').style.display = 'none';
}


/////////////////////ativar flash///////////////////////

function flash(file, width, height){
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + width + "' height='" + height + "'>");
    document.write("<param name='movie' value='" + file + "'>");
    document.write("<param name='quality' value='high'>");
    document.write("<embed src='" + file + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "'></embed>");
    document.write("</object>");
}


/////////////////////fim ativar flash/////////////////////////



//////////////////////abri popups/////////////////////
function abrirTermos(){
window.open('termos.php', '', "status=no, width=600, height=500, scrollbars=yes");
}

function abrirIndique(){
window.open('indique.php', '', "status=no, width=400, height=500");
}

function abrirMusica(id){
window.open('ouvirMusica.php?id='+id+'', '', "status=no, width=400, height=310");
}

function abrirVideo(id){
window.open('verVideo.php?id='+id+'', '', "status=no, width=500, height=750");
}
/////////////////////deletar topicos, poemas banda e respostas////////////////////////////

function deletar(tipo,id){

if (tipo=='topico'){
		if (confirm('Você tem certeza que deseja apagar este Tópico?\nATENÇÃO: Todas as respostas também serão apagadas!')){
							 location.replace('action/delTopico.php?id='+id+'');
							 return true;
							 }
}

if (tipo=='poema'){
		if (confirm('Você tem certeza que deseja apagar este Poema?')){
								location.replace('action/delpoema.php?id='+id+'');
								return true;
								}
}


if (tipo=='banda'){
		if (confirm('Você tem certeza que deseja apagar?')){
				 location.replace('action/delBanda.php?id='+id+'');
				 return true;
				 }
}


if (tipo=='resposta'){
		if (confirm('Você tem certeza que deseja apagar esta Resposta?')){
				 location.replace('action/delResposta.php?id='+id+'');
				 return true;
				 }

}

if (tipo=='anuncio'){
		if (confirm('Você tem certeza que deseja apagar este Anúncio?')){
				 location.replace('action/delAnuncio.php?id='+id+'');
				 return true;
				 }

}

if (tipo=='oracao'){
		if (confirm('Você tem certeza que deseja apagar este Pedido de Oração?')){
				 location.replace('action/deloracao.php?id='+id+'');
				 return true;
				 }

}


return false;
}




function addFav(title,url){

 if (window.sidebar) window.sidebar.addPanel(title, url,"");
 else if(window.opera && window.print){
 var mbm = document.createElement('a');
 mbm.setAttribute('rel','sidebar');
 mbm.setAttribute('href',url);
 mbm.setAttribute('title',title);
 mbm.click();
 }
 else if(document.all){window.external.AddFavorite(url, title);}
}

///mascara 

/**********************************************************
 *  Pir@z-Stufz!!!!                                       *
 *                  -- mascara.js --                      *
 *                                                        *
 *   Script que reconhece uma mascara e formata o texto   *
 *  do campo a que a máscara será aplicada.              *
 *                                                        *
 *      Linguagem : Java Script                           *
 *      Projeto: Script - Geral                           *
 *      Tipo: Script                                      *
 *      Versão: Beta 1                                    *
 *      Desenvolvedor: Flávio Garcia - ViaCerrado         *
 *      Contribuições: *                                  *
 *      Data de criação: 03/10/2001 08:12:21              *
 *      Última atualização: 03/10/2001 11:40:10           *
 *      Licença: GNU                                      *
 *     (Pode se divertir, mas se alterar me avisa belê?)  *
 *                                                        *
 *                      Desenvolvimento - ViaCerrado      *
 *                                                        *
 **********************************************************/

/*
mascara.js  How - To.
Objetivo:

O script tem por objetivo formatar a entrada do dado no input.
Ele vai servir muito bem para datas, horas, datas e horas, cpf,
cgf e outras cositas mais que tenham tamanho fixo e sejam numé-
ricos. 

OBS: Pois eh o script estah sem os ";" no final, pq eh JavaScript.
E quem disse que java script precisa.

A função que formata a máscara é a inputMask.
Para chamar a função é necessário passar 3 atributos:

myInput: 

Que é o campo que será mascarado. Pode referenciar o campo como ele mesmo: this.

event: 

No caso você irá passar event
Por que event? Porque sim!!! Só coloca e naum recrama.
Brincadeira. Porque o objeto event está recebendo o
valor da tecla que foi recebida no keypress.

mask:

A própria máscara que será aplicada ao campo.
ex: '##-##'
Tomando o exemplo da mascara acima. Quando o 
usuário escrever 8888 no campo, será aplicada a máscara
e o valor no campo será 88-88.
Valores aceitos na mascara:

Para referenciar número, caracteres '#' e '9'.
Para referenciar traço, caracter '-'
Para referenciar separador de data, caracter '/'
Para referenciar separador de hora, caracter ':'
Para referenciar espaço, caracter ' '
Para referenciar espaço, caracter '('
Para referenciar espaço, caracter ')'

É importante lembrar que o evento do campo que chama a função é onkeydown,
e que os valores size e maxlength tem que ser setados de acordo com a máscara.
Ou seja, mascara não controla o tamanho do campo.

Exemplo de chamada da função no formulário. 


1º passo: chamar o arquivo, no caso dir_js eh o local onde vc vai colocar o bichaum!!!
<script src="dir_js/formata.js" type="text/javascript"></script>

2º passo: mandar a função no input!!!!
<form name="form1" action="teste.php">
    
    <input type="Text" name="teste1" size="17" maxlength="17" onkeydown="inputMask(this,event,'##/##:##-## ##:##')">
    
</form>

Bugs:

Se o campo tiver um caracter já mascarado, e você apagar um caracter 
antes da máscara e voltar a preencher depois da máscara, o campo vai ficar sujo.
Ex:Tomando a máscara ####-#####
Eu escrevi:99999 --> é aplicada a máscara --> 9999-9 se eu apagar o 4º9 e escrever
denovo vai ficar: 9999--9 entendeu?

Não aceita nem ctrl+v, nem ctrl+c.

*/

function inputMask( myInput, event, mask ) { 
    // getting the keyPressed code

        keyPressed = event.keyCode;
 
    inputValue = myInput.value;
    inputLenght = inputValue.length;
    maskLenght = mask.length;
    
    // building a new array that will got all chars of the mask
    maskArray = mask.split("");
    
    if ( ( ( maskArray[ inputLenght ] == "#" ) || ( maskArray[ inputLenght ] == "9" ) ) || ( ( maskArray[ inputLenght + 1 ] != "#" ) || ( maskArray[ inputLenght + 1 ] != "9" ) ) ) {
    
        if ( ( keyPressed >= 48 && keyPressed <= 57 ) || ( keyPressed == 8 ) || ( keyPressed == 9 ) || ( keyPressed == 46 ) || ( keyPressed == 13 ) || ( !ie5 && keyPressed == 0 ) ) {
                        
            isMask =false;
            
            while ( ( inputLenght < maskLenght ) && !isMask ) {
                
                if ( ( ( maskArray[ inputLenght ] == "(" ) || ( maskArray[ inputLenght ] == ")" ) || ( maskArray[ inputLenght ] == "_" ) || ( maskArray[ inputLenght ] == "/" ) || ( maskArray[ inputLenght ] == "." ) || ( maskArray[ inputLenght ] == "," ) || ( maskArray[ inputLenght ] == ":" ) || ( maskArray[ inputLenght ] == " " ) || ( maskArray[ inputLenght ] == "-" ) ) && !( keyPressed == 8 ) ) {
                    myInput.value = myInput.value + maskArray[ inputLenght ];
                    inputLenght++;
                }
                else {
                    
                    isMask = true;
                    
                }
                    
            }        
        }
        else{
            if ( ie5 ) {
                event.returnValue = false;
            }
            else{
                event.preventDefault();
            }
        }
    }
} 


function caracteresValidos(e,args) 
    {         
        if (document.all){var evt=event.keyCode;}
        else{var evt = e.charCode;}
        var valid_chars = '0123456789'+args;
        var chr= String.fromCharCode(evt);
        if (valid_chars.indexOf(chr)>-1 ){return true;}
        if (valid_chars.indexOf(chr)>-1 || evt < 9){return true;}
        return false;
    }


//Publicado por Johnathan Cardoso
//djhonyy@hotmail.com
//www.cdsbrasil.com.br
/*************************************************/
// AperfeiÃ§oado por Adriano de Oliveira GonÃ§alves
// adriano@ison.com.br
// http://adriano.ison.com.br

fadeGradativaObjects = new Object();
fadeGradativaTimers = new Object();

function fadeGradativa(id, destOp, rate, delta){

    object = document.getElementById(id);

    /*if (object != "[object]"){
        setTimeout("fadeGradativa('"+id+"',"+destOp+","+rate+","+delta+")",0);
        return;
    } */

    clearTimeout(fadeGradativaTimers[object.sourceIndex]);

    bname=navigator.appName;

    if(bname.indexOf("Microsoft")!=-1)
    {
        opacidade = object.filters.alpha.opacity;
        
        diff = destOp-opacidade;
        direction = 1;
        if (opacidade > destOp){
            direction = -1;
        }
        
        delta=Math.min(direction*diff,delta);
        object.filters.alpha.opacity+=direction*delta;
        
        opacidade = object.filters.alpha.opacity;
    }
    else if(bname.indexOf("Netscape")!=-1)
    {
        opacidade = object.style.MozOpacity*100;

        diff = destOp-opacidade;
        direction = 1;
        if (opacidade > destOp){
            direction = -1;
        }

        delta=Math.min(direction*diff,delta);
        object.style.MozOpacity = (opacidade+(direction*delta))/100;

        opacidade = object.style.MozOpacity*100;

    }
    else
        return;
        
    if (opacidade != destOp){
        fadeGradativaObjects[object.sourceIndex]=object;
        fadeGradativaTimers[object.sourceIndex]=setTimeout("fadeGradativa('"+id+"',"+destOp+","+rate+","+delta+")",rate);
    }
}