//=======  INICIO TRABALHAR COM LISTA =============
//sortitems = 1;
function f_Apaga_Toda_Lista(p_NOME_OBJ){
	fbox = document.getElementById( p_NOME_OBJ );
	for(var i=0; i<fbox.options.length; i++){
		fbox.options[i].value = "";
		fbox.options[i].text = "";
	}
}

function f_Move_Item_Lista(fbox,tbox,sortitems){
	for(var i=0; i<fbox.options.length; i++){
		if(fbox.options[i].selected && fbox.options[i].value != ""){
			var no = new Option();
			no.value = fbox.options[i].value;
			no.text = fbox.options[i].text;
			tbox.options[tbox.options.length] = no;
			fbox.options[i].value = "";
			fbox.options[i].text = "";
		}
	}
	f_Ordenar_Lista(fbox);
	if (sortitems) SortD(tbox);
}

function f_Ordenar_Lista(box){
	for(var i=0; i<box.options.length; i++){
		if(box.options[i].value == "")  {
			for(var j=i; j<box.options.length-1; j++)  {
				box.options[j].value = box.options[j+1].value;
				box.options[j].text = box.options[j+1].text;
			}
		var ln = i;
		break;
	   }
	}
	if(ln < box.options.length){
		box.options.length -= 1;
		f_Ordenar_Lista(box);
   }
}

function SortD(box){
	var temp_opts = new Array();
	var temp = new Object();
	for(var i=0; i<box.options.length; i++){
		temp_opts[i] = box.options[i];
	}
	for(var x=0; x<temp_opts.length-1; x++){
		for(var y=(x+1); y<temp_opts.length; y++){
			if(temp_opts[x].text > temp_opts[y].text){
				temp = temp_opts[x].text;
				temp_opts[x].text = temp_opts[y].text;
				temp_opts[y].text = temp;
				temp = temp_opts[x].value;
				temp_opts[x].value = temp_opts[y].value;
				temp_opts[y].value = temp;
			}
		}
	}
	for(var i=0; i<box.options.length; i++){
		box.options[i].value = temp_opts[i].value;
		box.options[i].text = temp_opts[i].text;
	}
}
//=======  FIM TRABALHAR COM LIKSTA ===============

function f_SEmarca(){
	var fbox = document.frm1.lst_FILTRO_ORDEM_SELECIONADA
	for(var i=0; i<fbox.options.length; i++){
	   fbox.options[i].selected = true
	}
}	

function f_Marca_Toda_Lista(fbox){
	for(var i=0; i<fbox.options.length; i++){
	   fbox.options[i].selected = true
	}
}	


// FIM ==FUNCOES PARA MARCAR LINHA TABELA SELECIONADA COM CHECK-BOX
function f_carrega_LISTA(p_NOME_OBJ,p_VALORES,p_TEXTOS){
	var jVetValor = p_VALORES.split(',')
	var jVetTexto = p_TEXTOS.split(',')

	tbox = document.getElementById( p_NOME_OBJ );
	for (i=0; i<=jVetValor.length-1 ; i++){
		if(jVetTexto[i] != ''){
			var no = new Option();
			no.value = jVetValor[i]
			no.text =  jVetTexto[i]
			tbox.options[tbox.options.length] = no;
		}	
	}
}

// Função para limpatr lista na opção de cancela filtro
function f_Limpa_LISTA_SELECIONADA(p_NOME_OBJ_ORIG,p_NOME_OBJ_DEST){
	obj_ORIGEM = document.getElementById( p_NOME_OBJ_ORIG );
	obj_DESTINO = document.getElementById( p_NOME_OBJ_DEST );
	if(obj_ORIGEM.options.length > 0) {
		for(var i=(obj_ORIGEM.options.length-1); i>-1 ; i--){
			obj_ORIGEM.options[i].selected = true
			f_Move_Item_Lista(obj_ORIGEM,obj_DESTINO,1)
			if(obj_ORIGEM.options.length == 0) {
				
			}
		}
	}	
}

function f_Seleciona_LISTA(p_NOME_OBJ_ORIG){
	obj_ORIGEM = document.getElementById( p_NOME_OBJ_ORIG );
	if(obj_ORIGEM.options.length > 0) {
		for(var i=(obj_ORIGEM.options.length-1); i>-1 ; i--){
			obj_ORIGEM.options[i].selected = true
			if(obj_ORIGEM.options.length == 0) {
				
			}
		}
	}	
}

//==FUNCOES PARA MARCAR LINHA TABELA SELECIONADA COM CHECK-BOX
function Check2(e){
	if(e.checked == false){
		Unhighlight(e);
	}else{	
		Highlight(e);
	}	
}

function Highlight(e){
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}else{
		 if (e.parentElement && e.parentElement.parentElement) {
	    	r = e.parentElement.parentElement;
		}	
	}
	if (r){
		r.className = "muda_cor_td_chk_box_cinza";
	}
}

function Unhighlight(e){
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}else{
		 if (e.parentElement && e.parentElement.parentElement) {
	    	r = e.parentElement.parentElement;
		}	
	}
	if (r){
		r.className = "muda_cor_td_chk_box_branco";
	}
}


// FIM ==FUNCOES PARA MARCAR LINHA TABELA SELECIONADA COM CHECK-BOX

function f_carrega_LISTA(p_NOME_OBJ,p_VALORES,p_TEXTOS){
	var jVetValor = p_VALORES.split(',')
	var jVetTexto = p_TEXTOS.split(',')

	tbox = document.getElementById( p_NOME_OBJ );
	for (i=0; i<=jVetValor.length-1 ; i++){
		if(jVetTexto[i] != ''){
			var no = new Option();
			no.value = jVetValor[i]
			no.text =  jVetTexto[i]
			tbox.options[tbox.options.length] = no;
		}	
	}
}

// Função para limpatr lista na opção de cancela filtro
function f_Limpa_LISTA_SELECIONADA(p_NOME_OBJ_ORIG,p_NOME_OBJ_DEST){
	obj_ORIGEM = document.getElementById( p_NOME_OBJ_ORIG );
	obj_DESTINO = document.getElementById( p_NOME_OBJ_DEST );
	if(obj_ORIGEM.options.length > 0) {
		for(var i=(obj_ORIGEM.options.length-1); i>-1 ; i--){
			obj_ORIGEM.options[i].selected = true
			move(obj_ORIGEM,obj_DESTINO,1)
			if(obj_ORIGEM.options.length == 0) {
				
			}
		}
	}	
}

function f_Seleciona_LISTA(p_NOME_OBJ_ORIG){
	obj_ORIGEM = document.getElementById( p_NOME_OBJ_ORIG );
	if(obj_ORIGEM.options.length > 0) {
		for(var i=(obj_ORIGEM.options.length-1); i>-1 ; i--){
			obj_ORIGEM.options[i].selected = true
			if(obj_ORIGEM.options.length == 0) {
				
			}
		}
	}	
}

// Função para chamada da págna para paginação
function f_Carrega_Paginacao(p_pagatual,p_qtd_reg_pag, p_nome_pag_atual){

	if(p_pagatual != ''){
		document.frm1.hdn_NUM_PAGINA_CORRENTE.value = p_pagatual
	}

	document.frm1.action = p_nome_pag_atual
	document.frm1.submit()	
}

// Verifica se o o caracter digitado é válido
function f_CaracterInvalido(){
   //var digitos = "#  &  '  "  `  ´   ;"
	var digitos = "|35|38|39|34|96|180|59|"
	//alert(event.keyCode)
	if (document.all) // Internet Explorer
		var tecla = '|' + event.keyCode + '|';
	else if(document.layers) // Nestcape
		var tecla = e.which;

	//alert(tecla)
	//tecla = String.fromCharCode(tecla)	
	//alert(tecla)
	//alert(digitos.indexOf(tecla))
	
	if (digitos.indexOf(tecla) < 0 ){
		return true;
	}else{
		event.keyCode = 0;
		alert("Caracter inválido");				
	}
}

function formataCPF(pCampo,pTamMax,pPos1,pPos2,pPosTraco,pTeclaPres){

//maxlength="14" onkeypress="formataCPF(this,11,8,5,2,event)

  var wTecla, wVr, wTam;
  
  wTecla = pTeclaPres.keyCode;
  wVr = pCampo.value;
  wVr = wVr.toString().replace( "-", "" );
  wVr = wVr.toString().replace( ".", "" );
  wVr = wVr.toString().replace( ".", "" );
  wVr = wVr.toString().replace( "/", "" );
  wTam = wVr.length ;
  
  if(wTam < pTamMax && wTecla != 8) { 
    wTam = wVr.length + 1 ; 
  }
  
  if(wTecla == 8 ) { 
    wTam = wTam - 1 ; 
  }
  
  if( wTecla == 8 || wTecla == 88 || wTecla >= 48 && wTecla <= 57 || wTecla >= 96 && wTecla <= 105 ){
    if( wTam <= 2 ){
    pCampo.value = wVr ;
  }
  if(wTam > pPosTraco && wTam <= pTamMax) {
    wVr = wVr.substr(0, wTam - pPosTraco) + '-' + wVr.substr(wTam - pPosTraco, wTam);
  }
  if( wTam == pTamMax){
    wVr = wVr.substr( 0, wTam - pPos1 ) + '.' + wVr.substr(wTam - pPos1, 3) + '.' + wVr.substr(wTam - pPos2, wTam);
  }
  
  pCampo.value = wVr;
  
  }
}

function f_operacao_calcula(tipo) {

	valor1 = Number(document. form1.campo1. value);
	
	valor2 = Number(document. form1.campo2. value);
	
	if (tipo == '*'){
	
	document.form1. valorfinal. value = valor1 * valor2;
	
	}else if (tipo == '+'){
	
	document.form1. valorfinal. value = valor1 + valor2;
	
	}else if (tipo == '-'){
	
	document.form1. valorfinal. value = valor1 - valor2;
	
	}else if (tipo == '/'){
	
	document.form1. valorfinal. value = valor1 / valor2;
	
	}else if (tipo == '%'){
	
	document.form1. valorfinal. value = ((valor2 * 100) / valor1);
	
	}else if (tipo == '^'){
	
	document.form1. valorfinal. value = (Math.pow(valor1, valor2))
	;
	
	}
	
	return;

}

function f_Soma_Data(jstr_DATADDMMYYYY,jint_QTD,jstr_UNID,jstr_NOMEOBJ){

	//alert('jstr_DATADDMMYYYY = ' + jstr_DATADDMMYYYY )
	//alert('jint_QTD = ' + jint_QTD )
	//alert('jstr_UNID = ' + jstr_UNID )
	
	//alert(jstr_DATADDMMYYYY.substr(3,2))
	//alert(jstr_DATADDMMYYYY.substr(0,2))
	//alert(jstr_DATADDMMYYYY.substr(6))

	//alert('jstr_DATADDMMYYYY = ' + jstr_DATADDMMYYYY)
	//alert('jint_QTD = ' + jint_QTD)
	//alert('jstr_UNID = ' + jstr_UNID)
	//alert('jstr_NOMEOBJ = ' + jstr_NOMEOBJ)

	if((jstr_DATADDMMYYYY=='')||
		(jint_QTD=='')||
		(jstr_UNID=='')||
		(jstr_NOMEOBJ=='')){
		return;
	}
	
	var jstr_DTMMDDYYYY = jstr_DATADDMMYYYY.substr(3,2) + "/" + jstr_DATADDMMYYYY.substr(0,2) + "/" + jstr_DATADDMMYYYY.substr(6)

	//alert('jstr_DTMMDDYYYY = ' + jstr_DTMMDDYYYY)

	var jdat_DATA = new Date(jstr_DTMMDDYYYY);

	//alert('jdat_DATA = ' + jdat_DATA)
	//alert(jdat_DATA.getDate()+parseInt(jint_QTD))
	//alert('jdat_DATA = ' + jdat_DATA)
	
	if(jstr_UNID=='d'){
		jint_DAY = jdat_DATA.getDate()+parseInt(jint_QTD)
		jint_MONTH = jdat_DATA.getMonth()
		jint_YEAR = jdat_DATA.getFullYear()
		//alert("jint_DAY = " + jint_DAY)
		//alert("jint_MONTH = " + jint_MONTH)
		//alert("jint_YEAR = " + jint_YEAR)
		
	}
	if(jstr_UNID=='m'){		
		jint_DAY = jdat_DATA.getDate()
		jint_MONTH = jdat_DATA.getMonth()+parseInt(jint_QTD)
		jint_YEAR = jdat_DATA.getFullYear()
	}
	if(jstr_UNID=='y'){		
		jint_DAY = jdat_DATA.getDate()
		jint_MONTH =  jdat_DATA.getDate()
		jint_YEAR = jdat_DATA.getFullYear()+parseInt(jint_QTD)
	}

	var myDate=new Date(jint_YEAR,jint_MONTH,jint_DAY)
	
		jstr_DAY =  myDate.getDate() + ''		
		if(jstr_DAY.length == 1){
			jstr_DAY = '0' + jstr_DAY
		}
		jstr_MONTH = myDate.getMonth()+1 + ''
		if(jstr_MONTH.length == 1){			
			jstr_MONTH = '0' + jstr_MONTH
		}
		jstr_YEAR = myDate.getFullYear()
	
	//alert('jstr_DAY = ' + jstr_DAY)
	//alert('jstr_MONTH = ' + jstr_MONTH)
	//alert('jstr_YEAR = ' + jstr_YEAR)
	
	jobj_Objeto = document.getElementById( jstr_NOMEOBJ );
	jobj_Objeto.value = jstr_DAY + '/' + jstr_MONTH + '/' + jstr_YEAR
	//alert(myDate)
	//alert(myDate.getFullYear())
	//alert(myDate.getMonth()+1)
	//alert(myDate.getDate())

	//myDate.setDate(myDate.getDate()+5)
	
	//alert(myDate)
	//alert(myDate.getFullYear(myDate))
	//alert(myDate.getMonth(myDate)+13)
	//alert(myDate.getDate(myDate))
	//myDate=new Date(2006,15,30)
	//alert('ultimo = ' + myDate)
	
}

