function ajaxInit(){
	var xmlhttp ;
	try {
		xmlhttp = new XMLHttpRequest ( ) ;
	}catch (ee){
		try { 
			xmlhttp = new ActiveXObject ("Msxml2.XMLHTTP") ;
		}catch( e ) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP" ) ;
			}catch(E) {
				xmlhttp= false ;
			}
		}
	}
	return xmlhttp ;
}

function caixaBaixa(){
	document.form.txtEmail.value = document.form.txtEmail.value.toLowerCase();
}

function salvar(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtNome.value.length<3){
		alert('Informe um nome válido!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtSobreNome.value==''){
		alert('Informe um Sobrenome!');
		document.form.txtSobreNome.focus();
	}
	else if(document.form.txtSobreNome.value.length<3){
		alert('Informe um Sobrenome válido!');
		document.form.txtSobreNome.focus();
	}
	else if(document.form.txtEmail.value==''){
		alert('Informe um e-mail!');
		document.form.txtEmail.focus();
	}
	else if(document.form.txtDataNascPessoa.value==''){
		alert('Informe uma data de nascimento!');
		document.form.txtDataNascPessoa.focus();
	}
	else if(document.form.txtCidade.value == ''){
		alert('Informe uma cidade!');
		document.form.txtCidade.focus();
	}
	else if(document.form.txtEstado.value == ''){
		alert('Informe um estado!');
		document.form.txtEstado.focus();
	}
	else if(document.form.cboPais.value == 0){
		alert('Informe o País!');
		document.form.cboPais.focus();
	}
	else if(document.form.txtDescricao.value == ''){
		alert('Informe uma descrição!');
		document.form.txtDescricao.focus();
	}
	else if(document.form.txtCaptcha.value==''){
		alert('Informe o código da imagem!');
		document.form.txtCaptcha.focus();
	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Carregando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=salvar';
		document.form.submit();
	}
}

function salvarConfigConta(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtNome.value.length<3){
		alert('Informe um nome válido!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtSobreNome.value==''){
		alert('Informe um Sobrenome!');
		document.form.txtSobreNome.focus();
	}
	else if(document.form.txtSobreNome.value.length<3){
		alert('Informe um Sobrenome válido!');
		document.form.txtSobreNome.focus();
	}
	else if(document.form.txtDataNascPessoa.value==''){
		alert('Informe uma data de nascimento!');
		document.form.txtDataNascPessoa.focus();
	}
	else if(document.form.txtCidade.value == ''){
		alert('Informe uma cidade!');
		document.form.txtCidade.focus();
	}
	else if(document.form.txtEstado.value == ''){
		alert('Informe um estado!');
		document.form.txtEstado.focus();
	}
	else if(document.form.cboPais.value == 0){
		alert('Informe o Pais!');
		document.form.cboPais.focus();
	}
	else if(document.form.txtDescricao.value == ''){
		alert('Informe uma descrição!');
		document.form.txtDescricao.focus();
	}
//	else if(document.form.txtCaptcha.value == ''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Carregando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=editarConfiguracao';
		document.form.submit();
	}
}

function enviarContato(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtEmail.value==''){
		alert('Informe um e-mail!');
		document.form.txtEmail.focus();
	}
	else if(document.form.txtAssunto.value==''){
		alert('Informe um assunto!');
		document.form.txtAssunto.focus();
	}
	else if(document.form.txtDescricao.value==''){
		alert('Informe uma mensagem!');
		document.form.txtDescricao.focus();
	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Enviando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=contato';
		document.form.submit();
	}
}

function enviarPublicidade(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtEmail.value==''){
		alert('Informe um e-mail!');
		document.form.txtEmail.focus();
	}
	else if(document.form.txtTelefone.value==''){
		alert('Informe um telefone!');
		document.form.txtTelefone.focus();
	}
	else if(document.form.txtCidade.value==''){
		alert('Informe uma cidade!');
		document.form.txtCidade.focus();
	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Enviando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=publicidade';
		document.form.submit();
	}
}

