<!--
function FormataData(Campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = document.Form_NovoServico[Campo].value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			document.Form_NovoServico[Campo].value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
		if ( tam >= 5 && tam <= 10 )
			document.Form_NovoServico[Campo].value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); }
}

function FormataData2(Campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = document.Form_Pesquisa1[Campo].value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			document.Form_Pesquisa1[Campo].value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
		if ( tam >= 5 && tam <= 10 )
			document.Form_Pesquisa1[Campo].value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); }
}

function FormataString(Campo) 
{	
 texto = document.form[Campo].value;
 textoFinal ="";
 tamanhoParteTexto = 0;
 tamanhoTexto = 0;
 textoSemBranco=""
 i = 0;
 posicaoEspaco = 0;
 parteTexto  = "";
 parte1 = "";
 parte2 = "";
 var y;
 var x;
 var ch;

 tam = texto.length;
 for (var i=0; i < tam; i++)
 {	
  var ch =  texto.substring(i, i+1);  
  if (  ch == " " )
  {
 	ch2 = texto.substring (i+1 , i+2);
    if (  ch2 != " " )
    {
      textoSemBranco = textoSemBranco + ch;
    }
  }
  else
  {
    textoSemBranco = textoSemBranco + ch;
  }
 }
 texto = textoSemBranco;
 tamanhoTexto = texto.length ; 
 texto = texto.toLowerCase() + " ";
 i = 0;
 while ( i < tamanhoTexto  )
 {
   posicaoEspaco = texto.indexOf(" ");

   if ( posicaoEspaco == 0 )
   {
     parteTexto  = texto.substring( 0 );
   }
   else
   {
     parteTexto  = texto.substring( 0 , posicaoEspaco + 1 );
   }

   tamanhoParteTexto = parteTexto.length;
   textoSemBranco="";
   for ( x =0 ;  x <  parteTexto.length; x++)
   {
     ch =  parteTexto.substring (x, x + 1);
     if ( ch != " " )
	textoSemBranco = textoSemBranco + ch;  
   }  
   parteTexto = textoSemBranco;
  
   if ( parteTexto == "de" || parteTexto == "da" || parteTexto == "do" || parteTexto  == "das" || parteTexto == "dos" || parteTexto == "e" )
   {
     parteTexto = parteTexto.toLowerCase();
   }
   else
   {
     parte1 = ( parteTexto.substring(0,1)).toUpperCase();
     parte2 = parteTexto.substring(1);
     parteTexto = parte1 + parte2;
   }

   textoFinal = textoFinal + parteTexto + " ";
   i = i + tamanhoParteTexto;   
   texto = texto.substring( posicaoEspaco ) ;
 
   cond = false;	
 
   for ( y =0; !cond ; y++)
   {
    ch = texto.substring (y, y + 1);
    if ( ch != " " )
    {
      cond = true;
    }
   }  
   texto = texto.substring( y - 1 );
   posicaoEspaco = 0;
   parteTexto = "";
   tamanhoParteTexto = 0;
 } 
 document.form[Campo].value = textoFinal; 
}

function FormataUpperCase(Campo) 
{
  texto = document.form[Campo].value;
  texto = texto.toUpperCase();  
 document.form[Campo].value = texto; 
}

function FormataLowerCase(Campo) 
{
  texto = document.form[Campo].value;
  texto= texto.toLowerCase();  
 document.form[Campo].value = texto; 
}

function Retorna (Url)
{
 location.href=Url;
} 

function makeArray()
{
   this.length = makeArray.arguments.length
   for (var i = 0; i < this.length; i++)
   this[i + 1] = makeArray.arguments[i]
}

function randNum (num)
{
   var now = new Date();
   var rand = Math.round(num * Math.cos(now.getTime()));
   if (rand < 0) rand = - rand; if (rand == 0) rand++;
   return rand;
}

function Nova_Janela(link, janela, altura, largura, propriedades) 
{
  var winlargura = (screen.width - largura) / 2;
  var winTamanho = (screen.heigth - altura) / 2;
  propriedades = propriedades + ',width=' + altura + ',height=' + largura + ',top=' + winTamanho + ',left=' + winlargura;
  window.open(link,janela,propriedades);
}
function calculadora() 
{
window.open('calculadora.htm','calculadora', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top=30, width=200,height=200");}

function exibefoto(pagina,largura,altura)  {
	newWin = window.open(pagina ,"",
		"width="+largura+",height="+altura+",top=25,left=25,scrollbars=0");
	//window.close()	
}

function mOvr(src,clrOver) {if (!src.contains(event.fromElement)) {src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}
function mOut(src,clrIn) {if (!src.contains(event.toElement)) {src.style.cursor = 'default';
src.bgColor = clrIn;
}
}
//-->