function f_Soma_Data2(){
	myDate = new Date(2005,12,31); 
	month = myDate.getMonth(); 
	 modifiedMonth = month+2; 
 	alert(modifiedMonth)
	 modifiedDate = new Date(2005, modifiedMonth,31); 
}

var janela;	
var intCtrSubmit = 0

function f_SystemPrintPreview(OLECMDID)
{
//var OLECMDID = 10;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 8 - page setup (for printing)
* 1 - open window
* 4 - Save As
* 10 - properties
*/try
{
var PROMPT = 1; // 1 PROMPT & 2 DONT PROMPT USER
var oWebBrowser = document.getElementById("WebBrowser1");
if(oWebBrowser == null)
{
var sWebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', sWebBrowser);
oWebBrowser = document.getElementById("WebBrowser1");
//WebBrowser1.outerHTML = "";
}
oWebBrowser.ExecWB(OLECMDID,PROMPT);
}
catch(e){alert("Printing failed! " + e.message);}
}


//************************************************
// Funções utilizadas e padronizadas
//************************************************
//function f_Validade_Qtd_Flt_Obj(obj,qtd_max)
//	{
//	var flt_QTD
//	flt_QTD = parseFloat(obj.value)
//	}

function f_Mostra_Esconde(p_str_obj, p_str_acao){
	//alert(p_str_obj)
	//alert(p_str_acao)

	//document.getElementById(divEsconde).style.visibility = 'hidden';
	//document.getElementById(divMostra).style.visibility = 'visible';
	//document.getElementById(divMostra).style.display = 'block';
	//document.getElementById(divMostra).style.display = 'none';
	
	jobj_Objeto = document.getElementById( p_str_obj );
	if(jobj_Objeto!=null){
		jobj_Objeto.style.display = p_str_acao;
		//alert(jobj_Objeto.style.display)
	}
}

function verifica_email_21(email)
{
	var achou_ponto=false;
	var achou_arroba=false;
	var achou_caracter=false;
	var achou_plic=false;
	
	for (var i=0;i<email.length;i++)
	{
		if (email.charAt(i)=="@") 
			achou_arroba=true;
		else if (email.charAt(i)==".") 
			achou_ponto=true;
			else if (email.charAt(i)=="'") 
				achou_plic=true;
				else if (email.charAt(i)!=" ") 
					achou_caracter=true;
	}
	
	if (achou_plic)
		return false;
	
	return (achou_ponto && achou_arroba && achou_caracter);
}

function f_tamanho_maximo2(obj,max,evento,idobj) {
	//alert(idobj)
	if (obj.value.length > max) {
		obj.value = obj.value.substr(0,max);
		alert('O número máximo de ' + max + ' caracteres já foi atingido!');
	}
	if (evento = 'd') {
		conta = (max - obj.value.length);
		document.getElementById(idobj).innerHTML = conta;
	}
}

function f_tamanho_maximo(titulocampo,valor,minimo,maximo)
	{
//		onBlur="f_tamanho_maximo('primeira quinzena',this.value,1,15)"
	if((valor<minimo)||(valor>maximo))
		{
		alert('O valor do campo ' + titulocampo + ' deverá estar compreendido entre ' + minimo + ' e ' + maximo)
		return false
		}
		return true
	}

function f_qtd_caracter(maximo,objds,objtamanho)
	{
	//valor=document.frm1.txtDescMacroPerfil.value.length;
	//document.frm1.txttamanho.value=valor
	
	//(400,txt_RDDU_TX_TEXTO_2,txt_TAMANHO_2)
		
	valor = objds.value.length
	objtamanho.value=valor
	
	//alert(maximo)
	//alert(valor)

	//alert(objds.name)
	//alert(objtamanho.name)
	
	
	if (valor > maximo) 
		{
		//str1=document.frm1.txtDescMacroPerfil.value;
		//str2=str1.slice(0,61);
		//document.frm1.txtDescMacroPerfil.value=str2;
		//valor=str2.length;
		//document.frm1.txttamanho.value=valor;
		str1=objds.value
		str2=str1.slice(0,maximo);
		objds.value=str2;
		valor=str2.length;
		objtamanho.value=valor;
		}
	}

function ComparaDataPeriodo(strDataIni,strDataTer,strTexto)
{
		//alert("aaaa")
	var strDataAtual = new Date();
	//alert(strDataIni)
	//alert(strDataTer)
	if((!strDataIni=='')&&(!strDataTer==''))
		{
		var strDT_Ini_Antes = strDataIni.substr(3,2) + "/" + strDataIni.substr(0,2) + "/" + strDataIni.substr(6)
		//alert(strDT_Antes)
		var strDT_Ini_Depois = new Date(strDT_Ini_Antes)
		//alert(strDT_Depois)
		var strDT_Ter_Antes = strDataTer.substr(3,2) + "/" + strDataTer.substr(0,2) + "/" + strDataTer.substr(6)
		//alert(strDT_Antes)
		var strDT_Ter_Depois = new Date(strDT_Ter_Antes)
		//alert(strDT_Depois)
	
		//alert(strDT_Ini_Depois)
		//alert(strDT_Ter_Depois)
		
		if (strDT_Ini_Depois > strDT_Ter_Depois)
			{
			alert(strTexto);		
			return false;				
			}
		else
			{
			return true;				
			}
		}
}

function ComparaNumeroPeriodo(intNumeroIni,intNumeroTer,strTexto)
{
	//alert(intNumeroIni)
	//alert(intNumeroTer)
	
	if((!intNumeroIni=='')&&(!intNumeroTer==''))
		{
		var intNumeroIni_Antes = intNumeroIni
		//alert(strDT_Antes)
		var intNumeroIni_Depois = new Number(intNumeroIni_Antes)
		//alert(strDT_Depois)
	
		var intNumeroTer_Antes = intNumeroTer
		//alert(strDT_Antes)
		var intNumeroTer_Depois = new Number(intNumeroTer_Antes)
		//alert(strDT_Depois)
	
		if (intNumeroIni_Depois > intNumeroTer_Depois)
			{
			alert(strTexto);		
			return false;				
			}
		else
			{
			return true;				
			}
	}
}

function f_trim(campo) { 
	var i = 0
	var j = campo.length-1
	var digitos = " "
	
	while (i < campo.length && digitos.indexOf(campo.charAt(i)) == 0 ) 
		// Enquanto o caractere for branco, avanca o indice do inicio 
		i++;
	while (j > i && digitos.indexOf(campo.charAt(j)) == 0 ) 
		// Enquanto o caractere for branco, retrocede o indice do fim
		j--;
	return campo.substring(i,j+1); // Retorna a string sem os espacos em branco no inicio e no fim
}

function f_pagina_principal()
	{
		//self.location = p_raiz + "../index.asp"
		self.location = "../index.asp"

//	janela = window.open('opener.asp?pIndice=4','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
 	//  window.location.href.href='altera_Atividade1.asp?selAtiv='+document.frm1.selAtividade.value
 	//  window.location.href='altera_modulo1.asp?selMod='+document.frm1.selModulo.value
	//	void(window.open('https://ww28.itau.com.br/callbacknet/cta1.aspx','_blank','height=358,width=347,screenX=0,screenY=0,top=0,left=0'));		
	}

function f_pagina_index(p_raiz){
	self.location = p_raiz + "../index.asp"
}

// Fim das Funções utilizadas e padronizadas
//**********************************************



function logoff()
{

	if(!confirm("Deseja efetuar logoff?")){return false;}
	parent.location = "default.asp?action=logoff";

}
function ValidaHora(campo,hora)
{

	if(hora == ""){return true;}

	if(isNaN(hora.substring(0,2)) )
	{
		alert("Hora inválida.")
		campo.focus();
		return false;
	}
	
	if(hora.substring(0,2) > 23)
	{
		alert("Hora inválida.")
		campo.focus();
		return false;
	}
	
	if(hora.substring(2,3) != ":"  )
	{
		alert("Hora inválida.")
		campo.focus();
		return false;
	}
	
	
	if(isNaN(hora.substring(3,5)) )
	{
		alert("Hora inválida.")
		campo.focus();
		return false;
	}
	
	if(hora.substring(3,5) > 59)
	{
		alert("Hora inválida.")
		campo.focus();
		return false;
	}	

	return true;

}
function fu_vald_camp_inte(pa_camp)
{
    var wk_camp_valr;
    wk_camp_valr = pa_camp.value;
    if (!isInteger(wk_camp_valr))
    {
        alert("O valor deve ser um número.");
        return false;        
    }
	return true
}

function DataMaiorHoje(objData,strTexto)
{
	var strDataAtual = new Date();
	var strDataInf = objData.value
	//alert(strDataInf)
	var strDT_Antes = strDataInf.substr(3,2) + "/" + strDataInf.substr(0,2) + "/" + strDataInf.substr(6)
	//alert(strDT_Antes)
	var strDT_Depois = new Date(strDT_Antes)
	//alert(strDT_Depois)

	if (strDT_Depois > strDataAtual)
		{
		alert('A ' + strTexto + ' não pode ser maior do que a data de hoje.');
		objData.value = ""
		return false;				
		}
	else
		{
		return true;				
		}
}

function comparadata(datData1,datData2,strComparacao,strTexto)
	//implementar
{
	var strDataAtual = new Date();
	var strDataInf = datData1.value
	//alert(strDataInf)
	var strDT_Antes = strDataInf.substr(3,2) + "/" + strDataInf.substr(0,2) + "/" + strDataInf.substr(6)
	//alert(strDT_Antes)
	var strDT_Depois = new Date(strDT_Antes)
	//alert(strDT_Depois)

	if (strDT_Depois > strDataAtual)
		{
		alert('A ' + strTexto + ' não pode ser maior do que a data de hoje.');
		objData.value = ""
		return false;				
		}
	else
		{
		return true;				
		}
}

//--Função Itau

function CarregaCampos()
	{
	/* INICIO PEGA PARAMETROS EM ARQUIVO COM QUALQUER EXTENSÃO */
	var Path = new String;
	var Args = new Array;
	var NomeCampo = new String;
	var ValorCampo = new String;
	
	Path = window.location.href;
	
	if (Path.indexOf('?') > -1)
		{
		Path = Path.substr(Path.indexOf('?') + 1,Path.length - Path.indexOf('?'));
		if (Path.indexOf('&') > -1)
			{
			Args = Path.split('&');
			}
		else if (Path.indexOf('%26') > -1)
			{
			Args = Path.split('%26');
			}
		else
			{
			Args[0] = Path.substr(Path.indexOf('?') + 1,Path.length - Path.indexOf('?'));
			}
		
		for (i=0; i<=Args.length-1 ; i++)
			{
			NomeCampo = Args[i].substr(0,Args[i].indexOf('='));
			ValorCampo = Args[i].substr(Args[i].indexOf('=') + 1,Path.length - Path.indexOf('?'));
			
			var ArrValor = new Array
			var NomeCliente = new String;
			//nome=&cpf=&email=
			if (NomeCampo.toUpperCase() == 'NOME')
				{
				document.form1.nome.value = ValorCampo
				
				if (ValorCampo.indexOf(' ') > -1)
					{
					ArrValor = ValorCampo.split(' ')
					}
				else
					{
					ArrValor[0] = ValorCampo.toString()
					}
				
				NomeCliente = ArrValor[0]
				
				if (NomeCliente.length > 0  )
					{
					document.all['Tit'].innerHTML = '<font face="Arial, Helvetica, sans-serif" color=#FF8400 size="+2">Olá, ' + NomeCliente  + '.</font><br><font face="Arial, Helvetica, sans-serif" size=2 class="txt11">Confira os dados abaixo e preencha os outros campos<br> para enviar seu pedido de abertura de conta.</font>';
					}
				else
					{
					document.all['Tit'].innerHTML = '<img src="../_img/tit_aberturadeconta.gif" width="240" height="25"><br>';
					}	
				}		
			
			if (NomeCampo.toUpperCase() == 'CPF')
				{
				
				document.form1.cpf.value = ValorCampo
				}
			
			if (NomeCampo.toUpperCase() == 'EMAIL')
				{
				document.form1.email.value = ValorCampo
				}
			
			if (NomeCampo.toUpperCase() == 'TIPO')
					{
					if (parseInt(ValorCampo) >= 0 &&  parseInt(ValorCampo) < 3)
						{
						document.form1.tipoconta[parseInt(ValorCampo)].checked = true
						}	
					}	
			}
		}	
	else
		{
		document.all['Tit'].innerHTML = '<img src="../_img/tit_aberturadeconta.gif" width="240" height="25"><br>';
		}	
	/* FIM PEGA PARAMETROS EM ARQUIVO COM QUALQUER EXTENSÃO */
	}

function Abre_Atendimento()
	{
	//window.open('http://www.itau.com.br/redeag/rede_atendimento.htm','Atendimento_htm','toolbar=no,location=no,Directory=no,Status=no,menubar=no,scrollbars=yes,resizable=yes,width=795,height=500,top=50,left=50');
	window.open('../busca/Frm_Busca.htm','Frm_Busca_htm','toolbar=no,location=no,Directory=no,Status=no,menubar=no,scrollbars=yes,resizable=yes,width=330,height=550,top=50,left=50');
	}
//-------------------------------------------------------------------------
//Funcoes de verificação
//-------------------------------------------------------------------------
function EhIgual(campo) { // Verifica se todos os valores são iguais
	var i = 0
	var j = 1
	var igual = true;
	// Todos os caracteres devem ser diferentes
	while (i < campo.length-1 && igual == true) {
		while (j < campo.length && igual == true) {
			if (campo.charAt(i) != campo.charAt(j)) {
				igual = false;
			}
			else j++;
		}
		i++;
	}
	return igual;
}

