<!--

function PopupPic(sPicURL) {
     window.open( "visualizar-imagem.asp?"+sPicURL, "", "resizable=no");
   }

function validar_login(){

if(document.getElementById('usuario').value==''){
alert('Preencha o campo Usuário');
document.getElementById('usuario').focus();
return false;
}

if(document.getElementById('senha').value==''){
alert('Preencha o campo Senha');
document.getElementById('senha').focus();
return false;
}

return true;

}


function confirma_exclusao(goto){
if (confirm("Deseja mesmo excluir este registro?")){
window.location = goto;
} else {
return false;
}
}

function valida_campo(campo){
	

if(document.getElementById('categoria').value==''){
alert('Preencha o campo categoria');
document.getElementById('categoria').focus();
return false;
}

if(document.getElementById('marca').value==''){
alert('Preencha o campo marca');
document.getElementById('marca').focus();
return false;
}

return true;
	
}

function desabilita_preco(){
if(document.getElementById('preco').disabled == false){
document.getElementById('preco').disabled = true;
document.getElementById('preco').value = '';
document.getElementById('preco').className = 'campo_desabilitado';

}else{
document.getElementById('preco').disabled = false;	
document.getElementById('preco').value = '';
document.getElementById('preco').className = 'txtazul';
}
	
}


function muda(numero,total_numero){

if(document.getElementById('alterar_categoria_'+numero).style.display=='none'){

document.getElementById('alterar_categoria_'+numero).style.display='block';
document.getElementById('mostrar_categoria_'+numero).style.display='none';

document.getElementById('categoria_'+numero).focus();
document.getElementById('categoria_'+numero).select();


for(i=1;i<numero;i++){
document.getElementById('alterar_categoria_'+i).style.display='none';
document.getElementById('mostrar_categoria_'+i).style.display='block';

}

for(j=total_numero;j>numero;j--){
document.getElementById('alterar_categoria_'+j).style.display='none';
document.getElementById('mostrar_categoria_'+j).style.display='block';
}

}else{
document.getElementById('alterar_categoria_'+numero).style.display='none';
document.getElementById('mostrar_categoria_'+numero).style.display='block';

}

}
//////////// MÁSCARA VALOR MONETÁRIO ////////////
//ex.: onKeyDown='FormataValor(this, 13, event)
function FormataValor(obj, tammax, teclapres) {
 var tecla = teclapres.keyCode;
 vr = obj.value;
 vr = vr.replace('/', '' );
 vr = vr.replace('/', '' );
 vr = vr.replace(',', '' );
 vr = vr.replace(',', '' );
 vr = vr.replace('.', '' );
 vr = vr.replace('.', '' );
 vr = vr.replace('.', '' );
 vr = vr.replace('.', '' );
 //Replaces adicionais
 //vr = vr.replace( "-", "" );
 //vr = vr.replace( "+", "" );
 //vr = vr.replace( "*", "" );
 tam = vr.length + 1;
 
 if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
 
 if (tecla == 8 ){ tam = tam - 1 ; }
  
 if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
  if ( tam <= 2 ){ 
   obj.value = vr ; }
  if ( (tam > 2) && (tam <= 5) ){
   obj.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 6) && (tam <= 8) ){
   obj.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 9) && (tam <= 11) ){
   obj.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 12) && (tam <= 14) ){
   obj.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 15) && (tam <= 17) ){
   obj.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
 }
}
//////////// **** FIM MÁSCARA VALOR MONETÁRIO ////////////

//////////// MÁSCARA APENAS NUMEROS ////////////
function mascara_numeros(e){
	if(window.event){
		key = e.keyCode;
	}else if(e.which){
		key = e.which;
	}
	if (key!=8 || key < 48 || key > 57) return (((key > 47) && (key < 58)) || (key==8));
	{
	return true;
	}
}
//////////// *** FIM MÁSCARA APENAS NUMEROS ////////////


//////////// BOQUEIA ASPAS SIMPLES PRA NAO DAR PROBLEMA NO BD ////////////	
function bloqueia_aspas(e){
	if(window.event){
		key = e.keyCode;
	}else if(e.which){
		key = e.which;
	}
	if (key != 8) return (((key > 40) || (key < 38)) || (key==8));
	{
	return true;
	}
}
//////////// *** FIM BOQUEIA ASPAS SIMPLES PRA NAO DAR PROBLEMA NO BD ////////////	
-->