function liContrato(flg)
{
	if(flg)
	{
		$('#__control').value = '1';
		$('#formContrato').submit();
	}
	else
	{
		window.location = APPV_PATH;
	}
}

function __transformaTextoMaiusculo(elemento)
{
	elemento.value = elemento.value.toUpperCase();
}

function replicaEndereco()
{
	if($('#replicar_endereco')[0].checked)
	{
		$('#COENDERE')[0].value = $('#TRENDERE')[0].value = $('#ENDERECO')[0].value;
		$('#CONUMERO')[0].value = $('#TRNUMERO')[0].value = $('#NUMERO')[0].value;
		$('#COCOMPLEMENTO')[0].value = $('#TRCOMPLEMENTO')[0].value = $('#COMPLEMENTO')[0].value;
		$('#COBAIRRO')[0].value = $('#TRBAIRRO')[0].value = $('#BAIRRO')[0].value;
		$('#COCICODIGO')[0].value = $('#TRCICODIGO')[0].value = $('#CICODIGO')[0].value;
		$('#COCICODIGO_LABEL')[0].value = $('#TRCICODIGO_LABEL')[0].value = $('#CICODIGO_LABEL')[0].value;
		$('#COCEP')[0].value = $('#TRCEP')[0].value = $('#CEP')[0].value;
	}
}

function abreFormCidades(idRetorno)
{
	var popup = abre_popup(APPV_PATH + 'admin/gerenciar.php?secao=sender&sub=montaFormCidades&idRetorno=' + idRetorno,410,700,0,'popup');
}

function salvaDados()
{
	//var confirmacao = confirm('Confirma a alteração feita no(s) dado(s)?');
	//if(confirmacao)
	{
		MostraObjeto('mensagem');
		$('#mensagem')[0].innerHTML = __msg_save;
		var elementos = serialize('dados_cadastrais');
		var AJAX = new Ajax();
		//alert(elementos);
		AJAX.connect(APPV_PATH + 'ajax/salvaDadosSocioFutebol/', 'POST', elementos, 'return_salvaDados');
	}
}

function return_salvaDados(inner)
{
	try
	{
		eval(inner);
	}
	catch(e)
	{
		//alert(e);
	}

	if(typeof objeto == "object")
	{
		$('#mensagem')[0].innerHTML = objeto.msg;

		if(objeto.url.length)
		{
			setTimeout(function(){ window.location = objeto.url; }, 1000);
		}
	}
	else
	{
		alert('ERROR');
		$('#mensagem')[0].innerHTML = inner;
	}
	//alert(inner);
}

function __workCpfCnpj(valor)
{
	switch(valor)
	{
		case 'F' :
		{
			$('#tr_cpf')[0].style.display = '';
			$('#tr_cgc')[0].style.display = 'none';
			$('#nome_razao')[0].innerHTML = "<strong>Nome Completo: </strong>";
		} break;

		case 'J' :
		{
			$('#tr_cpf')[0].style.display = 'none';
			$('#tr_cgc')[0].style.display = '';
			$('#nome_razao')[0].innerHTML = "<strong>Razão Social: </strong>";
		} break;

		default :
		{
			$('#tr_cpf')[0].style.display = 'none';
			$('#tr_cgc')[0].style.display = 'none';
			$('#nome_razao')[0].innerHTML = "<strong>Nome Completo: </strong>";
		} break;
	}
}

function workOpcoesPgto()
{
	var className2 = "";
	$('.radioOpcoes').each
	(
		function (a)
		{
			className2 = this.checked ? 'trHover2 hand' : 'hand';
			$('#tr_' + this.id)[0].className = className2;
		}

	);
}

function ativaHover(elemento)
{
	if(!$('#' + elemento.getAttribute('index'))[0].checked)
	{
		elemento.className = 'trHover hand';
		if(elemento.id == 'tr_opcaoPgto_1')
		{
			$('#msg4')[0].className = 'msg5';
		}
	}
}

function ativaOut(elemento)
{
	if(!$('#' + elemento.getAttribute('index'))[0].checked)
	{
		elemento.className = 'hand';
	}

	if(elemento.id == 'tr_opcaoPgto_1')
	{
		$('#msg4')[0].className = 'msg4';
	}
}