function EhNumero(campo) { // Verifica se o valor é númerico e diferente de zero e não é tudo igual
	var i
	var digitos = "0123456789"
	var zero = "0"	

	// Todos os caracteres devem ser digitos
	for (i=0; i < campo.length; i++) {
		if (digitos.indexOf(campo.charAt(i)) < 0 ) {
			return false;	
		}
	}
	return true;
}
function Trim(campo) { 
	var i = 0
	var j = campo.length-1
	var digitos = " "
	
	while (i < campo.length && digitos.indexOf(campo.charAt(i)) == 0 ) 
		// Enquanto o caractere for branco, avanca o indice do inicio 
		i++;
	while (j > i && digitos.indexOf(campo.charAt(j)) == 0 ) 
		// Enquanto o caractere for branco, retrocede o indice do fim
		j--;
	return campo.substring(i,j+1); // Retorna a string sem os espacos em branco no inicio e no fim
}

VerifiqueTAB=true;
function Mostra(quem, tammax) {
   if ( (quem.value.length == tammax) && (VerifiqueTAB) ) { 
     var i=0,j=0, indice=-1;
     for (i=0; i<document.forms.length; i++) { 
       for (j=0; j<document.forms[i].elements.length; j++) { 
          if (document.forms[i].elements[j].name == quem.name) { 
            indice=i;
            break;
          } 
       } 
       if (indice != -1) break; 
     } 
     for (i=0; i<=document.forms[indice].elements.length; i++) { 
       if (document.forms[indice].elements[i].name == quem.name) { 
          while ( (document.forms[indice].elements[(i+1)].type == "hidden") &&
                  (i < document.forms[indice].elements.length) ) { 
             i++;
          } 
          document.forms[indice].elements[(i+1)].focus();
          VerifiqueTAB=false;
          break;
       } 
     } 
   } 
} 

function PararTAB(quem) { VerifiqueTAB=false; } 
function ChecarTAB() { VerifiqueTAB=true; } 

//Verifica a consistencia do CPF
function check_cpf(numcpf) {
	if (EhIgual(numcpf)==true) { alert ("Numero do CPF invalido!"); return false; }
	x=0; soma=0; dig1=0; dig2=0; texto=""; numcpf1="";
	len = numcpf.length; x = len -1;
	for (var i=0; i <= len - 3; i++) {
		y = numcpf.substring(i,i+1); soma = soma + ( y * x);
		x = x - 1; texto = texto + y;
	}
	dig1 = 11 - (soma % 11);
	if (dig1 == 10) dig1=0 ; if (dig1 == 11) dig1=0 ;
	numcpf1 = numcpf.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	for (var i=0; i <= len - 2; i++) {
		soma = soma + (numcpf1.substring(i,i+1) * x); x = x - 1;
	}
	dig2= 11 - (soma % 11);
	if (dig2 == 10) dig2=0; if (dig2 == 11) dig2=0;
	if ((dig1 + "" + dig2) == numcpf.substring(len,len-2)) {
		return true;
	}
	alert ("Numero do CPF invalido!");
	return false;
}

//-------------------------------------------------------------------------
//Fim das funcoes de verificaçoes
//-------------------------------------------------------------------------

function Confirma() {
	//Tipo de conta
	if(document.form1.tipoconta[0].checked == false && document.form1.tipoconta[1].checked == false && document.form1.tipoconta[2].checked == false) {
		alert("Por favor, escolha o tipo de conta que deseja abrir."); 
		document.form1.tipoconta[0].focus();
		return false;
	}	
	//CPF
	if(document.form1.cpf.value.length < 1) {
		alert("Por favor, informe o CPF."); 
		document.form1.cpf.focus(); return false;
	}
	if(document.form1.cpf.value.length > 0) {
		if (!check_cpf(document.form1.cpf.value)) {
			document.form1.cpf.focus(); return false;
		}
	}
	//Nome
	document.form1.nome.value = Trim(document.form1.nome.value);
	if (document.form1.nome.value.length < 3) { 
		alert("Por favor, informe o nome."); 
		document.form1.nome.focus(); return false; 
	}
	else
	{
		// Verifica a ocorrência de caracteres especias!
		var nome  = RetiraAcentos( document.form1.nome.value );
		var regExp = /^([1-9a-zA-Z0-1@.\s]{1,255})$/;
		
		if( !regExp.test( nome ) )
		{
			alert("Ocorrência de caractere inválido no campo NOME."); 
			document.form1.nome.focus();
			return false; 
		}
	}
	
	//e-mail
	if(document.form1.email.value.length > 0) {
      i = document.form1.email.value.indexOf("@")
      j = document.form1.email.value.indexOf(".", i)
      k = document.form1.email.value.indexOf(",")
      kk = document.form1.email.value.indexOf(" ")
      jj = document.form1.email.value.lastIndexOf(".") + 1
      len = document.form1.email.value.length

      if((i > 0) && (j > (1 + 1)) && (k == -1) && (kk == -1) && (len -jj >= 2) && (len - jj <= 3)) {
      }
      else {
          alert("Por favor, entre com e-mail válido.\n" + document.form1.email.value + " é ínvalido.")
          return false
      }
    }
    //E-mail AOL
    if(document.form1.email.value.length > 0)
    {
		if( document.form1.email.value.indexOf("aol.com.br") != -1)
		{
			alert( 'E-mail AOL inválido.' );
			document.form1.email.focus();
			return false;
		}
    }
    
	//Endereco
	document.form1.endereco.value = Trim(document.form1.endereco.value);
	if (document.form1.endereco.value.length < 3) { 
		alert("Por favor, informe o endereco."); 
		document.form1.endereco.focus(); return false; 
	}
	else
	{
		// Verifica a ocorrência de caracteres especias, substituindo os mesmos por branco!
		var nome  = RetiraAcentos( document.form1.endereco.value );
		var regExp = /^([1-9a-zA-Z0-1@.\s]{1,255})$/;
		
		if( !regExp.test( nome ) )
		{
			alert( "Ocorrência de caractere inválido no campo ENDEREÇO" );
			document.form1.endereco.focus();
			return false; 
		}
	}
	
	//Numero
	document.form1.numero.value = Trim(document.form1.numero.value);
	if (document.form1.numero.value.length < 1) {
		alert("Numero inválido!"); 
		document.form1.numero.focus(); return false; 
	} 
	//Bairro
	document.form1.bairro.value = Trim(document.form1.bairro.value);
	if (document.form1.bairro.value.length < 1) {
		alert("Bairro inválido!"); 
		document.form1.bairro.focus(); return false; 
	}
	else
	{
		// Verifica a ocorrência de caracteres especias, substituindo os mesmos por branco!
		var nome  = RetiraAcentos( document.form1.bairro.value );
		var regExp = /^([1-9a-zA-Z0-1@.\s]{1,255})$/;
		
		if( !regExp.test( nome ) )
		{
			alert( "Ocorrência de caractere inválido no campo BAIRRO" );
			document.form1.bairro.focus();
			return false; 
		}
	}
	 
	//Cidade
	document.form1.cidade.value = Trim(document.form1.cidade.value);
	if (document.form1.cidade.value.length < 3) { 
		alert("Por favor, preencha a cidade."); 
		document.form1.cidade.focus(); return false; 
	}
	else
	{
		// Verifica a ocorrência de caracteres especias, substituindo os mesmos por branco!
		var nome  = RetiraAcentos( document.form1.cidade.value );
		var regExp = /^([1-9a-zA-Z0-1@.\s]{1,255})$/;
		
		if( !regExp.test( nome ) )
		{
			alert( "Ocorrência de caractere inválido no campo CIDADE" );
			document.form1.cidade.focus();
			return false; 
		}
	}
	
	//UF
	/*
	document.form1.uf.value = Trim( document.form1.uf.value );
	if( document.form1.uf.value == '' )
	{
		alert( 'Por favor, preencha o estado!' );
		document.form1.uf.value = '';
		document.form1.uf.focus();
		return false;
	}

	var estados = new String( 'AC-AL-AM-AP-BA-CE-DF-ES-GO-MA-MG-MS-MT-PA-PB-PE-PI-PR-RJ-RN-RO-RR-RS-SC-SE-SP-TO' );
	var user_uf = new String( document.form1.uf.value );
	var test_uf = user_uf.toUpperCase();
		
	if( estados.indexOf( test_uf ) == -1 )
	{
		alert( 'Estado \'' + user_uf.toUpperCase() + '\' não existente!' );
		document.form1.uf.value = '';
		document.form1.uf.focus();
		return false;
	}
	else
	{
		document.form1.uf.value = test_uf;
	}
	*/
	
	if (document.form1.uf.selectedIndex == 0){ 
		alert("Por favor, selecione o estado."); 
		document.form1.uf.focus(); return false; 
	}
	
	//Cep
	if ((document.form1.cep.value.length < 8) || (!EhNumero(document.form1.cep.value)) ) {
		alert("CEP inválido!"); 
		document.form1.cep.focus(); return false; 
	} 
	//Rendimento
	/*
	document.form1.rendimento.value = Trim(document.form1.rendimento.value);
	if (document.form1.rendimento.value.length > 0)
		if(!EhNumero(document.form1.rendimento.value)) {
			alert("Rendimento inválido!"); 
			document.form1.rendimento.focus(); return false;
		} 
	*/	
	
	//DDD
	document.form1.ddd.value = Trim(document.form1.ddd.value);
	if ((document.form1.ddd.value.length < 2) || (!EhNumero(document.form1.ddd.value)) || (document.form1.ddd.value == '00') ) {
		alert("Por favor, Preencha o DDD."); 
		document.form1.ddd.focus(); return false; 
	}
	//Telefone
	document.form1.telefone.value = Trim(document.form1.telefone.value);
	if ((document.form1.telefone.value.length < 7) || (!EhNumero(document.form1.telefone.value)) || (document.form1.telefone.value == '000000') || (document.form1.telefone.value == '0000000') || (document.form1.telefone.value == '00000000') ) {
		alert("Número de telefone para contato inválido!"); 
		document.form1.telefone.focus(); return false; 
	}
	//Ramal
	document.form1.ramal.value = Trim(document.form1.ramal.value);
	if (document.form1.ramal.value.length > 0) 
		if (!EhNumero(document.form1.ramal.value)) {
			alert("Número de ramal inválido!"); 
			document.form1.ramal.focus(); return false;
		}
		
	//DDD2	Telefone2 Ramal2
	document.form1.ddd2.value = Trim(document.form1.ddd2.value);
	document.form1.telefone2.value = Trim(document.form1.telefone2.value);
	document.form1.ramal2.value = Trim(document.form1.ramal2.value);
	
	if ((document.form1.ddd2.value.length > 0) || (document.form1.telefone2.value.length > 0) || (document.form1.ramal2.value.length > 0)) {
		if ((document.form1.ddd2.value.length < 2) || (!EhNumero(document.form1.ddd.value)) || (document.form1.ddd2.value == '00') ) {
		alert("Por favor, Preencha o DDD."); 
		document.form1.ddd2.focus(); return false; 
		}
		if ((document.form1.telefone2.value.length < 5) || (!EhNumero(document.form1.telefone2.value)) || (document.form1.telefone2.value == '000000') || (document.form1.telefone2.value == '0000000') || (document.form1.telefone2.value == '00000000')  ) {
			alert("Número de telefone para contato inválido!"); 
			document.form1.telefone2.focus(); return false; 
		}
		if (document.form1.ramal2.value.length > 0) 
			if (!EhNumero(document.form1.ramal2.value)) {
				alert("Número de ramal inválido!"); 
				document.form1.ramal2.focus(); return false;
		}
	}
	
	
	//Agencia
	document.form1.agencia.value = Trim(document.form1.agencia.value);
	if (!EhNumero(document.form1.agencia.value)) 
		{ 
		alert("O código da agência de preferencia deve ser númerico."); 
		return false; 
		}
	
	if (document.form1.agencia.value.length < 4) 
		{ 
		alert("Por favor, preencha a Agencia de preferencia."); 
		return false; 
		}

	//Candidato indicado
	if ((document.form1.nome_indicado.value.length > 0) || (document.form1.ddd_indicado.value.length > 0) || (document.form1.telefone_indicado.value.length > 0) || (document.form1.ramal_indicado.value.length > 0) || (document.form1.agencia_indicado.value.length > 0)) {
		document.form1.nome_indicado.value = Trim(document.form1.nome_indicado.value);
		if (document.form1.nome_indicado.value.length < 3) { 
			alert("Nome indicado inválido!"); 
			document.form1.nome_indicado.focus(); return false; 
		}
		document.form1.ddd_indicado.value = Trim(document.form1.ddd_indicado.value);
		if ((document.form1.ddd_indicado.value.length < 2) || (!EhNumero(document.form1.ddd_indicado.value)) || (document.form1.ddd_indicado.value == '00') ) {
			alert("Por favor, Preencha o DDD do cliente."); 
			document.form1.ddd_indicado.focus(); return false; 
		}
		document.form1.telefone_indicado.value = Trim(document.form1.telefone_indicado.value);
		if ((document.form1.telefone_indicado.value.length < 5) || (!EhNumero(document.form1.telefone_indicado.value))  || (document.form1.telefone_indicado.value == '000000') || (document.form1.telefone_indicado.value == '0000000') || (document.form1.telefone_indicado.value == '00000000') ) {
			alert("Número de telefone do cliente indicado inválido!"); 
			document.form1.telefone_indicado.focus(); return false; 
		}
		document.form1.ramal_indicado.value = Trim(document.form1.ramal_indicado.value);
		if (document.form1.ramal_indicado.value.length > 0) 
			if (!EhNumero(document.form1.ramal_indicado.value)) {
				alert("Número de ramal do cliente inválido!"); 
				document.form1.ramal_indicado.focus(); return false;
			}
		
	}	 
	//Horario
	//if((document.form1.horario[0].checked == false) && (document.form1.horario[1].checked == false) && (document.form1.horario[2].checked == false)) {
		//alert("Por favor, escolha o horário de contato.");
		//document.form1.horario[0].focus(); return false;
    //}
	document.form1.submit();
	return true;
}