function desativarConta(){
	document.form.action='?ac=desativarConta';
	document.form.submit();
}
function confirmaDesativacao(){
	if(document.form.txtSenha.value==''){
		alert('Digite sua senha!');
		document.form.txtSenha.focus();
	}
	else{
		document.form.action='?ac=confirmaDesativarConta';
		document.form.submit();
	}
}

function criarComu(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtNome.value.length<3){
		alert('Informe um nome válido!');
		document.form.txtNome.focus();
	}
	else if(document.form.cboCategoria.value == 0){
		alert('Informe uma categoria!');
		document.form.cboCategoria.focus();
	}
	else if(document.form.txtCidade.value == ''){
		alert('Informe uma cidade!');
		document.form.txtCidade.focus();
	}
	else if(document.form.txtEstado.value == ''){
		alert('Informe um estado!');
		document.form.txtEstado.focus();
	}
	else if(document.form.cboPais.value == 0){
		alert('Informe o Pais!');
		document.form.cboPais.focus();
	}
	else if(document.form.txtDescricao.value == ''){
		alert('Informe uma descrição!');
		document.form.txtDescricao.focus();
	}
	else if(document.form.txtDescricao.value.length<5){
		alert('Informe uma descrição válida!');
		document.form.txtDescricao.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Carregando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=salvarComu';
		document.form.submit();
	}
}
function editarComu(id){
	if(document.form.cboCategoria.value == 0){
		alert('Informe uma categoria!');
		document.form.cboCategoria.focus();
	}
	else if(document.form.cboPais.value == 0){
		alert('Informe o Pais!');
		document.form.cboPais.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Carregando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=editarComu&idComu='+id;
		document.form.submit();
	}
}

function criarBanda(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtNome.value.length<3){
		alert('Informe um nome válido!');
		document.form.txtNome.focus();
	}
	else if(document.form.cboCategoria.value == 0){
		alert('Informe uma categoria!');
		document.form.cboCategoria.focus();
	}
	else if(document.form.txtCidade.value == ''){
		alert('Informe uma cidade!');
		document.form.txtCidade.focus();
	}
	else if(document.form.txtEstado.value == ''){
		alert('Informe um estado!');
		document.form.txtEstado.focus();
	}
	else if(document.form.txtDescricao.value == ''){
		alert('Informe uma descrição!');
		document.form.txtDescricao.focus();
	}
	else if(document.form.txtDescricao.value.length<5){
		alert('Informe uma descrição válida!');
		document.form.txtDescricao.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Carregando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=salvarBanda';
		document.form.submit();
	}
}
function editarBanda(id){
	if(document.form.cboCategoria.value == 0){
		alert('Informe uma categoria!');
		document.form.cboCategoria.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.getElementById("DivBotaoSalvar").innerHTML="<b>Carregando dados aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
		document.form.action='?ac=editarBanda&idBanda='+id;
		document.form.submit();
	}
}

function validaEmail(email){
	exp = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/
	if(!email.value==''&&!exp.test(email.value)){
		email.value='';
		alert('E-mail Inválido!'); 
	}
} 
function validaEmail2(email){
	caixaBaixa();
	exp = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/
	if(!email.value==''&&!exp.test(email.value)){
		email.value='';
		alert('E-mail Inválido!'); 
	}else{
		ajax=ajaxInit();
		if(ajax){
			ajax.open('GET','?ac=verificaEmail&email='+email.value,true);
			ajax.onreadystatechange=function(){
				if(ajax.readyState==4){
					if(ajax.status==200){
						if(ajax.responseText=='true'){
							email.value='';
							alert('E-mail já existente em nossa base de dados!'); 
						}
					}
				}
			}
		}
		ajax.send(null);
	}
}
function CheckNums(campo,teclapres) {
	var tecla = 0;

	if(document.all){
		tecla = teclapres.keyCode;
	}
	else{
		tecla = teclapres.which;
		if(tecla==1){tecla=0}
	}

	if ((tecla < 48) || (tecla > 57)) {
		return false;
	}
}

