// JavaScript Document
//carregando...
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
function hideIt(div){
	if(bw.bw){
		div="divLoadCont"
		obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0; 
		obj.visibility='hidden'
	}
}//carregando... fim
//janela transparente
function ocultar(){
   var camada=document.getElementById("janela");
   camada.style.display="none";
   camada.style.visibility="hidden"; 
} 
function mostrar(titulo, cont){
	var conteudo="<table width='350' border=0 style='border:1px solid; background-color:#4791C5; filter:Alpha(Opacity=100, FinishOpacity=75, Style=2, StartX=100, StartY=100, FinishX=100, FinishY=1);'>"+
	"<tr><td align='left'><font color='#FFFFFF' style='font-weight:bold; font-size:12px;'>"+titulo+"</font>"+
	"</td><td align=right>"+
	"<input type='button' style='backgrounf-color:#fefefe; cursor:hand; color:#4791C5; border:0px; font-face:arial,verdana; font-size:8pt, font-weight:bold;' value='Fechar' onClick='javascript:ocultar();' title='Fechar!'>"+
	"</td></tr>"+
	"<tr><td colspan=2 bgcolor='#FFFFFF' align=center style='cursor:hand; border:0px; font-family:arial,verdana; font-size:9pt; font-color:#000000;'>"+
	cont+"</td></tr></table>";
   var camada=document.getElementById("janela");
   camada.innerHTML=conteudo;
   camada.style.display="block";
   camada.style.visibility="visible"; 
}
//janela transparente fim
function mudaCls(id, cls){
	document.getElementById(id).className = cls;
}
function validarContato(theForm) {
	aviso=""
	if(theForm.seuNome.value == "") aviso +="- Nome (vazio)\n"
	if(theForm.seuEmail.value == "") aviso +="- E-mail (vazio)\n"
	if(theForm.assunto.value == "") aviso +="- Assunto (vazio)\n"
	if(theForm.texto.value == "") aviso +="- Texto (vazio)\n"
	if(aviso!=""){
		alert("Erros encontrados: \n" + aviso);
		return false;
	}
	return true;
}
function validarLogin(theForm) {
	aviso=""
	if(theForm.login.value == "") aviso +="- Login (vazio)\n"
	if(theForm.senha.value == "") aviso +="- Senha (vazio)\n"
	if(aviso!=""){
		alert("Erros encontrados: \n" + aviso);
		return false;
	}
	return true;
}
function popup(url, w, h, nome, scrol){
	window.open(url,nome,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scrol+',resizable=1,width='+w+',height='+h+',left=0,top=0');
}
function confirmaExc(url, nome, secao){
	if (confirm("Tem certeza que deseja excluir " + secao + ", "+nome + "?"))
		location.href=url
}
function validarNovoUser(theForm) {
	aviso=""
	if(theForm.nome.value == "") aviso +="- Login (vazio)\n"
	if(theForm.email.value == "") aviso +="- E-mail (vazio)\n"
	if(theForm.senha.value == "") aviso +="- Senha (vazio)\n"
	if(theForm.senha.value.length <= 5) aviso +="- Senha deve ter no mínimo seis caracteres\n"
	if(theForm.senha.value != theForm.senha2.value) aviso +="- Senha não confirmada\n"
	if(aviso!=""){
		alert("Erros encontrados: \n" + aviso);
		return false;
	}
	return true;
}
function validarAtualizarUser(theForm) {
	aviso=""
	if(theForm.nome.value == "") aviso +="- Login (vazio)\n"
	if(theForm.email.value == "") aviso +="- E-mail (vazio)\n"
	if(theForm.senha.className == "campo"){
		if(theForm.senha.value == "") aviso +="- Senha (vazio)\n"
		if(theForm.senha.value.length <= 5) aviso +="- Senha deve ter no mínimo seis caracteres\n"
		if(theForm.senha.value != theForm.senha2.value) aviso +="- Senha não confirmada\n"
	}
	if(aviso!=""){
		alert("Erros encontrados: \n" + aviso);
		return false;
	}
	return true;
}
function validarAtualizarCliente(theForm) {
	aviso=""
	if(theForm.nome.value == "") aviso +="- Login (vazio)\n"
	if(theForm.email.value == "") aviso +="- E-mail (vazio)\n"
	if(theForm.cpfcnpj.value == "") aviso +="- CPF \ CNPJ (vazio)\n"
	if(aviso!=""){
		alert("Erros encontrados: \n" + aviso);
		return false;
	}
	return true;
}
function validarBoleto(theForm) {
	aviso=""
	if(theForm.venc.value == "") aviso +="- Vencimento (vazio)\n"
	if(theForm.qtde.value == "") aviso +="- Quantidade (vazio)\n"
	if(theForm.valor.value == "") aviso +="- Valor (vazio)\n"
	if(theForm.info.value == "") aviso +="- Informação (vazio)\n"
	if(aviso!=""){
		alert("Erros encontrados: \n" + aviso);
		return false;
	}
	return true;
}
function habilitar(){
	document.editar.elements['senha'].disabled = false
	document.editar.elements['senha2'].disabled = false
	document.editar.elements['senha'].className = "campo";
	document.editar.elements['senha2'].className = "campo";
}
function desabilitar(){
	document.editar.elements['senha'].disabled = true
	document.editar.elements['senha2'].disabled = true
	document.editar.elements['senha'].className = "campo2";
	document.editar.elements['senha2'].className = "campo2";
	document.editar.elements['senha'].value = "";
	document.editar.elements['senha2'].value = "";
}