function RetiraAcentos( Campo )
{	
	var Traducao = new String( "AAAAAAAAAEEEEIIOOOOOOUUUUCCABCDEFGHIJKLMNOPQRSTUVXWYZ   AAEEIIOO " );
	Traducao = Traducao.toLowerCase();
	var Acentos = "áàãââÁÀÃÂéêÉÊíÍóõôÓÔÕúüÚÜçÇabcdefghijklmnopqrstuvxwyz'´`äÄëËïÏöÖ&";
	var Posic, Carac;
	var TempLog = "";
	
	for (var i=0; i < Campo.length; i++)
	{
		Carac = Campo.charAt (i);
		Posic  = Acentos.indexOf (Carac);
		if (Posic > -1)
			TempLog += Traducao.charAt (Posic);
		else
			TempLog += Campo.charAt (i);
	}
	
	return (TempLog);
}
// -->
				function troca(str,strsai,strentra){
					while(str.indexOf(strsai)>-1){
						str = str.replace(strsai,strentra);
					}
					return str;
				}
	
				function MarcaPonto(obj, tipo){
					var n;
					var tam;
					var j;
					var passo;
					var n2;
							
					n=obj.value;
					n=n.replace(",","");
							
					for (j=0; j<30; j++)
						n=n.replace(".","");
							
					tam=n.length;
							
					n2=n;
							
					if (tam>=2){
						passo=0;
						n2="";
								
						if (tam>=3 && tipo==2){
							n2="," + n.substring(tam-2,tam);
							n=n.substring(0,tam-2);
						}
								
						for (j=tam; j>0; j--){
							passo++;
							n2 = n.substring(j - 1,j) + n2;
							
							if ((passo==5 && j!=1 && tipo==2) || (passo==3 && j!=1 && tipo==1)){
								n2 = "." + n2;
								if (tipo==1){
									passo=0;
								}
								else{	
									passo=2;
								}
							}
						}
						if(n2.substring(0,1)=='0' && n2.substring(1,2)!=','){
							n2=n2.substring(1,n2.length);
						}
						obj.value=n2;
					}
					else{
						obj.value=n;
					}
				}

function arredonda(valor) // esta função arredonda valor com 2 casa decimais
{
  valor  = valor.toString();                // transforma em strings
  valor =valor.replace(",","");              // transforma em strings  
  nponto = valor.indexOf(".");          // pega a posição do ponto 

  if(nponto == -1)
  {
    nfinal=valor.substring(0,valor.length-2 )+"."+valor.substring(valor.length - 2,valor.length);
  }
  else
  { 
    nfinal = valor.substring(0,nponto+3);  // retorna valor arredondado
  }  
  return nfinal;
}

function formata_rs(valor)  // essa função formata os valores
{
  var indice;var j=0;
  valor = arredonda(valor); // arredonda valor
  nponto = valor.indexOf(".");  // pega a posicao do ponto
  tamanho= valor.length;        // tamanho
  v1 = valor.substring(0,nponto); // separa a strings
  v2 = valor.substring(nponto+1,tamanho); // separa a outra parte
  

  for(indice = v1.length; indice > 0 ; indice-- )
  { // sei la que este for faz 
    if( j== 3 || j== 6 || j== 9 || j== 12 || j==16 || j==19)
    {
          v1=v1.substring(0,indice)+"."+v1.substring(indice,v1.length);
      }
    j++; 
    }
  
  valor = (v1+","+v2);  
  return valor;
}


function FormataValor(campo,tammax,teclapres,caracter,pontuacao){
	//alert("entrei")
	
	if(teclapres == null || teclapres == "undefined"){ 
		var tecla = -1;
	}else{
		var tecla = teclapres.keyCode;
	}
	if(caracter == null || caracter == "undefined" || caracter == '' ){ 
		caracter = ".";
	}
	
	//alert("campo = " + campo.value)
	//alert("tammax = " + tammax)
	//alert("teclapres = " + teclapres.keyCode)
	//alert("caracter = " + caracter.value)
	//alert("caracter = " + caracter.length)
		
	pontuacao_decimal = pontuacao.substr(0, 1)
	pontuacao_outros = pontuacao.substr(1, 1)

	//alert("pontuacao_decimal = " + pontuacao_decimal)
	//alert("pontuacao_outros = " + pontuacao_outros)

	vr = campo.value;
	if(caracter != ""){
		vr = troca(vr,caracter,"");
	}
	vr = troca(vr,"/","" );
	vr = troca(vr,",","" );
	vr = troca(vr,".","" );

	//while(vr.charAt(0)=="0")
	//	{
	//	vr = vr.substring(1,vr.length);
	//	}

	tam = vr.length;
	if(tecla > 0){
		if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
		if (tecla == 8 ){	tam = tam - 1 ; }
	}
	if ( tecla == -1 || tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam > 2 ){
		//decimal = vr.substr( tam - 2, 2 )
		//outros = vr.substr( 0, tam - 2 )
		//alert(decimal)
		//alert(outros)
		}
		if ( tam <= 2 ){ 
			campo.value = vr ; }
		if ( (tam > 2) && (tam <= 5) ){
			//alert(tam)
			//alert(vr.substr( 0, tam - 2 ))
			//alert(vr.substr( tam - 2, tam ))
			//alert(pontuacao_decimal)
			campo.value = vr.substr( 0, tam - 2 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 6) && (tam <= 8) ){
			campo.value = vr.substr( 0, tam - 5 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 9) && (tam <= 11) ){
			campo.value = vr.substr( 0, tam - 8 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 12) && (tam <= 14) ){
			campo.value = vr.substr( 0, tam - 11 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 15) && (tam <= 17) ){
			campo.value = vr.substr( 0, tam - 14 ) + pontuacao_outros + vr.substr( tam - 14, 3 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ;}
	}		
	
}

function f_Retira_Formato_Valor(jstr_NOME_OBJ){
	jflt_VALOR1 = document.getElementById(jstr_NOME_OBJ).value 
	jflt_VALOR1 = jflt_VALOR1.replace(",","|")
	//alert(jflt_VALOR1)
	jflt_VALOR1 = jflt_VALOR1.replace(".","")
	//alert(jflt_VALOR1)
	jflt_VALOR1 = jflt_VALOR1.replace("|",".")
	//alert(jflt_VALOR1)
	return  jflt_VALOR1;
}