function enviarEmail(){
	if(document.form.txtNome.value==''){
		alert('Informe um nome!');
		document.form.txtNome.focus();
	}
	else if(document.form.txtEmail.value==''){
		alert('Informe um e-mail!');
		document.form.txtEmail.focus();
	}
	else if(validaEmail(document.form.txtEmail.value)==false){
		alert('E-mail inválido');
		document.form.txtEmail.value = '';
		document.form.txtEmail.focus();
	}
	else if(document.form.txtAssunto.value==''){
		alert('Informe um assunto!');
		document.form.txtAssunto.focus();
	}
	else if(document.form.txtMsg.value==''){
		alert('Digite uma mensagem!');
		document.form.txtMsg.focus();
	}
	else{
		document.form.action='?ac=contato';
		document.form.submit();
	}
}
function enviarConvite(id){
	if(document.formConvite.txtEmail.value==''){
		alert('Informe um e-mail!');
		document.formConvite.txtEmail.focus();
	}
	else if(validaEmail(document.formConvite.txtEmail.value)==false){
		alert('E-mail inválido');
		document.formConvite.txtEmail.value = '';
		document.formConvite.txtEmail.focus();
	}
	else{
		document.formConvite.action='?ac=emailConvite&idusuario='+id;
		document.formConvite.submit();
	}
}
function buscaPortal(){
	if(document.formBusca.txtBusca.value==''){
		alert('Informe um critério de busca!');
		document.formBusca.txtBusca.focus();
	}
	else{
		document.formBusca.action='?ac=buscaPortal';
		document.formBusca.submit();
	}
}
function buscaComu(){
	if(document.formBusca.txtBusca.value==''){
		alert('Informe um critério de busca!');
		document.formBusca.txtBusca.focus();
	}
	else{
		document.formBusca.action='?ac=buscaComu';
		document.formBusca.submit();
	}
}
function criarTopic(id){
	if(document.form.txtTitulo.value==''){
		alert('Informe um assunto!');
		document.form.txtTitulo.focus();
	}
	else if(document.form.txtPostagem.value==''){
		alert('Informe o corpo de uma mensagem!');
		document.form.txtPostagem.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.form.action='?ac=topico&id='+id;
		document.form.submit();
	}
}
function criarComent(idPost,idComu){
	if(document.form.txtComentario.value==''){
		alert('Informe o corpo de um comentário!');
		document.form.txtComentario.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.form.action='?ac=comentario&idPost='+idPost+'&idComu='+idComu;
		document.form.submit();
	}
}


