function ModuloIndique(codproduto)
{
	novoBox('modulos/indique/cadIndique.php?codproduto='+codproduto, '', 400, 250);	
}

function enviarFormIndique(){
	var form = document.getElementById('cadIndique');
	
	if (gtr_submit('cadIndique', 'false'))  { 
		var ajax = new sack();
		
		ajax.setVar('nn_desnome', form.nn_desnome.value);
		ajax.setVar('nn_codproduto', form.nn_codproduto.value);
		ajax.setVar('nn_emlemail', form.nn_emlemail.value);
		ajax.setVar('nn_desnome_destinatario1', form.nn_desnome_destinatario1.value);
		ajax.setVar('nn_emlemail_destinatario1', form.nn_emlemail_destinatario1.value);

		ajax.requestFile = 'modulos/indique/manIndique.php';
		ajax.method = 'POST';
		ajax.element = 'modulo_indique';
		ajax.onLoading = function (){
			var e = document.getElementById('modulo_indique'); 
			e.innerHTML = "<p>Enviando dados...</p>";
		};
		ajax.onLoaded = function (){
			var e = document.getElementById('modulo_indique'); 
			e.innerHTML = "<p>Dados enviado...</p>";
		};
		ajax.onInteractive = function (){
			var e = document.getElementById('modulo_indique'); 
			e.innerHTML = "<p>Recebendo dados...</p>";
		};
		ajax.onCompletion = function (){
			var e = document.getElementById('modulo_indique'); 
			if (ajax.responseStatus && ajax.responseStatus[0] == 200){
				var string =  ajax.response;
			} else {
				var string = "<p>Erro inesperado, tente novamente.</p>";
			}
			e.innerHTML = string;	
		};
		ajax.runAJAX();
	}
}

function valida_regulamento(chk){
	if(chk.checked){
		chk.value = 'SIM';
	} else {
		chk.value = '';
	}
}

function validaRegulamento(form){
	if(form.nu_sonregulamento_chk.checked){
		form.nn_sonregulamento.options[1].selected = true; 
	} else {
		form.nn_sonregulamento.options[0].selected = true; 
	}
}
