function setCheckedValue(radioObj, newValue) {
    if(!radioObj)
        return;
    var radioLength = radioObj.length;
    if(radioLength == undefined) {
        radioObj.checked = (radioObj.value == newValue.toString());
        return;
    }
    for(var i = 0; i < radioLength; i++) {
        radioObj[i].checked = false;
        if(radioObj[i].value == newValue.toString()) {
            radioObj[i].checked = true;
        }
    }
}

function getURL(url) {
	
	window.location.href = url;
	
	return true;
	
}

function change_pessoa_cad(pessoa) {
    if (pessoa=="F") {
        Oculta('NOME_J');
        Oculta('NOME_FANTASIA_J');
        Oculta('CONTATO_J');
        Oculta('FONE2_J');
        Oculta('CNPJ_J');
        Oculta('IE_J');
        Mostra('CPF_F');
        Mostra('RG_F');
        Mostra('NOME_F');
        Mostra('DTNASC_F');
        document.formCadastro.TIPO_PESSOA.value = 'F';
        setCheckedValue(document.formCadastro.elements['PESSOA'], 'F');

    } else if (pessoa=="J") {
        Oculta('NOME_F');
        Oculta('CPF_F');
        Oculta('RG_F');
        Oculta('DTNASC_F');
        Mostra('NOME_J');
        Mostra('NOME_FANTASIA_J');
        Mostra('CONTATO_J');
        Mostra('FONE2_J');
        Mostra('CNPJ_J');
        Mostra('IE_J');
        document.formCadastro.TIPO_PESSOA.value = 'J';
        setCheckedValue(document.formCadastro.elements['PESSOA'], 'J');
    }
}

function change_border(o,color) {
    obj = document.getElementById(o);
    obj.style.borderColor = color;
}