function atualizarestado(valor){
	ajax=ajaxInit();
	document.getElementById("div_estado").innerHTML="Carregando...";
	if(ajax){
		ajax.open('GET','?ac=carregar_estado&idpais='+valor,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("div_estado").innerHTML=ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);
}

function atualizarlocalidade(valor){
	ajax=ajaxInit();
	document.getElementById("div_localidade").innerHTML="Carregando...";
	if(ajax){
		ajax.open('GET','?ac=carregar_localidade&idestado='+valor,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("div_localidade").innerHTML=ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);
}


function atualizarbairro(valor){

	ajax=ajaxInit();
	document.getElementById("div_bairro").innerHTML="Carregando...";
	if(ajax){
		ajax.open('GET','?ac=carregar_bairro&idlocalidade='+valor,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("div_bairro").innerHTML=ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);

}
function atualizarlogradouro(valor){

	ajax=ajaxInit();
	document.getElementById("div_logradouro").innerHTML="Carregando...";
	if(ajax){
		ajax.open('GET','?ac=carregar_logradouro&idbairro='+valor,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("div_logradouro").innerHTML=ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);

}
function atualizarCombosCEP(){
	if(document.form.txtCEP.value==''){
		alert("Informe um CEP!");
		document.form.txtCEP.focus();
	}else{
		ajax=ajaxInit();
		document.getElementById("DivCarregando").src="imagens/carregando_end.gif";
		if(ajax){
			ajax.open('GET','?ac=carregar_Combos_CEP&CEP='+document.form.txtCEP.value,true);
			ajax.onreadystatechange=function(){
				if(ajax.readyState==4){
					if(ajax.status==200){
						if(ajax.responseText!="null"){
							var vRetorno = ajax.responseText.split("|");
							document.getElementById("div_pais").innerHTML=vRetorno[0];
							document.getElementById("div_estado").innerHTML=vRetorno[1];	
							document.getElementById("div_localidade").innerHTML=vRetorno[2];	
							document.getElementById("div_bairro").innerHTML=vRetorno[3];	
							document.getElementById("div_logradouro").innerHTML=vRetorno[4];
							document.getElementById("DivCarregando").src="imagens/lupa.png";
						}
						else{
							alert("CEP não encontrado em nossa base de dados!");
							document.form.txtCEP.focus();
							document.getElementById("DivCarregando").src="imagens/lupa.png";
						}	
					}
				}
			}
		}
		ajax.send(null);
	}
}
function atualizarCEP(valor){
	ajax=ajaxInit();
	//document.getElementById("txtCEP").innerHTML="Carregando...";
	if(ajax){
		ajax.open('GET','?ac=carregar_CEP&idlogradouro='+valor,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("txtCEP").value=ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);
}
function acessar(valor,teclapres){
	var tecla = 0;
	if(document.all){
		tecla = teclapres.keyCode;
	}
	else{
		tecla = teclapres.which;
		if(tecla==1){tecla=0}
	}
	if (tecla == 13 || tecla == 0){
		if(document.formLogin.txtLogin.value==''){
			alert('Digite seu login!');
			document.formLogin.txtLogin.focus();
		}
		else if(document.formLogin.txtSenha.value==''){
			alert('Digite sua senha!');
			document.formLogin.txtSenha.focus();
		}
		else{
			document.formLogin.action='acesso?ac=verificar_acesso';
			document.formLogin.submit();
		}
	}
}

function alterar(){
	if(document.form.txtSenhaNova.value==''){
		alert('Digite sua nova senha!');
		document.form.txtSenhaNova.focus();
	}
	else if(document.form.txtSenhaConfirma.value==''){
		alert('Digite sua senha novamente!');
		document.form.txtSenhaConfirma.focus();
	}
	else if(document.form.txtSenhaNova.value!=document.form.txtSenhaConfirma.value){
		alert('Senha Não Confere!');
		document.form.txtSenhaNova.value='';
		document.form.txtSenhaConfirma.value='';
		document.form.txtSenhaNova.focus();
	}else{
		document.form.action='acesso?ac=alterar_senha';
		document.form.submit();
	}	
}
function upload(id){
	document.getElementById("DivCarregaImagem").innerHTML="<b>Carregando foto aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
	document.formImagem.action='upload?id='+id;
	document.formImagem.submit();
}
function concluir(id){
	document.formImagem.action='?ac=concluirCadastro&id='+id;
	document.formImagem.submit();
}
function uploadGaleria(id,idGaleria){
	document.getElementById("DivCarregaImagem").innerHTML="<b>Carregando foto aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
	document.formImagem.action='upgale?id='+id+'&idGaleria='+idGaleria+'&descFoto='+document.formImagem.txtDescFoto.value;
	document.formImagem.submit();
}
function upComu(id){
	document.getElementById("DivCarregaImagem").innerHTML="<b>Carregando foto aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
	document.formImagem.action='upcomu?id='+id;
	document.formImagem.submit();
}
function upBanda(id){
	document.getElementById("DivCarregaImagem").innerHTML="<b>Carregando foto aguarde...</b><br><img src='imagens/ico_carregando.gif'>";
	document.formImagem.action='upbanda?id='+id;
	document.formImagem.submit();
}
function excluirFoto(id,idGaleria,idAnexo){
	document.formImagem.action='?ac=excluirFotoAlbum&id='+id+'&idGaleria='+idGaleria+'&idAnexo='+idAnexo;
	document.formImagem.submit();
}
function criarAlbum(id){
	document.form.action='?ac=criarAlbum&id='+id;
	document.form.submit();
}
function criarVideo(id){
	document.form.action='?ac=criarVideo&id='+id;
	document.form.submit();
}
function criarVideoBanda(id){
	document.form.action='?ac=criarVideoBanda&id='+id;
	document.form.submit();
}
function criarMusicaBanda(id){
	if(document.form.txtURL.value==''){
		alert('Informe a URL da música!');
		document.form.txtURL.focus();
	}
	else if(document.form.txtURL.value.indexOf('mp3klub')==-1){
		alert('A sua URL é inválida!');
		document.form.txtURL.focus();
	}else{
		document.form.action='?ac=criarMusicaBanda&id='+id;
		document.form.submit();
	}
}
function editarAlbum(id,idGaleria){
	document.form.action='?ac=editarAlbum&id='+id+'&idgaleria='+idGaleria;
	document.form.submit();
}
function editarVideo(id,idVideo){
	document.form.action='?ac=editarVideo&id='+id+'&idvideo='+idVideo;
	document.form.submit();
}
function editarVideoBanda(id,idVideo){
	document.form.action='?ac=editarVideoBanda&id='+id+'&idvideo='+idVideo;
	document.form.submit();
}
function editarMusicaBanda(id,idMusica){
	if(document.form.txtURL.value==''){
		alert('Informe a URL da música!');
		document.form.txtURL.focus();
	}
	else if(document.form.txtURL.value.indexOf('mp3klub')==-1){
		alert('A sua URL é inválida!');
		document.form.txtURL.focus();
	}else{
		document.form.action='?ac=editarMusicaBanda&id='+id+'&idmusica='+idMusica;
		document.form.submit();
	}
}
function excluirAlbum(id,idGaleria){
	document.form.action='?ac=excluirAlbum&id='+id+'&idgaleria='+idGaleria;
	document.form.submit();
}
function excluirVideo(id,idVideo){
	document.form.action='?ac=excluirVideo&id='+id+'&idvideo='+idVideo;
	document.form.submit();
}
function excluirVideoBanda(id,idVideo){
	document.form.action='?ac=excluirVideoBanda&id='+id+'&idvideo='+idVideo;
	document.form.submit();
}
function excluirMusicaBanda(id,idMusica){
	document.form.action='?ac=excluirMusicaBanda&id='+id+'&idmusica='+idMusica;
	document.form.submit();
}
function enviarRecado(id){
//	if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
//	else{
		document.form.action='?ac=xwfRecado&id='+id;
		document.form.submit();
//	}
}
function enviarDepoimento(id){
//	if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
//	else{
		document.form.action='?ac=enviarDepoimento&id='+id;
		document.form.submit();
//	}
}
function enviarRecadoResposder(id,idRecado){
//	if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
//	else{
		document.form.action='?ac=enviarRecadoResponder&id='+id+'&idRecado='+idRecado;
		document.form.submit();
//	}
}
function apagarRecado(idRecado,id){
	document.form.action='?ac=apagarRecado&id='+id+'&idRecado='+idRecado;
	document.form.submit();
}
function responderRecado(id){
	if(document.getElementById(id).style.display=="block"){
		document.getElementById(id).style.display="none";
	}else{
		document.getElementById(id).style.display="block";
	}
}
function SomenteNumero(e){
	var tecla=(window.event)?event.keyCode:e.which;
	if((tecla > 47 && tecla < 58)) return true;
	else{
		if (tecla != 8) return false;
		else return true;
	}
}
function validaData(pValor,nome){
	if(document.form.elements[nome].value!='' && validarDataYYYY(pValor)=='F'){
		alert('Data Incorreta!');
		document.form.elements[nome].value='';
		document.form.elements[nome].focus();
	}
}
function formatarDataYYYY(campo, teclapres) { 
	var tecla = teclapres.keyCode;  
	vr = campo.value;  
	vr = vr.replace( '/', '' );  
	vr = vr.replace( '/', '' );  
	tam = vr.length + 1;  
	if ( tecla != 9 && tecla != 8 ) {  
		if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) {  
			if ( tam <= 2 ) campo.value = vr ;  
			if ( tam > 2 && tam < 5 ) campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, tam );  
			if ( tam >= 5 && tam <= 10 ) campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, tam );   
		}  
	}  
}
function validarDataYYYY(vValor){ 
	var checkStr = ''; 
	checkStr = vValor; 
	var err=0; 
	var psj=0; 
	var dia = 0; 
	var mes = 0; 
	var ano = 0; 
	var barra1 = ''; 
	var barra2 = ''; 
	dia = checkStr.substring(0, 2); 
	barra1 = checkStr.substring(2, 3); 
	mes = checkStr.substring(3, 5); 
	barra2 = checkStr.substring(5, 6); 
	ano = checkStr.substring(6, 10); 
	//verifica??es b?sicas 
	if (checkStr.length != 10) 
		err = 1; 
	if (mes<1 || mes>12) 
		err = 1; 
	if (barra1 != '/') 
		err = 1; 
	if (dia<1 || dia>31) 
		err = 1; 
	if (barra2 != '/') 
		err = 1; 
	if (ano<1900 || ano>2900) 
		err = 1; 
	//verifica??es avan?adas 
	// m?s com 30 dias 
	if (mes==4 || mes==6 || mes==9 || mes==11){ 
		if (dia==31) 
			err=1; 
	} 
	// fevereiro e ano bissexto 
	if (mes==2){ 
		var g = parseInt(ano/4); 
		if (isNaN(g)) { 
			err=1; 
		} 
		if (dia>29) 
			err=1; 
		if (dia==29 && ((ano/4)!=parseInt(ano/4))) 
			err=1; 
	} 
	if (err==1) 
		return 'F'; 
	else 
		return 'T'; 
} 
function foto(id,idFoto,idGaleria){
	location.href="?ac=fotoAlbum&id="+id+"&idFoto="+idFoto+"&idGaleria="+idGaleria;
//	ajax=ajaxInit();
//	document.getElementById("DivFotoAlbum").innerHTML="<img src='imagens/carregandoFoto.gif'>";
//	if(ajax){
//	ajax.open('GET','?ac=carregarImagem&id='+id+'&idgaleria='+idGaleria,true);
//	ajax.onreadystatechange=function(){
//	if(ajax.readyState==4){
//	if(ajax.status==200){
//	document.getElementById("DivFotoAlbum").innerHTML=ajax.responseText;
//	}
//	}
//	}
//	}
//	ajax.send(null);
}
function contaClique(id){
	ajax=ajaxInit();
	if(ajax){
		ajax.open('GET','?ac=contaClique&id='+id,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					window.open(ajax.responseText);
				}
			}
		}
	}
	ajax.send(null);
}
function reenviarSenha(){
	if(document.formLogin.txtLogin.value==''){
		alert('Digite seu email para o login!');
		document.formLogin.txtLogin.focus();
	}else{	
		document.formLogin.action='?ac=reenviaSenha';
		document.formLogin.submit();
	}
}
function mensagem(){
	location.href="javascript:scroll(0,0)";
	document.getElementById("DivErro").style.visibility="visible";
	//document.getElementById("DivErro").innerHTML="Informe seu ID e senha!";
	setTimeout ('escondeDiv("DivErro")',5000); 
}
function mensagem2(){
	location.href="javascript:scroll(0,0)";
	document.getElementById("DivMsg").style.visibility="visible";
	//document.getElementById("DivErro").innerHTML="Informe seu ID e senha!";
	setTimeout ('escondeDiv("DivMsg")',5000); 
}
function escondeDiv(div){
	document.getElementById(div).innerHTML="";
	document.getElementById(div).style.visibility="hidden";
}
function handleEnter (field, event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		var i;
		for (i = 0; i < field.form.elements.length; i++)
			if (field == field.form.elements[i])
				break;
		i = (i + 1) % field.form.elements.length;
		field.form.elements[i].focus();
		return false;
	} 
	else
		return true;
}
function blocTexto(id,valor,quant)
{
	total = valor.length;
	if(total <= quant)
	{
		resto = quant - total;
		document.getElementById('cont').innerHTML = resto;
	}
	else
	{
		document.getElementById(id).value = valor.substr(0,quant);
	}
}
function blocTexto2(idTopico,id,valor,quant)
{
	document.getElementById(id).value = document.getElementById(id).value.toLowerCase();
	total = valor.length;
	if(total <= quant)
	{
		resto = quant - total;
		document.getElementById('cont'+idTopico).innerHTML = resto;
	}
	else
	{
		document.getElementById(id).value = valor.substr(0,quant);
	}
}
function addComu(id){
	document.formComu.action="?ac=participaComu&idComu="+id;
	document.formComu.submit();
}
function confirmaParticipaComu(id){
//	if(document.formComu.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.formComu.txtCaptcha.focus();
//	}else{
		document.formComu.action="?ac=confirmaParticipaComu&idComu="+id;
		document.formComu.submit();
//	}
}
function addCanal(id){
	document.formBanda.action="?ac=participaCanal&idBanda="+id;
	document.formBanda.submit();
}
function confirmaParticipaCanal(id){
//	if(document.formCanal.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.formCanal.txtCaptcha.focus();
//	}else{
		document.formCanal.action="?ac=confirmaParticipaCanal&idBanda="+id;
		document.formCanal.submit();
//	}
}
function abreForm(){
	location.href="javascript:scroll(0,0)";
	if(document.getElementById("DivForm").style.display=="block"){
		document.getElementById("DivForm").style.display="none";
	}
	else{
		document.getElementById("DivForm").style.display="block";
	}
}
function comentaBlog(){
	var marcados='';
	var listaMarcados = document.getElementsByTagName("INPUT");   
	for (loop = 0; loop < listaMarcados.length; loop++) {   
		var item = listaMarcados[loop];   
		if (item.type == "checkbox" && item.checked) {   
			marcados+=item.value+",";   
		}   
	}   
	if(document.form.txtTitulo.value==''){
		alert('Informe um assunto!');
		document.form.txtTitulo.focus();
	}
//	else if(document.form.txtCaptcha.value==''){
//		alert('Informe o código da imagem!');
//		document.form.txtCaptcha.focus();
//	}
	else{
		document.form.action='?ac=blog&tags='+marcados;
		document.form.submit();
	}
}
function comentaTopicoBlog(idTopico){ 
	document.getElementById("Div"+idTopico).style.display="block";
	ajax=ajaxInit();
	document.getElementById("Div"+idTopico).innerHTML="<center><img src=\"imagens/carregando.gif\"></center>";
	if(ajax){
		ajax.open('GET','?ac=comentariosBlog&id='+idTopico+'&number='+RandomNumber(),true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("Div"+idTopico).innerHTML=ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);
}
function fecharComentarioBlog(id){
	document.getElementById("Div"+id).innerHTML="";
	document.getElementById("Div"+id).style.display="none";
}

function postarComentarioBlog(id,qtd){
	if(document.getElementById("txtComent"+id).value==''){
		alert('Informe o seu cometário!');
		document.getElementById("txtComent"+id).focus();
	}
	else if(document.getElementById("txtCaptchaComent"+id).value==''){
		alert('Informe o código da imagem!');
		document.getElementById("txtCaptchaComent"+id).focus();
	}
	else{
		var comentario = document.getElementById("txtComent"+id).value;
		var codigo = document.getElementById("txtCaptchaComent"+id).value;
		var http = ajaxInit();
		document.getElementById("Div"+id).innerHTML="<center><img src=\"imagens/carregando.gif\"></center>";
		var url = "?ac=comentarioBlog";
		var params = "txtComent"+id+"="+comentario+"&txtCaptchaComent"+id+"="+codigo+"&idTopico="+id;
		http.open("POST", url, true);

		//Send the proper header information along with the request
		http.setRequestHeader("Content-type","application/x-www-form-urlencoded; text/html; iso-8859-1");
		http.setRequestHeader("Content-length", params.length);
		http.setRequestHeader("Cache-Control", "no-cache");
		http.setRequestHeader("Encoding","ISO-8859-1");
		http.setRequestHeader("Pragma", "no-cache");
		http.setRequestHeader("Connection", "close"); 
		http.onreadystatechange = function() {//Call a function when the state changes.
			if(http.readyState == 4 && http.status == 200) {
				document.getElementById("DivQtd"+id).innerHTML = qtd+1;
				comentaTopicoBlog(id);
			}
		}
		http.send(params);
	}
}

function apagarComentario(idTopico,idComent,qtd){
	var ajax=ajaxInit();
	document.getElementById("Div"+idTopico).innerHTML="<center><img src=\"imagens/carregando.gif\"></center>";
	if(ajax){
		ajax.open('GET','?ac=apagaComent&id='+idComent,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("DivQtd"+idTopico).innerHTML = qtd-1;
					comentaTopicoBlog(idTopico);
				}
			}
		}
	}
	ajax.send(null);
}

