
/* INDEX - MUDAR COR */

function mudaCor(id){
	
	if (id == "newaccount"){
	
		document.getElementById('newaccount').style.display = 'none';
		document.getElementById('newaccountColor').style.display = '';
		
		document.getElementById('extend').style.display = '';
		document.getElementById('extendColor').style.display = 'none';
		
		document.getElementById('traffic').style.display = '';
		document.getElementById('trafficColor').style.display = 'none';
	
	}
	
	if (id == "extend"){
	
		document.getElementById('newaccount').style.display = '';
		document.getElementById('newaccountColor').style.display = 'none';
		
		document.getElementById('extend').style.display = 'none';
		document.getElementById('extendColor').style.display = '';
		
		document.getElementById('traffic').style.display = '';
		document.getElementById('trafficColor').style.display = 'none';
	
	}
	
	if (id == "traffic"){
	
		document.getElementById('newaccount').style.display = '';
		document.getElementById('newaccountColor').style.display = 'none';
		
		document.getElementById('extend').style.display = '';
		document.getElementById('extendColor').style.display = 'none';
		
		document.getElementById('traffic').style.display = 'none';
		document.getElementById('trafficColor').style.display = '';
	
	}

}


function changeMenuAfiliado(id){

	document.getElementById('banner').style.display = 'none';
	document.getElementById('resgate').style.display = 'none';
	document.getElementById('historico').style.display = 'none';

	document.getElementById(id).style.display = '';
	
}

function cupom(id,t){

	location.href = "/comprar.php?id=" + id + "&t=" + t + "&cupom=" + document.getElementById('NOM_CUPOM').value;

	return false;
	
}


