function verificaQuantidade(){
	if(event.keyCode == 13){
		acessosQuantidade();
		return false;
	}
	else{
		return campoNumerico();
	}
}

function QuantidadeNecessidade(){
	quantidade = document.getElementById('qnt').value;
	if(quantidade == "" || quantidade < 1){
		alert("A quantidade de acessos deve ser preenchida com valor inteiro!!");
		document.getElementById('qnt').focus();
		quantidade = 0;
	}
	if(quantidade > 0){
		html = "";
		html += "<table border='0' cellspacing='0' cellpadding='0' width='100%'>";
			html += "<tr>";
				html += "<td width='190' class='textopreto'>Plano</td>";
				html += "<td width='190' class='textopreto'>Pacote de minutos</td>";
				html += "<td width='191' class='textopreto'>Acessos</td>";
				html += "<td width='191' class='textopreto'>Serviços opcionais</td>";
			html += "</tr>";
		for(i=0;i<quantidade;i++){
			html += "<tr>";
				html += "<input type='hidden' name='apa_id[]' value='0'>";
				html += "<td><input class='form' type='text' name='apa_quantidade[]' size='27'></td>";
				html += "<td><input class='form' type='text' name='apa_valor[]' size='27'></td>";
				html += "<td><input class='form' type='text' name='apa_fabricante[]' size='27'></td>";
				html += "<td><input class='form' type='text' name='apa_modelo[]' size='27'></td>";
			html += "</tr>";
			html += "<tr>";
				html += "<td colspan='9' height='1'></td>";
			html += "</tr>";
		}
		html += "</table>";
//		document.body.scroll = "yes";
		document.getElementById('necessidade').innerHTML = html;
//		document.body.scrollTop = 450;
	}
}

function ConfiguraAcessos(val){
    
	quantidade = val;
	
	if(quantidade == ""){
		alert("A quantidade de acessos deve ser preenchida com valor inteiro!!");
		document.getElementById('qnt').focus();
		quantidade = 0;
	}
	if(quantidade > 0){
		html = "";
		html += "<table border=0 cellspacing=1 cellpadding=0 width=100% bgcolor=#EEEEEE>";
			html += "<tr>";
				html += "<td  align=center class=textopreto>Quantidade de Aparelhos</td>";
				html += "<td  align=center class=textopreto>Valor do Aparelho(R$)</td>";
				html += "<td width=70  align=center class=textopreto>Fabricante</td>";
				html += "<td width=70 align=center class=textopreto>Modelo</td>";
				html += "<td  align=center class=textopreto>Quantidade de TIMChips</td>";
				html += "<td  align=center class=textopreto>Valor do TIMChip R$</td>";
				html += "<td  align=center class=textopreto>Tarifa Zero</td>";
				html += "<td  align=center class=textopreto>Golden Number</td>";
			html += "</tr>";
		for(i=0;i<quantidade;i++){
			html += "<tr>";
				html += "<input type=hidden name=apa_id[] value=0>";
				html += "<td align=center><input class=form type=text name=qtde_aparelhos[] size=4></td>";
				html += "<td align=center><input class=form type=text name=valor_aparelho[] onBlur=testCurrency(this) onKeyPress=return(currencyFormat(this,',',event)) size=6></td>";
				html += "<td align=center><input class=form type=text name=fabricante[] size=8></td>";
				html += "<td align=center><input class=form type=text name=modelo[] size=6></td>";
				html += "<td align=center><input class=form type=text name=qtde_chips[] size=4></td>";
				html += "<td align=center><input class=form type=text name=valor_chip[] onBlur=testCurrency(this) onKeyPress=return(currencyFormat(this,',',event)) size=4></td>";
				html += "<td align=center class=textopreto><input class=form type=radio name=tarifa_zero["+i+"] value=1>Sim<br><input class=form type=radio name=tarifa_zero["+i+"] value=0>Não</td>";
				html += "<td align=center class=textopreto><input class=form type=radio name=golden_number["+i+"] value=1>Sim<br><input class=form type=radio name=golden_number["+i+"] value=0>Não</td>";				
			html += "</tr>";
			html += "<tr>";
				html += "<td colspan=9 height=1></td>";
			html += "</tr>";
		}
		html += "</table>";
//		document.body.scroll = "yes";
//		document.getElementById('necessidade').innerHTML = html;
        return html;
		//return html;
//		document.body.scrollTop = 450;
		
	}
}