function FormataValor_onBlur(campo,tammax,teclapres,caracter,pontuacao)
	{
		
	//alert("entrei")		
	pontuacao_decimal = pontuacao.substr(0, 1)
	pontuacao_outros = pontuacao.substr(1, 1)

	vr = campo.value;

	//alert(vr)

	dec = vr.indexOf(",")
	if(!vr=="")
		{
		if(dec<0)
			{
			vr = vr + ",00"
			}
		}
	//alert(vr.indexOf(","))
	//alert(vr)

	vr = troca(vr,".","");
	vr = troca(vr,",","");
	//alert(vr)		
	tam = vr.length;	
	if(caracter == null || caracter == "undefined" || caracter == '' ){ 
		caracter = ".";
	}
	//alert("pontuacao_decimal BUR = " + pontuacao_decimal)
	//alert("pontuacao_outros BUR = " + pontuacao_outros)	
	//alert(tam)
	if ( tam <= 2 ){ 
		campo.value = vr ; }
	if ( (tam > 2) && (tam <= 5) ){
		campo.value = vr.substr( 0, tam - 2 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
	if ( (tam >= 6) && (tam <= 8) ){
		campo.value = vr.substr( 0, tam - 5 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
	if ( (tam >= 9) && (tam <= 11) ){
		//alert(vr.substr( 0, tam - 8 ))
		//alert(vr.substr( tam - 8, 3 ))
		//alert(vr.substr( tam - 5, 3 ))
		//alert(vr.substr( tam - 2, tam ))
		//alert(pontuacao_outros)
		//alert(pontuacao_decimal)
		campo.value = vr.substr( 0, tam - 8 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		//alert(campo.value)
	if ( (tam >= 12) && (tam <= 14) ){
		campo.value = vr.substr( 0, tam - 11 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
	if ( (tam >= 15) && (tam <= 17) ){
		campo.value = vr.substr( 0, tam - 14 ) + pontuacao_outros + vr.substr( tam - 14, 3 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ;}	
	//alert('campo = ' + campo.value)
	}
	
	
function FormataValor_Original(campo,tammax,teclapres,caracter){
	alert("entrei")
	if(teclapres == null || teclapres == "undefined"){ 
		var tecla = -1;
	}else{
		var tecla = teclapres.keyCode;
	}
	if(caracter == null || caracter == "undefined"){ 
		caracter = ".";
	}

	vr = campo.value;
	if(caracter != ""){
		vr = troca(vr,caracter,"");
	}
	vr = troca(vr,"/","" );
	vr = troca(vr,",","" );
	vr = troca(vr,".","" );

	//while(vr.charAt(0)=="0")
	//	{
	//	vr = vr.substring(1,vr.length);
	//	}

	tam = vr.length;
	if(tecla > 0){
		if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
		if (tecla == 8 ){	tam = tam - 1 ; }
	}
	if ( tecla == -1 || tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){ 
			campo.value = vr ; }
		if ( (tam > 2) && (tam <= 5) ){
			campo.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 6) && (tam <= 8) ){
			campo.value = vr.substr( 0, tam - 5 ) + caracter + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 9) && (tam <= 11) ){
			campo.value = vr.substr( 0, tam - 8 ) + caracter + vr.substr( tam - 8, 3 ) + caracter + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 12) && (tam <= 14) ){
			campo.value = vr.substr( 0, tam - 11 ) + caracter + vr.substr( tam - 11, 3 ) + caracter + vr.substr( tam - 8, 3 ) + caracter + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 15) && (tam <= 17) ){
			campo.value = vr.substr( 0, tam - 14 ) + caracter + vr.substr( tam - 14, 3 ) + caracter + vr.substr( tam - 11, 3 ) + caracter + vr.substr( tam - 8, 3 ) + caracter + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
	}		
	
}

function FormataQtdDecimal(campo,tammax,teclapres,caracter,pontuacao){
	//alert("entrei")
	
	if(teclapres == null || teclapres == "undefined"){ 
		var tecla = -1;
	}else{
		var tecla = teclapres.keyCode;
	}
	if(caracter == null || caracter == "undefined" || caracter == '' ){ 
		caracter = "";
	}
	
	//alert("campo = " + campo.value)
	//alert("tammax = " + tammax)
	//alert("teclapres = " + teclapres.keyCode)
	//alert("caracter = " + caracter.value)
	//alert("caracter = " + caracter.length)
		
	pontuacao_decimal = pontuacao.substr(0, 1)
	pontuacao_outros = pontuacao.substr(1, 1)

	//alert("pontuacao_decimal = " + pontuacao_decimal)
	//alert("pontuacao_outros = " + pontuacao_outros)

	vr = campo.value;
	if(caracter != ""){
		vr = troca(vr,caracter,"");
	}
	vr = troca(vr,"/","" );
	vr = troca(vr,",","" );
	vr = troca(vr,".","" );

	//while(vr.charAt(0)=="0")
	//	{
	//	vr = vr.substring(1,vr.length);
	//	}

	tam = vr.length;
	if(tecla > 0){
		if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
		if (tecla == 8 ){	tam = tam - 1 ; }
	}
	if ( tecla == -1 || tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam > 2 ){
		//decimal = vr.substr( tam - 2, 2 )
		//outros = vr.substr( 0, tam - 2 )
		//alert(decimal)
		//alert(outros)
		}
		if ( tam <= 2 ){ 
			campo.value = vr ; }
		if ( (tam > 2) && (tam <= 5) ){
			//alert(tam)
			//alert(vr.substr( 0, tam - 2 ))
			//alert(vr.substr( tam - 2, tam ))
			//alert(pontuacao_decimal)
			campo.value = vr.substr( 0, tam - 2 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 6) && (tam <= 8) ){
			campo.value = vr.substr( 0, tam - 5 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 9) && (tam <= 11) ){
			campo.value = vr.substr( 0, tam - 8 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 12) && (tam <= 14) ){
			campo.value = vr.substr( 0, tam - 11 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		if ( (tam >= 15) && (tam <= 17) ){
			campo.value = vr.substr( 0, tam - 14 ) + pontuacao_outros + vr.substr( tam - 14, 3 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ;}
	}		
	
}

function FormataQtdDecimal_onBlur(campo,tammax,teclapres,caracter,pontuacao)
	{
		
	//alert("entrei")		
	pontuacao_decimal = pontuacao.substr(0, 1)
	pontuacao_outros = pontuacao.substr(1, 1)

	vr = campo.value;
	
	//vr = '1.5'
	
	//alert('vr1 = ' + vr)
	vr = troca(vr,",","." )
	dec = vr.indexOf(".")
	if(!vr=="")
		{
		if(dec<0)
			{
			vr = vr + ".00"
			}
		}
	else	
		{
		return true;	
		}
		
	//alert(dec)	
	//alert(vr.substr(dec+1,1))
	
	//alert(vr.indexOf(","))
	//alert('vr2 = ' + vr)
	dec = vr.indexOf(".")
	
	vr = vr + '00'
	
	//alert('vr3 = ' + vr)
	//alert('dec = ' + dec)

	vr_Outros = vr.substr( 0, dec)
	vr_Decimal = vr.substr( dec+1, 2)
	//alert('vr_Outros = ' + vr_Outros)
	//alert('vr_Decimal = ' + vr_Decimal)

	vr = vr_Outros + pontuacao_decimal +  vr_Decimal
	//alert('vr2 = ' + vr)

	vr = troca(vr,".","");
	vr = troca(vr,",","");
	//alert('vr4 = ' + vr)		
	tam = vr.length;
	//alert('tam = ' + tam)
	if(caracter == null || caracter == "undefined" || caracter == '' ){ 
		caracter = "";
	}
	//alert("pontuacao_decimal BUR = " + pontuacao_decimal)
	//alert("pontuacao_outros BUR = " + pontuacao_outros)	
	//alert(tam)
	if ( tam <= 2 ){ 
		campo.value = vr ; }
	if ( (tam > 2) && (tam <= 5) ){
		campo.value = vr.substr( 0, tam - 2 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
	if ( (tam >= 6) && (tam <= 8) ){
		campo.value = vr.substr( 0, tam - 5 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
	if ( (tam >= 9) && (tam <= 11) ){
		//alert(vr.substr( 0, tam - 8 ))
		//alert(vr.substr( tam - 8, 3 ))
		//alert(vr.substr( tam - 5, 3 ))
		//alert(vr.substr( tam - 2, tam ))
		//alert(pontuacao_outros)
		//alert(pontuacao_decimal)
		campo.value = vr.substr( 0, tam - 8 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
		//alert(campo.value)
	if ( (tam >= 12) && (tam <= 14) ){
		campo.value = vr.substr( 0, tam - 11 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ; }
	if ( (tam >= 15) && (tam <= 17) ){
		campo.value = vr.substr( 0, tam - 14 ) + pontuacao_outros + vr.substr( tam - 14, 3 ) + pontuacao_outros + vr.substr( tam - 11, 3 ) + pontuacao_outros + vr.substr( tam - 8, 3 ) + pontuacao_outros + vr.substr( tam - 5, 3 ) + pontuacao_decimal + vr.substr( tam - 2, tam ) ;}	
	//alert('campo = ' + campo.value)
	}

function soNumero2(){
	if (!(event.keyCode>47 && event.keyCode<58)){
		event.keyCode=0;
	}
}	
//-->

function soNumero(e)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
	//alert(tecla)
	//if( (tecla > 47 && tecla < 58) || (tecla > 95 && tecla < 106) )	
	if( (tecla > 47 && tecla < 58) )	
		return true;
	else
		{
		if (tecla != 8) // backspace
			{
			//alert("Este campo somente aceita números");
			event.keyCode = 0;
			//return false;
			}
		else
			return true;
		//alert("Este campo somente aceita números");				
		}
}

function soNumeroDecimal(e)
	{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
	//alert(tecla)
	//if( (tecla > 47 && tecla < 58) || (tecla > 95 && tecla < 106) )	
	if( (tecla > 47 && tecla < 58) )
		return true;
	else
		{
		if ((tecla == 8)||(tecla == 46)) // backspace
			{
			//alert("Este campo somente aceita números");
			return true;
			}
		if (tecla == 44) // virgula
			{
			event.keyCode = 46;
			return true;
			}
	event.keyCode = 0;
	alert("Este campo somente aceita números");				
		}
	}

function soLetra(e)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
	//alert(tecla)
	if ((tecla > 64 && tecla < 91) || (tecla > 96 && tecla < 123)) // letras de A a Z
		return true;
	else
		{
		if (tecla != 8) // backspace
			{
			event.keyCode = 0;
			//return false;
			}
		else
			return true;
		alert("Este campo somente aceita letras");				
		}
}

function TudoMaiuscula(campo)
{
	campo.value = campo.value.toUpperCase()
}


//--Fim Função Itau

function CheckCheckAll()
	{
		TotalOn = 0;
		TotalBoxes = 0;
			
		for (var i=0;i<document.frm1.elements.length;i++)
		{
			var e = document.frm1.elements[i];
//			if ((e.name != 'chk_ListaSolicitacao') && (e.type=='checkbox'))
			if (e.type=='checkbox')

			{
				TotalBoxes++; 
				Check(e);
			}
				
			if (e.checked)
			{
				TotalOn++;
			}
		}
			
	}

function ClearCheckCheckAll()
	{
		TotalOn = 0;
		TotalBoxes = 0;
			
		for (var i=0;i<document.frm1.elements.length;i++)
		{
			var e = document.frm1.elements[i];
//			if ((e.name != 'chk_ListaSolicitacao') && (e.type=='checkbox'))
			if (e.type=='checkbox')

			{
				TotalBoxes++; 
				Clear(e);
			}
				
			if (e.checked)
			{
				TotalOn++;
			}
		}
			
	}


auxd = null;
function AbreEntrDados(url, prop, fdata, fdata2)
{	auxd = fdata;
	auxd2 = fdata2;
	var strSql = "";
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}	
	janela = window.open(url,janela,prop);
	
}
function setvalue(vcampo)
{	
	auxd.value = vcampo;
	if (auxd2 != null)
	{
		auxd2.value = vcampo;
		auxd2.focus();
	}
	else
		auxd.focus();
}
// Função para consulta de dados para Tipo Lockup
function consulta_com_ano(strAssunto,strCaminho,strNomeCampoCd,strNomeCampoAno,strFiltro,strMsg)
	{
	var strUrl;
	var strParametro;
	var intLargura;
	var intAltura;
	
	if (janela != null)
		{					
		janela.close();					
		janela = null;					
		}	
	if (strAssunto == "DOCEMITIDO")
		{
		//alert("doc emitido")
		intAltura = 400
		intLargura = 700			
		strParametro = '?pOpc1=1'+'&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoAno='+strNomeCampoAno		
		//strUrl = strCaminho + '../aspscript/mostra_processo_doc_emitido.asp'
		strUrl = strCaminho + 'lockup_doc_emitido.asp'
		}
	if (strAssunto == 'DOCRECEBIDO')
		{
		intAltura = 400
		intLargura = 700
		//strUrl = strCaminho + 'aspscript/mostra_processo_doc_recebido.asp'
		strParametro = '?pOpc1=1&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoAno='+strNomeCampoAno							
		strUrl = strCaminho + 'lockup_doc_recebido.asp'
		}
	if (strAssunto == 'PROCESSO')
		{
		intAltura = 400
		intLargura = 680
		strParametro = '?pOpc1=1&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoAno='+strNomeCampoAno
		//strUrl =  '../../aspscript/relat_processo_padrao.asp'
		strUrl = strCaminho + 'lockup_processo.asp'

		}
	if (strAssunto == 4)
		{
		if (document.frm1.hdnCdCliente.value != '')
			{
			//alert("doc emitido")
			intAltura = 400
			intLargura = 680			
			strUrl = strCaminho + 'aspscript/mostra_processo_doc_emitido.asp'
			strParametro = '?pOpc1=1&selCliente='+document.frm1.hdnCdCliente.value+'&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoAno='+strNomeCampoAno			
			}
		else
			{
			alert("É obrigatória a seleção de um Cliente antes da seleção.");
			return;
			}	
		}
	alert(strUrl)
	alert(strFiltro)
	alert(strParametro)
	janela = window.open(strUrl+strParametro+strFiltro,'','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+intLargura+',height='+intAltura+',top=50,left=50'); 			
	}


// Função Lockup
//var janela;	
//var intCtrSubmit = 0
//alert(intCtrSubmit)
function abrir(strTipo,strNomeCampoCd,strNomeCampoDs,strNomeCampo3,intLarguraTela,strIndicaCampo,strSqlCompl,strCaminho,strPosicaoX,strPosicaoY)
/* strTipo
,strNomeCampoCd
,strNomeCampoDs
,strNomeCampo3
,intLarguraTela
,strIndicaCampo
,strSqlCompl
,strCaminho
,strPosicaoX
,strPosicaoY
*/
	{		
	//alert("entrei")
	//alert("strSqlCompl=" + strSqlCompl)		
	var strSql = "";
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}
	//alert(strTipo)	
	if (strTipo != '')	
		{
		//alert('opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSql+'&pIndicaCampo='+strIndicaCampo)
		//alert('opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo)
		//alert('toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150')
		//alert(strCaminho+'../lockup/opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo,'','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=310,height=300,top=150,left=150')
		janela = window.open(strCaminho+'../lockup/opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo+'&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoDs='+strNomeCampoDs+'&pNomeCampo3='+strNomeCampo3,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=310,height=300,top='+strPosicaoX+',left='+strPosicaoY); 			
		//janela = window.open(strCaminho+'../lockup/opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo+'&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoDs='+strNomeCampoDs+'&pNomeCampo3='+strNomeCampo3,'','width=310,height=300,top='+strPosicaoX+',left='+strPosicaoY); 			

//parent.location = strCaminho+'../lockup/opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo+'&pNomeCampoCd='+strNomeCampoCd+'&pNomeCampoDs='+strNomeCampoDs+'&pNomeCampo3='+strNomeCampo3

		}
	}

function MudaCampo(Tamanho,CampoAtual,CampoFoco)
{
Tecla = event.which;
if (Tecla == null)
     Tecla = event.keyCode;
if(document.frm1[CampoAtual].value.length == Tamanho && Tecla != 9 && Tecla != 16)
 {
   document.frm1[CampoFoco].focus();
   //document.frm1[CampoFoco].select();
 }
}

function MudaCampo2(Tamanho,CampoAtual,CampoFoco)
{
Tecla = event.which;
if (Tecla == null)
     Tecla = event.keyCode;
if(document.cadastro_membro[CampoAtual].value.length == Tamanho && Tecla != 9 && Tecla != 16)
 {
   document.cadastro_membro[CampoFoco].focus();
   document.cadastro_membro[CampoFoco].select();
 }
}
function carrega_txt(fbox,hdn) 
	{
	document.frm1.hdnCdMegaSelecionado.value = "";
	for(var i=0; i<fbox.options.length; i++) 
		{
		document.frm1.hdn.value = document.frm1.hdn.value + "," + fbox.options[i].value;
		}	
	}

function isNum(caractere)
	{
	var strValidos = "0123456789."
	if ( strValidos.indexOf( caractere ) == -1 )
		return false;
	return true;
	}

function fSoNumero(campo,tamcampo) 
	{
	//alert(campo.value)
	//alert(tamcampo)
	var valcampo = campo.value
	var posicaoChar
	ok = 1
	for(i=0; i<tamcampo; ++i) 
		{
		digito=(valcampo.substr(i,1));
		caracter=digito.charCodeAt(0);
		if ((caracter<48||caracter>57)) 
			{
			ok = 0;
			posicaoChar = i
			
			}
		}   
	if (ok == 0) 
		{
		alert("O preenchimento do campo é obrigatório com número !");		
		campo.value = valcampo.substr(0,posicaoChar)
		campo.focus();
		return false;
  		}
	return true;		
	}

function mostra_ajuda(p_id_pagina,p_id_campo,p_obri,p_tx_obrig,p_caminho)
	{
	if (janela != null)
		{					
		janela.close();					
		janela = null;					
		}				
	//alert(p_id_campo)	
	//alert("../msg/mostra_ajuda.asp?ppagina=" + ppagina + "&pcampo=" + pcampo + "&ppreencher=" + ppreencher +"")		
	//janela = window.open(pcaminho + "msg/mostra_ajuda.asp?ppagina=" + ppagina + "&pcampo=" + pcampo + "&ppreencher=" + ppreencher +"","_blank","width=550,height=300,history=0,scrollbars=1,titlebar=0,resizable=0,top=150,left=300")
	//alert(p_caminho + "ajuda/mostra_ajuda_tela.asp?p_id_pagina=" + p_id_pagina + "&p_id_campo=" + p_id_campo + "&p_obri=" + p_obri + "&p_tx_obrig=" + p_tx_obrig  +"")
	if(p_id_campo=="")
		{
		janela = window.open(p_caminho + "ajuda/mostra_ajuda_tela.asp?p_id_pagina=" + p_id_pagina + "&p_id_campo=" + p_id_campo + "&p_obri=" + p_obri + "&p_tx_obrig=" + p_tx_obrig  +"","_blank","width=550,height=300,history=0,scrollbars=yes,titlebar=0,resizable=0,top=150,left=300")
		}
	else
		{
		janela = window.open(p_caminho + "ajuda/mostra_ajuda_campo.asp?p_id_pagina=" + p_id_pagina + "&p_id_campo=" + p_id_campo + "&p_obri=" + p_obri + "&p_tx_obrig=" + p_tx_obrig  +"","_blank","width=550,height=300,history=0,scrollbars=yes,titlebar=0,resizable=0,top=150,left=300")
		}
//janela = window.open("msg/mostra_ajuda.asp?ppagina=" + "&pcampo=" + pcampo + "&ppreencher=" + ppreencher +"","_blank","width=600,height=300,history=0,scrollbars=1,titlebar=0,resizable=0,top=150,left=300")

	}
function ver_tecla()
	{
	var a = window.event.keyCode;
	if(a==13)
		{
		login();
		}
	}
function mOvr2(src,clrOver) 
{
	if (!src.contains(event.fromElement)) {
		src.style.cursor = 'hand';
		src.bgColor = clrOver;
	}
}
function mOvrImg211111(src)
	{
	src.style.cursor = 'hand';
	}

//=====================================================================

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;
	}
}
function mClk(src) {
	if(event.srcElement.tagName=='TD'){
		src.children.tags('A')[0].click();
	}
}

var blnData;
function validaData(strData, strCampo, strNomeCampo)
{		
	var strDTPadrao = new String;				
	var strDTInicio = new String;
	var strDTFinal  = new String;
	var strDataSel = strData;								
	var strDia;
	var strMes;
	var strAno;		
	var strDiaIni;
	var strMesIni;
	var strAnoIni;		
	var strDiaFim;
	var strMesFim;
	var strAnoFim;		
	blnData = false;								
			
	strDTPadrao = strData.split('/')				
	strDia = strDTPadrao[0] 
	strMes = strDTPadrao[1]
	strAno = strDTPadrao[2]
	
	strDTInicio = document.forms[0].pDtInicioAtiv.value;		
	strDTInicio = strDTInicio.split('/')				
	strDiaIni = strDTInicio[0] 
	strMesIni = strDTInicio[1]
	strAnoIni = strDTInicio[2]
	
	strDTFinal = document.forms[0].pDtFimAtiv.value;
	strDTFinal = strDTFinal.split('/')				
	strDiaFim = strDTFinal[0] 
	strMesFim = strDTFinal[1]
	strAnoFim = strDTFinal[2]
				
	if ((strCampo == 'txtDtLimiteAprov') || (strCampo == 'txtDTAprovacao_PAC'))
	{
		if ((strAno > strAnoIni)) 
		{
			alert('A data ' + strDataSel + ' preenchida no campo "' + strNomeCampo + '", deve ser menor do que a Data de Início do Cronograma!');
			blnData = true; 
			return(blnData);
		}
		else 
		{
			if ((strMes > strMesIni) && (strAno >= strAnoIni))
			{
				alert('A data ' + strDataSel + ' preenchida no campo "' + strNomeCampo + '", deve ser menor do que a Data de Início do Cronograma!');
				blnData = true; 
				return(blnData);
			}
			else 
			{
				if ((strDia >= strDiaIni) && (strMes >= strMesIni) && (strAno >= strAnoIni))
				{
					alert('A data ' + strDataSel + ' preenchida no campo "' + strNomeCampo + '", deve ser menor do que a Data de Início do Cronograma!');
					blnData = true; 
					return(blnData);
				}
			}
		}
	}
	else
	{
		if ((strAno < strAnoIni)||(strAno > strAnoFim)) 
		{
			alert('A data ' + strDataSel + ' preenchida no campo "' + strNomeCampo + '", deve estar dentro do intervalo Data Inicio/Data de Término!');
			blnData = true; 
			return(blnData);
		}
		else 
		{
			if (((strMes < strMesIni) && (strAno <= strAnoIni))||((strMes > strMesFim) && (strAno >= strAnoFim)))
			{
				alert('A data ' + strDataSel + ' preenchida no campo "' + strNomeCampo + '", deve estar dentro do intervalo Data Inicio/Data de Término!');
				blnData = true; 
				return(blnData);
			}
			else 
			{
				if (((strDia < strDiaIni) && (strMes <= strMesIni) && (strAno <= strAnoIni))||((strDia > strDiaFim) && (strMes >= strMesFim) && (strAno >= strAnoFim))) 
				{
					alert('A data ' + strDataSel + ' preenchida no campo "' + strNomeCampo + '", deve estar dentro do intervalo Data Inicio/Data de Término!');
					blnData = true; 
					return(blnData);
				}
			}
		}
	}
}	
//===============

function f_ValidaData(Vdata,hoje,tipo,mensagem)
{ 
	//ValidaData(Vdata, hoje, "MAIOR_IGUAL") 
	//ValidaData(Vdata, hoje, "") 

  valido=1
  for(var i=0; i<=(eval(Vdata.value.length)-1)&&Vdata.value.charAt(i)==' '; i++);
  if(Nro(Vdata.value.charAt(i))) sdia=Vdata.value.charAt(i++); else valido=0
  if(Nro(Vdata.value.charAt(i))) sdia=sdia+Vdata.value.charAt(i++); else valido=-1
  if(Vdata.value.charAt(i)!="/") valido=-2; else i++
  if(Nro(Vdata.value.charAt(i))) smes=Vdata.value.charAt(i++); else valido=-3
  if(Nro(Vdata.value.charAt(i))) smes=smes+Vdata.value.charAt(i++); else valido=-4
  if(Vdata.value.charAt(i)!="/") valido=-5; else i++
  if(Vdata.value.length==10) if(Vdata.value.charAt(i)==1)
   { i=i+2; if(Nro(Vdata.value.charAt(i))) sano=Vdata.value.charAt(i++); else valido=-12 }
     else { if(Nro(Vdata.value.charAt(i))) sano=Vdata.value.charAt(i++); else valido=-6
     if(Nro(Vdata.value.charAt(i))) sano=sano+Vdata.value.charAt(i++); else valido=-7
     if(Nro(Vdata.value.charAt(i))) sano=sano+Vdata.value.charAt(i++); else valido=-11 }
  else valido=-13
  if(Nro(Vdata.value.charAt(i))) sano=sano+Vdata.value.charAt(i++); else valido=-14
  if(valido==1){ dateObj=new Date(sano,smes-1,sdia); mes=dateObj.getMonth()+1
    ano=dateObj.getYear(); if(mes!=smes||ano!=sano){ano=ano+1900;if(mes!=smes||ano!=sano)valido=-8}
  if(valido==1){ hdia=hoje.value.charAt(0)+hoje.value.charAt(1)
      hmes=hoje.value.charAt(3)+hoje.value.charAt(4)
      hano=hoje.value.charAt(6)+hoje.value.charAt(7)+hoje.value.charAt(8)+hoje.value.charAt(9)
      if((Vdata.value.length==8)||(Vdata.value.charAt(6)==1)) sano=hoje.value.charAt(6)+hoje.value.charAt(7)+sano
      if(tipo=="MAIOR"){ if(comp(sdia,smes,sano,hdia,hmes,hano)!=1) valido=-9}
      else if(tipo=="MAIOR_IGUAL"){ if(comp(sdia,smes,sano,hdia,hmes,hano)==-1) valido=-9}
      else if(tipo=="IGUAL"){ if(comp(sdia,smes,sano,hdia,hmes,hano)!=0) valido=-9}
      else if(tipo=="MENOR_IGUAL"){ if(comp(sdia,smes,sano,hdia,hmes,hano)==1) valido=-9}
      else if(tipo=="MENOR"){ if(comp(sdia,smes,sano,hdia,hmes,hano)!=-1) valido=-9}
  } }
  if (mensagem!=false){
  if(valido<0){ alert("Data incorreta, por favor digite-a novamente. Código do erro: 2503"); Vdata.value=hoje.value }
  else Vdata.value=sdia+"/"+smes+"/"+sano}
  else return valido;
  }
//--><!--

function detalhe(idProduto)
{
var url2 = "opener.asp?pIndice=1"
alert("aaa")
window.open(""+url2,"popup","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=400")
}

function wOpen(pURL, pName, w, h, scroll, text, specialSettings)
	{
 	xLeft=(screen.width)?(screen.width-w)/2:0;
 	xTop=(screen.height)?(screen.height-h)/2:0;
 	xSettings = 'height='+h+',width='+w+',top='+xTop+',left='+xLeft+',scrollbars='+scroll+specialSettings
 	hwnd = window.open(pURL,pName,xSettings);
 	if(hwnd.window.focus){hwnd.window.focus();}
 	if(text != "") hwnd.document.write(text);
 	hwnd.document.close();
 	return hwnd;
}

var zoomHwnd;
function zoomImg(){
	if (zoomHwnd){
		zoomHwnd.close();
	}
	if(bigImages[imgNow].complete){
		zoomHwnd = wOpen("", "", bigImages[imgNow].width+20, bigImages[imgNow].height+5, "yes", 
			"<html><head><title>Linda XLX 350 R com pintura personalizada branca e vermelho</title></head><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginheight=0 marginwidth=0><table cellpadding=0 cellspacing=0 border=0 width=100% height=100%><tr align=center valign=middle><td><img src="+bigImages[imgNow].src+"></td></tr></table></body></html>");
	}else{
		zoomHwnd = wOpen("", "", 530, 530, "yes", 
			"<html><head><title>Linda XLX 350 R com pintura personalizada branca e vermelho</title></head><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginheight=0 marginwidth=0><table cellpadding=0 cellspacing=0 border=0 width=100% height=100%><tr align=center valign=middle><td><img src="+bigImgPath[imgNow]+"></td></tr></table></body></html>");
	}
}

			
var janela;	
var intCtrSubmit = 0
//alert(intCtrSubmit)
function abrir3(strTipo,intLarguraTela,strIndicaCampo,strSqlCompl)
	{		
	//alert("entrei")
	//alert("strSqlCompl=" + strSqlCompl)		
	var strSql = "";
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}
	//alert(strTipo)	
	if (strTipo != '')	
		{
		//alert('opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSql+'&pIndicaCampo='+strIndicaCampo)
		//alert('opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo)
		//alert('toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150')
		janela = window.open('../lockup/opener.asp?pIndice='+strTipo+'&pSqlCompl='+strSqlCompl+'&pIndicaCampo='+strIndicaCampo,'','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
		}
	}

function abrir2(strTipo,intTamanhoTela,strIndicaCampo,strSqlCompl)
	{				
	var strSql;	
	if (janela != null)
		{					
		janela.close();					
		janela = null;					
		}
	//alert(strTipo)	
	if (strTipo == 1)	
		{
		//alert(intTamanhoTela)
		//alert('toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=200px,height=280,top=150,left=150')
		//alert('opener.asp?pTitulo=<%=strTitulo_1%>&pCampoTable=<%=strCampoTable_1%>&pIndice=1','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=550px,height=280,top=150,left=150')
		//janela = window.open('opener.asp?pTitulo=<%=strTitulo_1%>&pCampoTable=<%=strCampoTable_1%>&pIndice=1','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=550px,height=280,top=150,left=150'); 			
		if(document.frm1.pAcao.value == "A")
			{
			strSql = " and TISE_TX_SUPER_TIPO ='"+document.frm1.hdnCdTpSuperSegmento.value+"'"
			}		
		else
			{
			strSql = ""
			}	
		//alert(strSql)
		janela = window.open("opener.asp?pIndice=1&pSqlCompl="+strSql,'','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
		//var url2 = "opener.asp?pIndice=1"
		//janela = window.open(""+url2,"popup","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=400")		
		}
	if (strTipo == 2)	
		{
		janela = window.open('opener.asp?pIndice=2','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
		}				
	if (strTipo == 3)	
		{
		janela = window.open('opener.asp?pIndice=3','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
		}				
	if (strTipo == 4)	
		{
		janela = window.open('opener.asp?pIndice=4','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
		}				
	}

//======================================

    function ShowContextHelp(num, width, height)
    {
        var url = 'http://help.yahoo.com/help/us/mail/context/context-';
        url = url + num + '.html';

        document.domain="yahoo.com";

        remote = window.open(url, 'help'+num, "width="+width+",height="+height +",resizable=yes,scrollbars=no,status=0");
                        
        if (remote != null)
        {
          if (remote.opener == null)
          remote.opener = self;
        }
    }

    function ShowRDContextHelp(rdurl, num, width, height)
    {
        var helpurl = 'http://help.yahoo.com/help/us/mail/context/context-' + num + '.html';

        var url = rdurl + helpurl;
        

        document.domain="yahoo.com";

        remote = window.open(url, 'help'+num, "width="+width+",height="+height +",resizable=yes,scrollbars=no,status=0");
                        
        if (remote != null)
        {
          if (remote.opener == null)
          remote.opener = self;
        }
    }

    function Toggle(e)
    {
	if (e.checked) {
	    Highlight(e);
	    document.messageList.toggleAll.checked = AllChecked();
	}
	else {
	    Unhighlight(e);
	    document.messageList.toggleAll.checked = false;
	}
    }

    function ToggleAll(e)
    {
	if (e.checked) {
	    CheckAll();
	}
	else {
	    ClearAll();
	}
    }

    function Check(e)
    {
	e.checked = true;
	Highlight(e);
    }

    function Clear(e)
    {
	e.checked = false;
	Unhighlight(e);
    }

    function CheckAll()
    {
	var ml = document.messageList;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "Mid") {
		Check(e);
	    }
	}
	ml.toggleAll.checked = true;
    }

    function ClearAll()
    {
	var ml = document.messageList;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "Mid") {
		Clear(e);
	    }
	}
	ml.toggleAll.checked = false;
    }

    function Highlight(e)
    {
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
	    r = e.parentElement.parentElement;
	}
	if (r) {
	    if (r.className == "msgnew") {
		r.className = "msgnews";
	    }
	    else if (r.className == "msgold") {
		r.className = "msgolds";
	    }
	}
    }

    function Unhighlight(e)
    {
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
	    r = e.parentElement.parentElement;
	}
	if (r) {
	    if (r.className == "msgnews") {
		r.className = "msgnew";
	    }
	    else if (r.className == "msgolds") {
		r.className = "msgold";
	    }
	}
    }

    function AllChecked()
    {
	ml = document.messageList;
	len = ml.elements.length;
	for(var i = 0 ; i < len ; i++) {
	    if (ml.elements[i].name == "Mid" && !ml.elements[i].checked) {
		return false;
	    }
	}
	return true;
    }

    var noDelAllMsgWarning = false;
    function Delete()
    {
	if (!noDelAllMsgWarning && AllChecked()) {
	    if (!confirm("Tem certeza de que deseja apagar todas as mensagens?")) {
		return;
	    }
	}
	var ml=document.messageList;
	ml.DEL.value = "1"; 
	ml.submit();
    }
    function SynchMoves(which) {
	var ml=document.messageList;
	if(which==1) {
	    ml.destBox2.selectedIndex=ml.destBox.selectedIndex;
	}
	else {
	    ml.destBox.selectedIndex=ml.destBox2.selectedIndex;
	}
    }

    function Move() {
	var ml = document.messageList;
	var dbox = ml.destBox;
	if(dbox.options[dbox.selectedIndex].value == "@NEW") {
	    nn = window.prompt("Insira um nome para sua pasta.","");
	    if(nn == null || nn == "null" || nn == "") {
		dbox.selectedIndex = 0;
		ml.destBox2.selectedIndex = 0;
	    }
	    else {
		ml.NewFol.value = nn;
		ml.MOV.value = "1";
		ml.submit();
	    }
	}
	else {
	    ml.MOV.value = "1";
	    ml.submit();
	}
    }
    function SynchFlags(which)
    {
	var ml=document.messageList;
	if (which == 1) {
	    ml.flags2.selectedIndex = ml.flags.selectedIndex;
	}
	else {
	    ml.flags.selectedIndex = ml.flags2.selectedIndex;
	}
    }

    function SetFlags()
    {
	var ml = document.messageList;
	ml.FLG.value = "1";
	ml.submit();
    }


   function markSpam() {
        var ml = document.messageList;
        ml.FLG.value = "1";
        ml.action += "&flags=spam";
        ml.submit();
   }

   function markAdd() {
        var ml = document.messageList;
        ml.FLG.value = "1";
        ml.action += "&flags=add";
        ml.submit();
   }

//===================================================

function CheckCheckAll()
	{
		TotalOn = 0;
		TotalBoxes = 0;
			
		for (var i=0;i<document.frm1.elements.length;i++)
		{
			var e = document.frm1.elements[i];
//			if ((e.name != 'chk_ListaSolicitacao') && (e.type=='checkbox'))
			if (e.type=='checkbox')

			{
				TotalBoxes++; 
				Check(e);
			}
				
			if (e.checked)
			{
				TotalOn++;
			}
		}
			
	}

function ClearCheckCheckAll()
	{
		TotalOn = 0;
		TotalBoxes = 0;
			
		for (var i=0;i<document.frm1.elements.length;i++)
		{
			var e = document.frm1.elements[i];
//			if ((e.name != 'chk_ListaSolicitacao') && (e.type=='checkbox'))
			if (e.type=='checkbox')

			{
				TotalBoxes++; 
				Clear(e);
			}
				
			if (e.checked)
			{
				TotalOn++;
			}
		}
			
	}
    
    function ShowContextHelp(num, width, height)
    {
        var url = 'http://help.yahoo.com/help/us/mail/context/context-';
        url = url + num + '.html';

        document.domain="yahoo.com";

        remote = window.open(url, 'help'+num, "width="+width+",height="+height +",resizable=yes,scrollbars=no,status=0");
                        
        if (remote != null)
        {
          if (remote.opener == null)
          remote.opener = self;
        }
    }

    function ShowRDContextHelp(rdurl, num, width, height)
    {
        var helpurl = 'http://help.yahoo.com/help/us/mail/context/context-' + num + '.html';

        var url = rdurl + helpurl;
        

        document.domain="yahoo.com";

        remote = window.open(url, 'help'+num, "width="+width+",height="+height +",resizable=yes,scrollbars=no,status=0");
                        
        if (remote != null)
        {
          if (remote.opener == null)
          remote.opener = self;
        }
    }

    function Toggle(e)
    {
	if (e.checked) {
	    Highlight(e);
	    document.messageList.toggleAll.checked = AllChecked();
	}
	else {
	    Unhighlight(e);
	    document.messageList.toggleAll.checked = false;
	}
    }

    function ToggleAll(e)
    {
	if (e.checked) {
	    CheckAll();
	}
	else {
	    ClearAll();
	}
    }

    function Check(e)
    {
	e.checked = true;
	Highlight(e);
    }

    function Clear(e)
    {
	e.checked = false;
	Unhighlight(e);
    }

    function CheckAll()
    {
	var ml = document.messageList;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "Mid") {
		Check(e);
	    }
	}
	ml.toggleAll.checked = true;
    }

    function ClearAll()
    {
	var ml = document.messageList;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "Mid") {
		Clear(e);
	    }
	}
	ml.toggleAll.checked = false;
    }

    function Highlight(e)
    {
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
	    r = e.parentElement.parentElement;
	}
	if (r) {
	    if (r.className == "msgnew") {
		r.className = "msgnews";
	    }
	    else if (r.className == "msgold") {
		r.className = "msgolds";
	    }
	}
    }

    function Unhighlight(e)
    {
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
	    r = e.parentElement.parentElement;
	}
	if (r) {
	    if (r.className == "msgnews") {
		r.className = "msgnew";
	    }
	    else if (r.className == "msgolds") {
		r.className = "msgold";
	    }
	}
    }

    function AllChecked()
    {
	ml = document.messageList;
	len = ml.elements.length;
	for(var i = 0 ; i < len ; i++) {
	    if (ml.elements[i].name == "Mid" && !ml.elements[i].checked) {
		return false;
	    }
	}
	return true;
    }

    var noDelAllMsgWarning = false;
    function Delete()
    {
	if (!noDelAllMsgWarning && AllChecked()) {
	    if (!confirm("Tem certeza de que deseja apagar todas as mensagens?")) {
		return;
	    }
	}
	var ml=document.messageList;
	ml.DEL.value = "1"; 
	ml.submit();
    }
    function SynchMoves(which) {
	var ml=document.messageList;
	if(which==1) {
	    ml.destBox2.selectedIndex=ml.destBox.selectedIndex;
	}
	else {
	    ml.destBox.selectedIndex=ml.destBox2.selectedIndex;
	}
    }

    function Move() {
	var ml = document.messageList;
	var dbox = ml.destBox;
	if(dbox.options[dbox.selectedIndex].value == "@NEW") {
	    nn = window.prompt("Insira um nome para sua pasta.","");
	    if(nn == null || nn == "null" || nn == "") {
		dbox.selectedIndex = 0;
		ml.destBox2.selectedIndex = 0;
	    }
	    else {
		ml.NewFol.value = nn;
		ml.MOV.value = "1";
		ml.submit();
	    }
	}
	else {
	    ml.MOV.value = "1";
	    ml.submit();
	}
    }
    function SynchFlags(which)
    {
	var ml=document.messageList;
	if (which == 1) {
	    ml.flags2.selectedIndex = ml.flags.selectedIndex;
	}
	else {
	    ml.flags.selectedIndex = ml.flags2.selectedIndex;
	}
    }

    function SetFlags()
    {
	var ml = document.messageList;
	ml.FLG.value = "1";
	ml.submit();
    }


   function markSpam() {
        var ml = document.messageList;
        ml.FLG.value = "1";
        ml.action += "&flags=spam";
        ml.submit();
   }

   function markAdd() {
        var ml = document.messageList;
        ml.FLG.value = "1";
        ml.action += "&flags=add";
        ml.submit();
   }



//======================================

function Exemplo()
	{
		self.location="../index_novo.asp"
		janela = window.open('opener.asp?pIndice=4','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=300,height=300,top=150,left=150'); 			
 	  window.location.href.href='altera_Atividade1.asp?selAtiv='+document.frm1.selAtividade.value
 	  window.location.href='altera_modulo1.asp?selMod='+document.frm1.selModulo.value
		void(window.open('https://ww28.itau.com.br/callbacknet/cta1.aspx','_blank','height=358,width=347,screenX=0,screenY=0,top=0,left=0'));		
	}

// Função abre_popUp
var janelateste
var jancalc;	
var intCtrSubmit = 0
//alert(intCtrSubmit)
function abraPopUp(p_url,p_largura, p_altura, p_top, p_left)
{		
//alert(p_url)
if (jancalc != null)
	{					
	jancalc.close();					
	jancalc = null;
	}
	jancalc = window.open(p_url, 'janelaprinc','scrollbars=yes,toolbar=no,location=no,status=yes,menubar=no,resizable=no,width='+p_largura+',height='+p_altura+',top='+p_top+',left='+p_left+''); 			

}

function abraPopUp2(p_url,p_largura, p_altura, p_top, p_left, p_janela){		
	var jancalc;	

//alert(p_url)
	if (jancalc != null){					
		jancalc.close();					
		jancalc = null;
	}
	jancalc = window.open(p_url, p_janela,'scrollbars=yes,toolbar=no,location=no,status=yes,menubar=no,resizable=no,width='+p_largura+',height='+p_altura+',top='+p_top+',left='+p_left+''); 				
}

function f_AbraPopUpGeral(p_url,p_param){		
	var jancalc;	

//alert(p_url)
	if (jancalc != null){					
		jancalc.close();					
		jancalc = null;
	}
	jancalc = window.open(p_url, p_janela,p_param); 				
}



///FUNCAO PARA PULAR CAMPO E SÓ ACEITAR NÚMEROS PARA O CEP

var isNN = (navigator.appName.indexOf("Netscape")!=-1); 
function autoTab(input,len, e) 
	{ 
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; 

	if (input.value.length >= len && !containsElement(filter,keyCode)) 
	  	{ 
		input.value = input.value.slice(0, len); 
		input.form[(getIndex(input)+1) % input.form.length].focus(); 
		} 

function containsElement(arr, ele) { 
	var found = false, index = 0; 
	while (!found && index < arr.length) 
		if(arr[index] == ele) 
			found = true; 
		else 
			index++; 
	return found; 
}
 
function getIndex(input) { 
	var index = -1, i = 0, found = false; 
	while (i < input.form.length && index == -1) 
		if (input.form[i] == input)index = i; 
		else i++; 
		return index; 
		} 
	return true; 
} 

//=====================================================================================
//=====================================================================================
function f_abrir_lockup(strIndice,strSqlCompl,strCaminho,strPosicaoX,strPosicaoY)
	{
	var strSql = "";
	if (janela != null){					
		janela.close();					
		janela = null;
	}
	if (strIndice != ''){
		janela = window.open(strCaminho+'../lockup/lockup.asp?pIndice='+strIndice+'&pSqlCompl='+strSqlCompl,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=310,height=300,top='+strPosicaoY+',left='+strPosicaoX); 			
	}
}

function f_abrir_lockup2(strIndice,strSqlCompl,strCaminho,strPosicaoX,strPosicaoY)
	{
	var strSql = "";
	if (janela != null){					
		janela.close();					
		janela = null;
	}
	if (strIndice != ''){
		janela = window.open(strCaminho+'../lockup/lockup.asp?pIndice='+strIndice+'&pSqlCompl='+strSqlCompl,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=360,height=350,top='+strPosicaoY+',left='+strPosicaoX); 			
	}
}

//=====================================================================================
//function f_abrir_calendario(pFINALSEMANA,pMAIORMENORIGUAL,pFERIADOS,pDATAINICIAL,strCaminho,strPosicaoX,strPosicaoY)
function f_abrir_calendario(pFINALSEMANA,pMENORIGUAL,pMAIORIGUAL,pFERIADOS,pDATAINICIAL,pDATAFINAL,strCaminho,strPosicaoX,strPosicaoY)
	{
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}
	//alert('entrei')

	//alert(pDATAINICIAL)
	//alert(pDATAFINAL)
	//janela = window.open(strCaminho+'../calendario/ConsCalendario.asp?FINALSEMANA='+pFINALSEMANA+'&MAIORMENORIGUAL='+pMAIORMENORIGUAL+'&FERIADOS='+pFERIADOS+'&DATAINICIAL='+pDATAINICIAL,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=175,height=140,top='+strPosicaoY+',left='+strPosicaoX); 														
	janela = window.open(strCaminho+'../calendario/ConsCalendario.asp?FINALSEMANA=' + pFINALSEMANA + '&MAIORIGUAL=' + pMAIORIGUAL +'&MENORIGUAL=' + pMENORIGUAL + '&FERIADOS=' + pFERIADOS + '&DATAINICIAL=' + pDATAINICIAL + '&DATAFINAL=' + pDATAFINAL,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=175,height=140,top='+strPosicaoY+',left='+strPosicaoX);
	}
//=====================================================================================
//============================================
// ***Função abrir_janela_cadastro
// Abre a janela para cadastro dos tipos gerais
// ***Parametros:
// strUrl = endereço da página a ser aberta
// intLarguraTela = largura da tela
// intAlturaTela = altura da tela
// strCaminho = caminho da página a ser aberta
// strPosicaoX = posição X do campo superior esquerdo
// strPosicaoY = posição Y do campo superior esquerdo
// strOrigemChamada = Indica quem está chamando: 0 - para chamada direta do menu / 1 - para chamada de cadastro rápido
function abrir_janela_cadastro(strUrl,intLarguraTela,intAlturaTela,strCaminho,strPosicaoX,strPosicaoY,strOrigemChamada)
	{
	var strSql = "";
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}
	if (strUrl != '')	
		{
		janela = window.open(strCaminho+strUrl,'','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+intLarguraTela+',height='+intAlturaTela+',top='+strPosicaoX+',left='+strPosicaoY); 			

		}
	}

//============================================
// ***Função abrir_janela_cadastro
// Abre a janela para cadastro dos tipos gerais
// ***Parametros:
// strUrl = endereço da página a ser aberta
// intLarguraTela = largura da tela
// intAlturaTela = altura da tela
// strCaminho = caminho da página a ser aberta
// strPosicaoX = posição X do campo superior esquerdo
// strPosicaoY = posição Y do campo superior esquerdo
// strOrigemChamada = Indica quem está chamando: 0 - para chamada direta do menu / 1 - para chamada de cadastro rápido
function f_abrir_janela_cadastro(strUrl,intLarguraTela,intAlturaTela,strCaminho,strPosicaoX,strPosicaoY,strOrigemChamada){
	var strSql = "";
	if (janela != null){					
		janela.close();					
		janela = null;
	}
	//alert(strCaminho+strUrl)
	if (strUrl != ''){
		janela = window.open(strCaminho+strUrl,'','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+intLarguraTela+',height='+intAlturaTela+',top='+strPosicaoX+',left='+strPosicaoY); 			
	}
}

//=====================================================================================
//=====================================================================================
// Função calculadora
var jancalc;	
var intCtrSubmit = 0
//alert(intCtrSubmit)
function calculadora()
{		

if (jancalc != null)
	{					
	jancalc.close();					
	jancalc = null;
	}
	jancalc = window.open('../extras/calculadora.htm', '_blank','toolbar=no,location=no,status=no,menubar=no,resizable=no,width=150,height=150,top=100,left=300'); 			

}

// Apresenta mensagwem de Aguarde carregando a tela
function dc(fl)
{
  var x,y;
  if (self.innerHeight)
  {// all except Explorer
    x = self.innerWidth;
    y = self.innerHeight;
  }
  else 
  if (document.documentElement && document.documentElement.clientHeight)
  {// Explorer 6 Strict Mode
   x = document.documentElement.clientWidth;
   y = document.documentElement.clientHeight;
  }
  else
  if (document.body)
  {// other Explorers
   x = document.body.clientWidth;
   y = document.body.clientHeight;
  }

  var el=document.getElementById('DIV_DESKTOP');
	if(null!=el)
	{
		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.width = x + "px";
		el.style.height = y + "px";
		el.style.zIndex = 1;
	}

	var el=document.getElementById('loader');
	if(null!=el)
	{
		var top = (y/2) - 50;
		var left = (x/2) - 200;
		if( left<=0 ) left = 10;

		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.left = left + "px"
		el.style.top = top + "px";
		el.style.zIndex = 2;
	}
}

//FORMATA CNPJ (CORREIO)
//======================================================
//onkeypress="FormataCNPJ(this, window.event.keyCode);"
// JavaScript Document
// Valida campos do formulário
function ValidaCNPJ(CNPJ)
{
	CNPJ = CNPJ.replace( ".", "" );
	CNPJ = CNPJ.replace( ".", "" );
	CNPJ = CNPJ.replace( "/", "" );
	CNPJ = CNPJ.replace( "-", "" );
	var i, j, k, Soma;	   
	if (CNPJ.length != 14){
		alert('O número de CNPJ digitado é inválido!');
		return false;
	}	
	k = 0;
	while (k <= 1)
	{
		Soma = 0;
		j = 5 + k;
		for (i=0; i <= 11+k; i++)
		{
			Soma += parseInt(CNPJ.charAt(i),10)*j;
			if ( j != 2)
				j--;
			else
				j = 9;
		}
		Soma = 11 - Soma%11;
		if (Soma >= 10)
			Soma = 0;
		if ( Soma != parseInt(CNPJ.charAt(12+k)))
		{
			alert('O número de CNPJ digitado é inválido!');
			return false;
		}
		k++;
	}			
}

function Validar(origem) {	
	
	if (TirarBrancoFinal(document.formulario.CNPJ.value) == ""){
		alert ("Favor informar o CNPJ.");
		document.formulario.CNPJ.focus()
		return false;
	}
	else 
	{
		if (ValidaCNPJ (document.formulario.CNPJ.value) == false)
			return false;		
	}
	if (TirarBrancoFinal(document.formulario.Nome.value) == ""){
		alert ("Favor informar seu nome.");
		document.formulario.Nome.focus()
		return false;
	}
	if (TirarBrancoFinal(document.formulario.Endereco.value) == ""){
		alert ("Favor informar o seu endereço.");
		document.formulario.Endereco.focus()
		return false;
	}
	if (TirarBrancoFinal(document.formulario.Cidade.value) == ""){
		alert ("Favor informar a sua Cidade.");
		document.formulario.Cidade.focus()
		return false;
	}
	
	if (TirarBrancoFinal(document.formulario.ufremetente.value) == ""){
		alert ("Favor informar Unidade da Federação.");
		document.formulario.ufremetente.focus()
		return false;
	}
	if (TirarBrancoFinal(document.formulario.ufremetente.value) != "XX" && TirarBrancoFinal(document.formulario.CEP.value) == ""){
		alert ("Favor informar CEP.");
		document.formulario.CEP.focus()
		return false;
	}
	if (TirarBrancoFinal(document.formulario.Telefone.value) == ""){
		alert ("Favor informar a seu telefone.");
		document.formulario.Telefone.focus()
		return false;
	}	
   	if (TirarBrancoFinal(document.formulario.DDD.value) == ""){
		alert ("Favor informar a seu DDD.");
		document.formulario.DDD.focus()
		return false;
	}	
	
	// seta variável com o valor do e-mail, para validação 
	var valorFormatado=document.formulario.E_Mail.value;	
	if (valorFormatado != "Não tem!") {
		if ((valorFormatado.indexOf("@")== -1) || (valorFormatado.indexOf(".")== -1) || (valorFormatado.length < 5)
		  || (valorFormatado.indexOf("@@")> -1) || (valorFormatado.indexOf("..")> -1)  || (valorFormatado.indexOf(" ")> -1)
		  || (valorFormatado.indexOf(".@")> -1) || (valorFormatado.indexOf("@.")> -1)  || (valorFormatado.indexOf(" ")> -1)
		  || (valorFormatado.indexOf("correios@")> -1) || (valorFormatado.indexOf("Correios@")> -1) || (valorFormatado.indexOf("CORREIOS@")> -1) 
		  || (valorFormatado.indexOf("@")== 0) || (valorFormatado.indexOf("WWW")> -1) || (valorFormatado.indexOf("www")> -1)){
			alert ("Favor informar o seu E-Mail corretamente, ele é muito importante para que possamos entrar em contato com você.");
			document.formulario.E_Mail.focus();
			return false;
		}	
	}
	// Validação do campo Mensagem
	if (TirarBrancoFinal(document.formulario.msg.value) == ""){
		alert ("Favor digitar a sua mensagem.");
		document.formulario.msg.focus()
		return false;
	}		

	if (origem == '1' || origem == '2') {
		if (TirarBrancoFinal(document.formulario.numerobina.value) == ""){
		alert ("Favor informar o número do telefone que aparece no Bina?");
		document.frmfalecorreios.numerobina.focus()
		return false;
		}
	}	

	return true;
}
// Fim da rotina de validação
	
<!--- Valida CEP --->
function Mascara(formato, keypress, objeto) {
	campo = eval(objeto);
	if (formato=='cep')
		{
		caracteres = '0123456789';
		separacoes = 1;
		separacao1 = '-';
		conjuntos = 2;
		conjunto1 = 5;
		conjunto2 = 3;
		if ((caracteres.search(String.fromCharCode(keypress))!=-1) && campo.value.length < (conjunto1 + separacoes + conjunto2))
			{
			if (campo.value.length == conjunto1) campo.value = campo.value + separacao1;
			}
		else 
			event.returnValue=false;
	}
}

//Formata CNPJ
function FormataCNPJ(Campo,teclapres) 
{
	var tecla = teclapres.keyCode;
	vr = Campo.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "-", "" );
	tam = vr.length+1;

	if ( tam > 2 && tam < 6 )
		Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3);
	if ( tam >= 6 && tam < 9 )
		Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3);
	if ( tam >= 9 && tam < 13 )
		Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4);
	if ( tam >= 13 && tam < 15 )
		Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4) + '-' + vr.substr(12,2);
}