//////////////////////// VALIDA A DATA
function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function isValidDate (myDate,sep) {
	// checks if date passed is in valid dd/mm/yyyy format

	if (myDate.length == 10) {
		if (myDate.substring(2,3) == sep && myDate.substring(5,6) == sep) {
			var date  = myDate.substring(0,2);
			var month = myDate.substring(3,5);
			var year  = myDate.substring(6,10);

			var test = new Date(year,month-1,date);

			if (year == y2k(test.getYear()) && (month-1 == test.getMonth()) && (date == test.getDate())) {
				reason = '';
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}

function validaData(myDate) {
	if (myDate.value != ""){
		if (isValidDate(myDate.value,'/')){
			return true;
		} else {
			alert('Data Inválida! Ex: DD/MM/YYYY');
			return false;
		}
	} else {
		return false;
	}
}

//////////////////////// COLOCAR (/) NAS DATAS
function mascaraData(event,campoData){

	var data = campoData.value;

	var BACKSPACE=  8;
	var key;
	var tecla;


	CheckTAB=true;
	if(navigator.appName.indexOf("Netscape")!= -1)
	tecla= event.which;
	else
	tecla= event.keyCode;

	key = String.fromCharCode( tecla);
	if (tecla == 47) return false;
	//alert( 'key: ' + tecla + '  -> campo: ' + key);

	if (data.length == 2){
		data = data + '/';
		campoData.value = data;
		return true;
	}
	if (data.length == 5){
		data = data + '/';
		campoData.value = data;
		return true;
	}

}

// SOMENTE NÚMERO
function somenteNumero(obj,e){

  var valor, val;

  liberado = new Array(',','.');
  liberadoE = new Array(188,190,8);

  valor = obj.value;
  if(document.all)
  {
    if(!((e.keyCode > 47 && e.keyCode < 58) || Array.find(liberadoE,e.keyCode) != '-1' ))     {
        obj.value = valor.substr(0,valor.length - 1);
    }
  }
  else
  {
    val = '';

    for (x = 0; x < valor.length; x++)
    {
      if(!isNaN(valor[x]) || Array.find(liberado,valor[x]) != '-1')
      {
        val += valor[x];
      }
    }
    obj.value = val;
  }
}

Array.find = function(ary, element)
{
    for(var i=0; i<ary.length; i++)
    {
        if(ary == element)
        {
            return i;
        }
    }
    return -1;
}


function mascara(o,f){
	v_obj=o;
	v_fun=f;
	setTimeout("execmascara()",1);
}

function execmascara(){
	v_obj.value=v_fun(v_obj.value);
}

function data(v){
	v=v.replace(/\D/g,"");                    //Remove tudo o que não é dígito
	v=v.replace(/(\d{2})(\d)/,"$1/$2");       //Coloca um ponto entre o terceiro e o quarto dígitos
	v=v.replace(/(\d{2})(\d)/,"$1/$2");       //Coloca um ponto entre o terceiro e o quarto dígitos
	v=v.replace(/(\d{4})(\d)/,"$1/$2");       //de novo (para o segundo bloco de números)
	return v;
}

///////////////////////
function abreFormaPagamento(id,codBanco){
							
	if (codBanco == 'DBB'){

		document.getElementById('BB_Deposito').style.display = 'none';
		document.getElementById('BB_Envelope').style.display = 'none';
		document.getElementById('BB_ITAU_Transferencia').style.display = 'none';
		document.getElementById('DOC').style.display = 'none';

		if (id.value == 'DEPOSITO') document.getElementById('BB_Deposito').style.display = 'block';
		if (id.value == 'ENVELOPE') document.getElementById('BB_Envelope').style.display = 'block';
		if (id.value == 'TRANSFERENCIA') document.getElementById('BB_ITAU_Transferencia').style.display = 'block';
		if (id.value == 'DOC') document.getElementById('DOC').style.display = 'block';

	} else if (codBanco == 'DBRADESCO'){
		
		document.getElementById('BRADESCO_Postal').style.display = 'none';
		document.getElementById('BRADESCO_Deposito').style.display = 'none';
		document.getElementById('BRADESCO_Envelope').style.display = 'none';
		document.getElementById('BRADESCO_Transferencia').style.display = 'none';
		document.getElementById('DOC').style.display = 'none';

		if (id.value == 'POSTAL') document.getElementById('BRADESCO_Postal').style.display = 'block';
		if (id.value == 'DEPOSITO') document.getElementById('BRADESCO_Deposito').style.display = 'block';
		if (id.value == 'ENVELOPE') document.getElementById('BRADESCO_Envelope').style.display = 'block';
		if (id.value == 'TRANSFERENCIA') document.getElementById('BRADESCO_Transferencia').style.display = 'block';
		if (id.value == 'DOC') document.getElementById('DOC').style.display = 'block';
	
	} else if (codBanco == 'DCAIXA'){
		
		document.getElementById('CEF_Deposito').style.display = 'none';
		document.getElementById('CEF_Envelope').style.display = 'none';
		document.getElementById('CEF_Transferencia').style.display = 'none';
		document.getElementById('DOC').style.display = 'none';

		if (id.value == 'CASALOTERICA') document.getElementById('CEF_Deposito').style.display = 'block';
		if (id.value == 'DEPOSITO') document.getElementById('CEF_Deposito').style.display = 'block';
		if (id.value == 'ENVELOPE') document.getElementById('CEF_Envelope').style.display = 'block';
		if (id.value == 'TRANSFERENCIA') document.getElementById('CEF_Transferencia').style.display = 'block';
		if (id.value == 'DOC') document.getElementById('DOC').style.display = 'block';
	
	} else if (codBanco == 'DITAU'){

		document.getElementById('ITAU_Deposito').style.display = 'none';
		document.getElementById('ITAU_Envelope').style.display = 'none';
		document.getElementById('BB_ITAU_Transferencia').style.display = 'none';
		document.getElementById('DOC').style.display = 'none';

		if (id.value == 'DEPOSITO') document.getElementById('ITAU_Deposito').style.display = 'block';
		if (id.value == 'ENVELOPE') document.getElementById('ITAU_Envelope').style.display = 'block';
		if (id.value == 'TRANSFERENCIA') document.getElementById('BB_ITAU_Transferencia').style.display = 'block';
		if (id.value == 'DOC') document.getElementById('DOC').style.display = 'block';
	
	} else if (codBanco == 'DUNIBANCO'){

		document.getElementById('UNIBANCO_Deposito').style.display = 'none';
		document.getElementById('UNIBANCO_Envelope').style.display = 'none';
		document.getElementById('UNIBANCO_Transferencia').style.display = 'none';
		document.getElementById('DOC').style.display = 'none';

		if (id.value == 'DEPOSITO') document.getElementById('UNIBANCO_Deposito').style.display = 'block';
		if (id.value == 'ENVELOPE') document.getElementById('UNIBANCO_Envelope').style.display = 'block';
		if (id.value == 'TRANSFERENCIA') document.getElementById('UNIBANCO_Transferencia').style.display = 'block';
		if (id.value == 'DOC') document.getElementById('DOC').style.display = 'block';
	
	}

}


function confirmaPagamento(codBanco,codCompra){
	
	if (document.getElementById("dataPagamento").value == ""){
		document.getElementById("dataPagamento").style.backgroundColor = '#C6C6C6';
		alert("Preencha a data do pagamento.");
		document.getElementById("dataPagamento").focus();
		return false;
	} else {	
		document.getElementById("dataPagamento").style.backgroundColor = '#FFFFFF';
	}
	
	if (document.getElementById("valorPagamento").value == ""){
		document.getElementById("valorPagamento").style.backgroundColor = '#C6C6C6';
		alert("Preencha o valor do pagamento.");
		document.getElementById("valorPagamento").focus();
		return false;
	} else {	
		document.getElementById("valorPagamento").style.backgroundColor = '#FFFFFF';
	}
	
	if (document.getElementById("formaPagamento").value == ""){
		document.getElementById("formaPagamento").style.backgroundColor = '#C6C6C6';
		alert("Selecione a forma de pagamento.");
		document.getElementById("formaPagamento").focus();
		return false;
	} else {	
		document.getElementById("formaPagamento").style.backgroundColor = '#FFFFFF';
	}
	
	var id = document.getElementById("formaPagamento").value;

	if (codBanco == 'DBB'){

		if (id == 'DEPOSITO'){

			if (document.getElementById("DEPOSITO_numeroDocumento").value == ""){
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: NR Documento");
				document.getElementById("DEPOSITO_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'ENVELOPE'){

			if (document.getElementById("ENVELOPE_numeroDocumento").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: NR Envelope");
				document.getElementById("ENVELOPE_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
		
		} else
		if (id == 'TRANSFERENCIA'){

			if (document.getElementById("TRANSFERENCIA_nomeTitular").value == ""){
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Titular da Conta");
				document.getElementById("TRANSFERENCIA_nomeTitular").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#FFFFFF';
			}

			if (document.getElementById("TRANSFERENCIA_agenciaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Agência de Origem");
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#FFFFFF';
			}

			if (document.getElementById("TRANSFERENCIA_contaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Conta de Origem");
				document.getElementById("TRANSFERENCIA_contaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#FFFFFF';
			}

		}

	} else if (codBanco == 'DBRADESCO'){

		if (id == 'POSTAL'){

			if (document.getElementById("POSTAL_numeroDocumento").value == ""){
				document.getElementById("POSTAL_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Agencia Relac");
				document.getElementById("POSTAL_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("POSTAL_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("POSTAL_numeroDocumento2").value == ""){
				document.getElementById("POSTAL_numeroDocumento2").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: PACB");
				document.getElementById("POSTAL_numeroDocumento2").focus();
				return false;
			} else {	
				document.getElementById("POSTAL_numeroDocumento2").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'DEPOSITO'){
			
			if (document.getElementById("DEPOSITO_numeroDocumento").value == ""){
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Term");
				document.getElementById("DEPOSITO_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("DEPOSITO_numeroDocumento2").value == ""){
				document.getElementById("DEPOSITO_numeroDocumento2").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Ag. Acolhedora");
				document.getElementById("DEPOSITO_numeroDocumento2").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_numeroDocumento2").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'ENVELOPE'){
			
			if (document.getElementById("ENVELOPE_numeroDocumento").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: N. Trans");
				document.getElementById("ENVELOPE_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("ENVELOPE_numeroDocumento2").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento2").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Term");
				document.getElementById("ENVELOPE_numeroDocumento2").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento2").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'TRANSFERENCIA'){
			
			if (document.getElementById("TRANSFERENCIA_nomeTitular").value == ""){
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Titular da Conta");
				document.getElementById("TRANSFERENCIA_nomeTitular").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_agenciaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Agência de Origem");
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_contaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Conta de Origem");
				document.getElementById("TRANSFERENCIA_contaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_numeroDocumento").value == ""){
				document.getElementById("TRANSFERENCIA_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Nº de Documento");
				document.getElementById("TRANSFERENCIA_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}

		}
	
	} else if (codBanco == 'DCAIXA'){

		if (id == 'CASALOTERICA' || id == 'DEPOSITO'){
			
			if (document.getElementById("DEPOSITO_horaPagamento").value == ""){
				document.getElementById("DEPOSITO_horaPagamento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Horário do Pagamento");
				document.getElementById("DEPOSITO_horaPagamento").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_horaPagamento").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("DEPOSITO_numeroDocumento").value == ""){
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Num.Doc");
				document.getElementById("DEPOSITO_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'ENVELOPE'){
			
			if (document.getElementById("ENVELOPE_numeroDocumento").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Terminal");
				document.getElementById("ENVELOPE_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("ENVELOPE_numeroDocumento2").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento2").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Número do Envelope");
				document.getElementById("ENVELOPE_numeroDocumento2").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento2").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'TRANSFERENCIA'){
			
			if (document.getElementById("TRANSFERENCIA_nomeTitular").value == ""){
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Titular da Conta");
				document.getElementById("TRANSFERENCIA_nomeTitular").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_agenciaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Agência de Origem");
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_contaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Conta de Origem");
				document.getElementById("TRANSFERENCIA_contaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_numeroDocumento").value == ""){
				document.getElementById("TRANSFERENCIA_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Código da operação");
				document.getElementById("TRANSFERENCIA_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}

		}
	
	} else if (codBanco == 'DITAU'){

		if (id == 'DEPOSITO'){
			
			if (document.getElementById("DEPOSITO_numeroDocumento").value == ""){
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Número do documento");
				document.getElementById("DEPOSITO_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
		
		} else
		if (id == 'ENVELOPE'){
			
			if (document.getElementById("ENVELOPE_numeroDocumento").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: CTR");
				document.getElementById("ENVELOPE_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("ENVELOPE_numeroDocumento2").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento2").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Caixa Eletrônico");
				document.getElementById("ENVELOPE_numeroDocumento2").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento2").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'TRANSFERENCIA'){

			if (document.getElementById("TRANSFERENCIA_nomeTitular").value == ""){
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Titular da Conta");
				document.getElementById("TRANSFERENCIA_nomeTitular").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#FFFFFF';
			}

			if (document.getElementById("TRANSFERENCIA_agenciaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Agência de Origem");
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#FFFFFF';
			}

			if (document.getElementById("TRANSFERENCIA_contaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Conta de Origem");
				document.getElementById("TRANSFERENCIA_contaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#FFFFFF';
			}

		}
	
	} else if (codBanco == 'DUNIBANCO'){

		if (id == 'DEPOSITO'){
			
			if (document.getElementById("DEPOSITO_numeroDocumento").value == ""){
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Número do documento");
				document.getElementById("DEPOSITO_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("DEPOSITO_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}
		
		} else
		if (id == 'ENVELOPE'){
			
			if (document.getElementById("ENVELOPE_numeroDocumento").value == ""){
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Número do documento");
				document.getElementById("ENVELOPE_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("ENVELOPE_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}

		} else
		if (id == 'TRANSFERENCIA'){

			if (document.getElementById("TRANSFERENCIA_nomeTitular").value == ""){
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Titular da Conta");
				document.getElementById("TRANSFERENCIA_nomeTitular").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_nomeTitular").style.backgroundColor = '#FFFFFF';
			}

			if (document.getElementById("TRANSFERENCIA_agenciaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Agência de Origem");
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_agenciaTransferencia").style.backgroundColor = '#FFFFFF';
			}

			if (document.getElementById("TRANSFERENCIA_contaTransferencia").value == ""){
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Conta de Origem");
				document.getElementById("TRANSFERENCIA_contaTransferencia").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_contaTransferencia").style.backgroundColor = '#FFFFFF';
			}
			
			if (document.getElementById("TRANSFERENCIA_numeroDocumento").value == ""){
				document.getElementById("TRANSFERENCIA_numeroDocumento").style.backgroundColor = '#C6C6C6';
				alert("Informe o campo: Nº de Documento");
				document.getElementById("TRANSFERENCIA_numeroDocumento").focus();
				return false;
			} else {	
				document.getElementById("TRANSFERENCIA_numeroDocumento").style.backgroundColor = '#FFFFFF';
			}

		}
	
	}
	
	if (id == 'DOC'){
		
		if (document.getElementById("DOC_nomeTitular").value == ""){
			document.getElementById("DOC_nomeTitular").style.backgroundColor = '#C6C6C6';
			alert("Informe o campo: Titular da Conta");
			document.getElementById("DOC_nomeTitular").focus();
			return false;
		} else {	
			document.getElementById("DOC_nomeTitular").style.backgroundColor = '#FFFFFF';
		}
		
		if (document.getElementById("DOC_agenciaTransferencia").value == ""){
			document.getElementById("DOC_agenciaTransferencia").style.backgroundColor = '#C6C6C6';
			alert("Informe o campo: Agência de Origem");
			document.getElementById("DOC_agenciaTransferencia").focus();
			return false;
		} else {	
			document.getElementById("DOC_agenciaTransferencia").style.backgroundColor = '#FFFFFF';
		}
		
		if (document.getElementById("DOC_contaTransferencia").value == ""){
			document.getElementById("DOC_contaTransferencia").style.backgroundColor = '#C6C6C6';
			alert("Informe o campo: Conta de Origem");
			document.getElementById("DOC_contaTransferencia").focus();
			return false;
		} else {	
			document.getElementById("DOC_contaTransferencia").style.backgroundColor = '#FFFFFF';
		}
		
		if (document.getElementById("DOC_numeroDocumento").value == ""){
			document.getElementById("DOC_numeroDocumento").style.backgroundColor = '#C6C6C6';
			alert("Informe o campo: Número do Documento");
			document.getElementById("DOC_numeroDocumento").focus();
			return false;
		} else {	
			document.getElementById("DOC_numeroDocumento").style.backgroundColor = '#FFFFFF';
		}
		
	}
	
	document.getElementById('COD_BANCO').value = codBanco;
	document.getElementById('COD_COMPRA').value = codCompra;

	return true;

}