function esconder( nomeCamada ) {
	document.getElementById( nomeCamada ).style.visibility = "hidden";
}
function mostrar(nomeCamada){
	document.getElementById(nomeCamada).style.visibility="visible";
}

function abre_signo ( endereco, nome, titulo ) {
	openwin = dhtmlwindow.open( nome, "iframe", endereco, titulo, "width=800px,height=420px,top=0px,resize=0,scrolling=0,center=1,frameborder=0", "recal" )
	openwin.onclose = function(){
		esconder( 'interVeil' );
		return
	}
}

function verificaEmail( objnome ) {
	invalid = Array("ç","~","!","@","#","$","%","^","&","*","(",")","+","=","[","]",":",";",",","\"","'","|","{","}","\\","/","<",">","?"," ");
	xemail = objnome.value;
	if ( xemail.indexOf( "@" ) == -1 ) {
		return true;
	} else {
		partes=xemail.split( "@" );
		if ( partes[0] == "" || partes[0].length < 2 ) {
		return true;
		} else {
			for ( i = 0; i < invalid.length; i++ ) {
				if ( partes[0].indexOf( invalid[i] ) != -1 ) {
					return true
				}
			}
		}
		if ( partes[1] == "" ) {
			return true;
		} else {
			if ( partes[1].indexOf( "." ) == -1 ) {
				return true;
			} else {
				ponto=partes[1].split( "." )
				if( ponto[0] == "" || ponto[0].length < 2 ){
					return true;
				} else {
					for( i = 0; i < invalid.length; i++ ) {
						if( ponto[0].indexOf( invalid[i] ) != -1 ){
							return true
						}
					}
				}
				if ( ponto[1] == "" ) {
					return true;
				}
			}
		}
	}
	return false
}
function valida( formulario ) {
	if ( formulario.nome.value == "" ) {
		alert( "Preencha o campo \"Nome\"" );
	} /*else if ( verificaEmail( document.formulario.email ) ) {
		alert( "Preencha o campo EMAIL corretamente, caracteres especiais não são permitidos" );
	} */else if ( formulario.cidade.value == "" || formulario.cidade.value == " " ) {
		alert( "Preencha o campo CIDADE" );
	} else if ( formulario.para.value == "" || formulario.para.value == " " ) {
		alert( "Informe o SETOR que receberá este email" );
	} else if ( formulario.comentario.value == "" || formulario.comentario.value == " ") {
		alert( "Preencha o campo COMENTÁRIO" );
	} else {
		submit();
	}
	return false;
}

function abre_enquete ( endereco, nome, titulo ) {
	openwin = dhtmlwindow.open( nome, "iframe", endereco, titulo, "width=400px,height=400px,top=0px,resize=0,scrolling=0,center=1", "recal" )
	openwin.onclose = function(){
		esconder( 'interVeil' );
		return
	}
}
function abre( id ) {
	var div=document.getElementById( id );
	if ( div.className=='esconde' ) {
		div.className='mostra';
	}
	return( false );
}
function fecha( id ) {
	var divf=document.getElementById( id );
	if ( divf.className=='mostra' ) {
		divf.className='esconde';
	}
	return( false );
}
function MM_jumpMenu( targ, selObj, restore ) {
	eval( targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'" );
	if ( restore ) selObj.selectedIndex = 0;
}
function liberaPedido(){
	
	if(document.pedido.nome.length <= 1 || document.pedido.nome.value == "Seu Nome"
	|| document.pedido.email.length <= 1 || document.pedido.email.value == "Seu E-mail"
	|| document.pedido.telefone.length <= 1 || document.pedido.telefone.value == "Telefone"
	|| document.pedido.cidade.length <= 1 || document.pedido.cidade.value == "Cidade"
	|| document.pedido.cantor.length <= 1 || document.pedido.cantor.value == "Cantor"
	|| document.pedido.musica.length <= 2 || document.pedido.musica.value == "Música"
	|| document.pedido.programa.value == ""){
		document.pedido.enviapedido.disabled = true;
	}else{
		document.pedido.enviapedido.disabled = false;
	}
}
function txtBoxFormat(objeto, sMask, evtKeyPress) {
    var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;


if(document.all) { 
    nTecla = evtKeyPress.keyCode;
} else if(document.layers) { 
    nTecla = evtKeyPress.which;
} else {
    nTecla = evtKeyPress.which;
    if (nTecla == 8) {
        return true;
    }
}

    sValue = objeto.value;

    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( " ", "" );
    sValue = sValue.toString().replace( " ", "" );
    fldLen = sValue.length;
    mskLen = sMask.length;

    i = 0;
    nCount = 0;
    sCod = "";
    mskLen = fldLen;

    while (i <= mskLen) {
      bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
      bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

      if (bolMask) {
        sCod += sMask.charAt(i);
        mskLen++; }
      else {
        sCod += sValue.charAt(nCount);
        nCount++;
      }

      i++;
    }

    objeto.value = sCod;

    if (nTecla != 8) {
      if (sMask.charAt(i-1) == "9") {
        return ((nTecla > 47) && (nTecla < 58)); } 
      else { 
        return true;
      } 
    }
    else {
      return true;
    }
  }
function exclui(id, pagina){
	if(confirm('Deseja mesmo deletar?')){
		location.href= pagina + ".php?id=" + id;
		return true;
	}else{
		return false;
	}
}