// function para tirar os brancos dos campos nas funções de validação
function TirarBrancoFinal(sValor) {
   // Tira Brancos no fim da string
   var wI = sValor.length - 1;
   for (; wI > -1; wI--){  
      if (sValor.substring(wI, wI + 1) != " "){  
         return sValor.substring(0,wI + 1);
      }
   }
   return "";
}

function FindObjeto(n, d) { 
	//v4.01
	var p,i,x;
	if(!d) 
		d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=FindObjeto(n,d.layers[i].document);
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

function MostrarTrs(origem) { 

	obj=FindObjeto('TrBina');
	if (origem == '1' || origem == '2') {
		obj.style.display = "";		
	}
	else {
		obj.style.display = 'none';
	}
}

function LimparEmail()
{
	document.formulario.E_Mail.value = "Não tem!";
}
//=============================================================
// FIM FUNÇÕES CORREIO

function DisplayElement ( elt, displayValue ) {
		if ( typeof elt == "string" )
			elt = document.getElementById( elt );
		if ( elt == null ) return;

		if ( oBw && oBw.ns6 ) {
			// OTW table formatting will be lost:
			if ( displayValue == "block" && elt.tagName == "TR" )
				displayValue = "table-row";
			else if ( displayValue == "inline" && elt.tagName == "TR" )
				displayValue = "table-cell";
		}

		elt.style.display = displayValue;
	}

function ylib_Browser()
{
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0;
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
};

//var oBw = new ylib_Browser();

//////////////////////////////////////////////////////////////////////
//FUNÇÃO PARA USUÁRIO DIGITAR TXT EM UMA CAIXA MAIOR (TIPO TEXT AREA)
//////////////////////////////////////////////////////////////////////
var objdsinput = null
function f_abrir_input(strCaminho,strTituloCampo,strNomeObjDs,strValor,intTam,strPosicaoY,strPosicaoX)
	{
	objdsinput = document.getElementById( strNomeObjDs );
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}
	janela = window.open(strCaminho+'lockup/edita_campo.asp?pTam='+intTam+'&pTituloCampo='+strTituloCampo+'&pValor='+strValor,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=310,height=250,top='+strPosicaoY+',left='+strPosicaoX); 				
	}

function carrega_valor_input(vldscampo)
	{	
	objdsinput.value = vldscampo;
	}

//////////////////////////////////////////////////////////////////////
//FUNÇÃO PARA USUÁRIO DIGITAR TXT EM UMA CAIXA MAIOR (TIPO TEXT AREA)
//////////////////////////////////////////////////////////////////////
var objdsinput = null
function f_abrir_consulta_campo(strCaminho,strTituloCampo,strNomeObjDs,strValor,intTam,strPosicaoY,strPosicaoX)
	{
	//alert('strValor = '+strValor)	
	objdsinput = document.getElementById( strNomeObjDs );
	if (janela != null)
		{					
		janela.close();					
		janela = null;
		}
	janela = window.open(strCaminho+'lockup/mostra_campo.asp?pTam='+intTam+'&pTituloCampo='+strTituloCampo+'&pValor='+strValor,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,width=310,height=250,top='+strPosicaoY+',left='+strPosicaoX); 				
	}

function isNUMB(c)	{
	if((cx=c.indexOf(","))!=-1)
		{		
		c = c.substring(0,cx)+"."+c.substring(cx+1);
		}
	if((parseFloat(c) / c != 1))
		{
		if(parseFloat(c) * c == 0)
			{
			return(1);
			}
		else
			{
			return(0);
			}
		}
	else
		{
		return(1);
		}
}

function LIMP(c)	{
	while((cx=c.indexOf("-"))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	while((cx=c.indexOf("/"))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	while((cx=c.indexOf(","))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	while((cx=c.indexOf("."))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	while((cx=c.indexOf("("))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	while((cx=c.indexOf(")"))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	while((cx=c.indexOf(" "))!=-1)
		{		
		c = c.substring(0,cx)+c.substring(cx+1);
		}
	return(c);
}

function RealTestaCNPJ(CNPJ,g)	{
	var VerCNPJ=0;
	var ind=2;
	var tam;
	for(f=g;f>0;f--)
		{
		VerCNPJ+=parseInt(CNPJ.charAt(f-1))*ind;
		if(ind>8)
			{
			ind=2;
			}
		else
			{
			ind++;
			}
		}
		VerCNPJ%=11;
		if(VerCNPJ==0 || VerCNPJ==1)
			{
			VerCNPJ=0;
			}
		else
			{
			VerCNPJ=11-VerCNPJ;
			}
	if(VerCNPJ!=parseInt(CNPJ.charAt(g)))
		{
		<!--alert(VerCNPJ)-->
		return(0);
		}
	else
		{
		return(1);
		}
}


function VerificaCNPJ(CNPJ)	{
	CNPJ = LIMP(CNPJ);
	if(isNUMB(CNPJ) != 1)
		{
		return(0);
		}
	else
		{
		if(CNPJ == 0)
			{
			return(0);
			}
		else
			{
			g=CNPJ.length-2;
			if(RealTestaCNPJ(CNPJ,g) == 1)
				{
				g=CNPJ.length-1;
				if(RealTestaCNPJ(CNPJ,g) == 1)
					{	
					return(1);
					}
				else
					{
					return(0);
					}
				}
			else
				{
				return(0);
				}
			}
		}
}

function f_ChecaTudo_Obj(ind,pNmObj){
	TotalOn = 0;
	TotalBoxes = 0;
	for (var i=0;i<document.forms[ind].elements.length;i++){
		var e = document.forms[ind].elements[i];
		if (e.type=='checkbox'){
			var nmObj = e.name
			if (nmObj.indexOf(pNmObj) >= 0){
				TotalBoxes++; 
				Check(e);
			}
		}
		if (e.checked){
			TotalOn++;
		}
	}
}

function f_LimpaChecaTudo_Obj(ind,pNmObj){
	TotalOn = 0;
	TotalBoxes = 0;
	for (var i=0;i<document.forms[ind].elements.length;i++){
		var e = document.forms[ind].elements[i];
		var nmObj = e.name
		if (nmObj.indexOf(pNmObj) >= 0){
			TotalBoxes++; 
			Clear(e);
		}
		if (e.checked){
			TotalOn++;
		}
	}
		
}
	
function f_ChecaTudo(ind){
	TotalOn = 0;
	TotalBoxes = 0;
	//alert(document.forms[ind].elements.length)	
	for (var i=0;i<document.forms[ind].elements.length;i++){
		var e = document.forms[ind].elements[i];
//			if ((e.name != 'chk_ListaSolicitacao') && (e.type=='checkbox'))
		if (e.type=='checkbox'){
			TotalBoxes++; 
			Check(e);
		}
			
		if (e.checked){
			TotalOn++;
		}
	}
		
}

function f_LimpaChecaTudo(ind)
	{
		TotalOn = 0;
		TotalBoxes = 0;
			
		for (var i=0;i<document.forms[ind].elements.length;i++)
		{
			var e = document.forms[ind].elements[i];
//			if ((e.name != 'chk_ListaSolicitacao') && (e.type=='checkbox'))
			if (e.type=='checkbox')

			{
				TotalBoxes++; 
				Clear(e);
			}
				
			if (e.checked)
			{
				TotalOn++;
			}
		}
			
	}

//--> 

function ffff() {
  var oField;
  if (document.forms.length > 0) {
    for (var i=0; i < document.forms[0].elements.length; ++i) {
      oField = document.forms[0].elements[i];
      if ((oField.type != "hidden") && (oField.type != "select-one")) {
        if (oField.disabled!=true) {
          oField.focus();
          break;
        }
      }
    }
  }
}
//ffff();

function f_Dia_Semana(data){
	
	var dia   = data.substring(0,2);
	var mes   = data.substring(3,5);
	var ano   = data.substring(6,10);
	objdata = new Date(ano,mes-1,dia);
	var dia2 = objdata.getDate();
	var mes2 = objdata.getMonth()+1
	var ano2 = objdata.getFullYear()
	var diasemana = objdata.getDay()
	
	//Domingo = 0
	//Segunda = 1	
	//Terça = 2
	//Quarta = 3	
	//Quinta = 4				
	//Sexta = 5				
	//Sabado = 6
	return(diasemana)

}
