// -----------------------------------------------------------------------
// Empresas
// -----------------------------------------------------------------------
function empresaEditar(valor) {
        formX.command.value="nn_empresa";
        formX.id.value=valor;
        formX.action.value="edit";
        ChamaPaginaArray("/maquinaNet/techEngine?" + createQueryString(formX), "listagem" );
}
function empresaPesquisar() {
	formX.command.value="nn_empresa";
	formX.action.value="find";
	ChamaPaginaArray("/maquinaNet/techEngine?" + createQueryString(formX), "listagem" );
}
function empresaExcel() {
	formX.command.value="nn_empresa";
	formX.action.value="excel";
	if( formX.nome.value.length > 1 ) {
		ChamaPaginaArray("/maquinaNet/techEngine?" + createQueryString(formX), "listagem" );
		} else {
		alert('Preencha o Nome do empresa!');
	}
}
function maisData() {
		var qtd  = formX.qtdDatas.value;
		var qtd2 = formX.qtdDatas.value;
		qtd++;
    	qtd2++; qtd2++;
    	formX.qtdDatas.value = qtd;
    	
    	var result = 
    		"Data: &#60;input type='text' maxlength='10' size='8' onkeypress='checkDate(this)' name='data" + qtd + "' /&#62; - " + 
    		"&#60;input type='text' name='descricao" + qtd + "' size='30' /&#62;" + 
    		"&#60;div id='data" + qtd2 + "' /&#62;"
   		;
		document.getElementById("data"+qtd).innerHTML = result;
    }
function empresaSalvar() {
	formX.command.value="nn_empresa";
	formX.action.value="save";
	ChamaPaginaArray("/maquinaNet/techEngine?" + createQueryString(formX), "principal" );	
}
function empresaExcluir(valor) {
	formX.command.value="nn_empresa";
	formX.id.value=valor;
	if (confirm('Confirma exclusão deste registro?')) {
		formX.action.value="delete";
	}
}
function deleteData(id) {
	formX.command.value="nn_empresa";
	if (confirm('Confirma exclusão deste registro?')) {
	formX.action.value="deleteData";
	formX.id.value = id;
	formX.submit();
	}
}
// -----------------------------------------------------------------------
// Propostas 
// -----------------------------------------------------------------------
function propostaEditar(valor) {
	formX.command.value="nn_proposta";
	formX.id.value=valor;
	formX.action.value="edit";
}
function propostaExcluir(valor) {
	formX.command.value="nn_proposta";
	formX.id.value=valor;
	if (confirm('Confirma exclusão deste registro?')) {
	formX.action.value="delete";
	}
}
function propostaPesquisar(valor) {
	formX.command.value="nn_proposta";
	formX.print.value=valor;
	formX.action.value="find";
	ChamaPaginaArray("/maquinaNet/techEngine?" + createQueryString(formX), "listagem" );
}
function propostaSalvar() {
	formX.command.value="nn_proposta";
	formX.action.value="save";
}
function propostaSalvarParcela( v1, v2 ) {
	formX.idPropostaMovimento.value=v1;
	formX.status.value=v2;
	formX.action.value="saveParcela";
	formX.submit();
}
function propostaExcluirArquivo(valor) {
	formX.id.value=valor;
	if (confirm('Confirma exclusão deste registro?')) {
		formX.action.value="deleteFile";
		formX.submit();
	}
}
function propostaCheckIndicacao( value ) {
	if( value == '1') {
	    formX.idUserIndicacao1.disabled=true;
	    formX.idUserIndicacao2.disabled=true;
	    formX.idUserIndicacao1.value=0;
	    formX.idUserIndicacao2.value=0;
	} else {
	    formX.idUserIndicacao1.disabled=false;
	    formX.idUserIndicacao2.disabled=false;
	}
}
function propostaSair() {
	formX.command.value="nn_empresa";
	formX.id.value=formX.idEmpresa.value;
	formX.action.value="edit";
} 
// -----------------------------------------------------------------------
// Relatórios
// -----------------------------------------------------------------------
function pesquisarRelatorio() {
	formX.command.value="nn_relatorio";
	formX.action.value="print";
	ChamaPaginaArray( "/maquinaNet/techEngine?" + createQueryString(formX) + "#topo", "listagem");
}

function change(form) {
	applet=document.applets["chart"];
	applet.set3DEnabled(form.is3d.checked);
	applet.set3DSeriesInLineEnabled(form.is3dseriesinline.checked);
	applet.setGridEnabled(0,form.isgridenabled.checked);
	applet.setHorizontalGraphEnabled(form.ishorizontal.checked);

	applet.repaintChart();
}