///////////////////////////////////////////////
$B = new Objeto();
function popUP($url,$largura,$altura,$extras){
	$window  = window.open($url, 'download', 'width='+$largura+', height='+$altura+' '+$extras+'');
}

function letras($url,$largura,$altura,$extras){
	window.open($url, 'letras', 'width='+$largura+', height='+$altura+' '+$extras+'');
}

function add_hino($url,$largura,$altura,$extras){
	window.open($url, 'lista', 'width='+$largura+', height='+$altura+' '+$extras+'');
}
$window = '';
function add_musica($url,$largura,$altura,$extras,$txt,$musica,$serie,$titulo,$disco,$categoria_,$capa){
	if($window == ''){
	$window = window.open($url, 'player', 'width='+$largura+', height='+$altura+' '+$extras+'');
	$window.add($txt,$musica,$serie,$titulo,$disco,$categoria_,$capa);
	win.focus();
	}else{
	$window.add($txt,$musica,$serie,$titulo,$disco,$categoria_,$capa);
	win.focus();
	}
}

function somaDownload($id){
	var $tmp = new Objeto();
	var url = '?p=detalhe&ac=down&hino='+$id;
	$tmp.Ajax(url,function($r){  });
}


function alertar_erro_hino(){
		alert('Obrigado, sua ajuda é muito importante para nós!\n Erro comunicado com sucesso!');
	}

function addFav(){

	var url="http://www.canticosccb.com.br";
	var title=".:: CANTICOS CCB ::.";
	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);}

}

$ArrOnload = new Array();
function AddOnload($func){  $ArrOnload[$ArrOnload.length] = $func;   }
onload(function(){ 
				
// login

var $lnome = new Objeto('lnome');
var $lsenha = new Objeto('lsenha');

try{ $lnome.mask_value('Digite seu e-mail');  
	 $lsenha.mask_value('senha');
	}catch(e){}

// pesquisa
document.getElementById('nomePesquisa').onblur = function() {
	if (document.getElementById('nomePesquisa').value == '') {
		document.getElementById('nomePesquisa').value = 'Digite aqui o nome do Hino';
	}
}

document.getElementById('nomePesquisa').onfocus = function() {
	if (document.getElementById('nomePesquisa').value == 'Digite aqui o nome do Hino') {
		document.getElementById('nomePesquisa').value = '';
	}
}

document.getElementById('pesCantor').onblur = function() {
	if (document.getElementById('pesCantor').value == '') {
		document.getElementById('pesCantor').value = 'Nome do cantor';
	}
}

document.getElementById('pesCantor').onfocus = function() {
	if (document.getElementById('pesCantor').value == 'Nome do cantor') {
		document.getElementById('pesCantor').value = '';
	}
}

document.getElementById('numeroPesquisa').onblur = function() {
	if (document.getElementById('numeroPesquisa').value == '') {
		document.getElementById('numeroPesquisa').value = 'Número do Hino';
	}
}

document.getElementById('numeroPesquisa').onfocus = function() {
	if (document.getElementById('numeroPesquisa').value == 'Número do Hino') {
		document.getElementById('numeroPesquisa').value = '';
	}
}

$Intervalo_Mensagens = '';
try{	
	get('contro_up').onmouseover = function(){  $Intervalo_Mensagens = window.setInterval(function(){ get('mensagens_usuarios').scrollTop = get('mensagens_usuarios').scrollTop - 10; },100); }	
	get('contro_dow').onmouseover = function(){ $Intervalo_Mensagens = window.setInterval(function(){ get('mensagens_usuarios').scrollTop = get('mensagens_usuarios').scrollTop + 10; },100); }	
	
	get('contro_up').onmouseout = function(){ window.clearInterval($Intervalo_Mensagens);    }
	get('contro_dow').onmouseout = function(){ window.clearInterval($Intervalo_Mensagens);   }
	
	
}catch(e){}

if(window.location.href.indexOf('?') != -1){
  
	if(window.location.href.indexOf('pesquisaRelatorio') != -1){   document.documentElement.scrollTop = 400; }else{    document.documentElement.scrollTop = 565; }
}

for(var $i=0;$i<$ArrOnload.length;$i++){	
	$ArrOnload[$i]();
}

});


function lk1($div){
	
	var $a = $div.getElementsByTagName('a')[0];
	window.location.href = $a.href;
	
}


function SelecionaSub($campo){ 


	
 var $sel = get('SelecionaSubs').getElementsByTagName('select');
 
 	for(var $i=0;$i<$sel.length;$i++){
		 $sel[$i].style.display = 'none';
		 $sel[$i].name = '';
	}
 

 $sel = get('SelecionaSubs').getElementsByTagName('input');
 
 	for(var $i=0;$i<$sel.length;$i++){
		 $sel[$i].style.display = 'none'; 
		 $sel[$i].name = '';
	} 
 	
	get($campo).name = $campo;
 	get($campo).style.display = 'inline';

	
}

$AjaxR = new Objeto();
$AjaxR.Nocache = false;
$AjaxR.tmp = '';


function remove(){
get('html').innerHTML = ' '; $iner = false;
}

function add($url,$ing){
	if($iner == true){
	$AjaxR.Ajax($url,function($r){ get('html').innerHTML = $r; });
	}
}




// função seguir o mouse
function mouse(){
var divName = 'MinhaDiv'; // div that is to follow the mouse
// (must be position:absolute)
var offX = 5;          // X offset from mouse position
var offY = 16;          // 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.write('<div id="MinhaDiv" style="position:absolute;overflow:hidden;visibility:hidden;z-index:9999;"><div id="html"></div></div>');