function pesquisaComponentes(){
	var ajax=ajaxInit();
	document.getElementById("DivComponentes").innerHTML="<center><img src=\"imagens/carregando.gif\"></center>";
	if(ajax){
		ajax.open('GET','?ac=searchComponentes&criterio='+document.form.txtPesquisa.value,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("DivComponentes").innerHTML = ajax.responseText;
				}
			}
		}
	}
	ajax.send(null);
}

function RandomNumber() {
	today = new Date();
	num= Math.abs(Math.sin(today.getTime()));
	return num;  
}
function mostraDiv(){
	document.getElementById("DivInforma").style.visibility="visible";
}
function escondeDiv(){
	document.getElementById("DivInforma").style.visibility="hidden";
}
function adicionaComponente(idc){
	if(document.form.txtCaptcha.value==''){
		alert('Informe o código da imagem!');
		document.form.txtCaptcha.focus();
	}
	else{
		document.form.action='?ac=adicionaComponente&id='+idc+'&idbanda='+document.form.idbanda.value;
		document.form.submit();
	}
}
function removeBanda(idc){
	if(confirm('Tem certeza que deseja excluir esse componente?')){
		document.form.action='?ac=removeComponente&id='+idc+'&idbanda='+document.form.idbanda.value;
		document.form.submit();
	}	
}
function deixarBanda(id,idBanda){
	if(confirm('Tem certeza que deseja deixar de ser Fã desse canal?')){
		document.formBanda.action='?ac=deixarComponente&id='+id+'&idbanda='+idBanda;
		document.formBanda.submit();
	}	
}
function enviarChat(){
	if(document.formChat.txtChat.value==''){
		alert('Digite uma conversa!');
		document.formChat.txtChat.focus();
	}
	else{
		var conversa = document.formChat.txtChat.value;
		var http = ajaxInit();
		//document.getElementById("DivConversa").innerHTML="<center><img src=\"imagens/carregando.gif\"></center>";
		var url = "?ac=chat";
		var params = "txtChat="+conversa;
		http.open("POST", url, true);

		//Send the proper header information along with the request
		http.setRequestHeader("Content-type","application/x-www-form-urlencoded; text/html; iso-8859-1");
		http.setRequestHeader("Content-length", params.length);
		http.setRequestHeader("Cache-Control", "no-cache");
		http.setRequestHeader("Encoding","ISO-8859-1");
		http.setRequestHeader("Pragma", "no-cache");
		http.setRequestHeader("Connection", "close"); 
		http.onreadystatechange = function() {//Call a function when the state changes.
			if(http.readyState == 4 && http.status == 200) {

			}
		}
		http.send(params);
	}
}
function atualizarChat(hora){
	var ajax=ajaxInit();
	//document.getElementById("DivConversa").innerHTML="<center><img src=\"imagens/carregando.gif\"></center>";
	if(ajax){
		ajax.open('GET','?ac=carregaConversa&hora='+hora,true);
		ajax.onreadystatechange=function(){
			if(ajax.readyState==4){
				if(ajax.status==200){
					document.getElementById("DivConversa").innerHTML = ajax.responseText;
					document.getElementById("DivConversa").scrollTop = 1999950;
				}
			}
		}
	}
	ajax.send(null);
}
function sairChat(){
	location.href="?ac=logoutChat";
}