function MostraFoto(img)                //esta função deve ser escrita no arquivo que será aberto na
{ 
  window.open("visualiza_foto.php?foto=" +img+"","foto","width=310, height=233");
  
}

function MostraFoto_Vert(img)          //esta função deve ser escrita no arquivo que será aberto na
{ 
  window.open("visualiza_foto_vert.php?foto_vert=" +img+"","foto","width=263, height=348");
  
}

function camponumero(campo) {

if (campo.value=="" && event.keyCode==47) {
  event.keyCode = 0;
} else {
  if (((event.keyCode) >= 48 ) && ((event.keyCode) <= 57 ))
    event.keyCode;
  else
    event.keyCode = 0;
  }
}

function FormEmitBoleto()                    
{ 
  window.open("vestibular/vestibular_emitir_boleto.php","frm_boleto","top=0, left=0, width=780, height=540 scrollbars=yes" );
  
}


function FormVestibular()                     
{ 
  window.open("vestibular/vestibular_insc.php","frm_vest","top=0, left=0, width=780, height=540 scrollbars=yes" );
  
}


//abre uma arquivo de noticia para impressão
function MostraNoticia(id_not)                     
{ 
  window.open("noticias_visualiza.php?id=" +id_not+"","Notícia","width=600, height=480 scrollbars=yes");
  
}

function MostraRel(arquivo)                     
{ 
  window.open(""+arquivo+"","Relatório","width=600, height=480 scrollbars=yes");
  
}


/*
       Biblioteca de Funções   	   
*/

function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen, bolMask, sCod, nTecla, ns, ie, mozzila;
/*
* Descrição.: formata um campo do formulário de acordo com a máscara informada 
* ------------------------------------------------------------------------------------------------------------------
* Parâmetros: 
* - objForm (o Objeto Form) 
* - strField (string contendo o nome do textbox) 
* - sMask (mascara que define o formato que o dado será apresentado, usando o algarismo "9" para definir números e 
* o símbolo "!" para qualquer caracter... 
* - evtKeyPress (evento) 
* ------------------------------------------------------------------------------------------------------------------
* Uso.......: <input type="textbox" 
* name="xxx"..... 
* onkeypress="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);"> 
* ------------------------------------------------------------------------------------------------------------------
* Observação: As máscaras podem ser representadas como os exemplos abaixo: 
* CEP -> 99.999-999 
* CPF -> 999.999.999-99 
* CNPJ -> 99.999.999/9999-99 
* Data -> 99/99/9999 
* Tel Resid -> (99) 999-9999 
* Tel Cel -> (99) 9999-9999 
* Processo -> 99.999999999/999-99 
* C/C -> 999999-! 
* E por aí vai... 
*/

// verifica qual o browser 
ns = ( document.layers) ? true : false; // netscape
ie = ( document.all) ? true : false;    // internet explorer
mozzila = ( document.getElementById) ? true : false; // mozzila

if (ns)
  nTecla = evtKeyPress.which;
else if (ie)
  nTecla = evtKeyPress.keyCode; 
else if (mozzila)
  nTecla = evtKeyPress.which;  

sValue = objForm[strField].value;

// Limpa todos os caracteres de formatação que
// já estiverem no campo.
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) == "/"))
  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++;
}

objForm[strField].value = sCod;

if (nTecla != 8) { // backspace
  if (sMask.charAt(i-1) == "9") { // apenas números... 
    return ((nTecla > 47) && (nTecla < 58)); 
  }  // números de 0 a 9
  else { // qualquer caracter...
    return true;
  } 
} else {
  return true;
}
}