﻿listaTamanhos = Array('M','G','GG','EXG');
		
function imprimir(){
	if (!window.print){
		alert("Use o Netscape  ou Internet Explorer \n nas versões 4.0 ou superior!")
	return
	}
	window.print();
}

function ImprimeBol(cod,pode){
	if(!pode){
		alert("Não é gerado boleto com este valor!");
		return;
	}
	window.open("pagamento.asp?acao=imprime&codparcela=" + cod)
}

function cancelaParticipante(codigo,nome) {
    if (confirm("Deseja realmente excluir o participante abaixo?\n\n"+nome)) {
        window.open("participante.asp?acao=cancela&codparticipante="+codigo,"_self");
    }
}



	  
	  
function entraQuant(e){
	var tecla = e.keyCode ? e.keyCode : e.charCode;
	return ( (tecla != 32) && ((tecla < 65) || (tecla > 95 && tecla < 106)) );
}

function ValidaDataHora(str) {
	var dataReg = '^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/(19|20)\\d\\d (20|21|22|23|[01]\\d)(([:][0-5]\\d){2})$';
	var regex = new RegExp(dataReg,'g');
	return regex.test(str);
}

function IsNumeric(Valor){
	var Auxi = new String;
	var Auxi2 = new String;

	Auxi=Valor;
	Auxi2="1234567890";
	
	if (Auxi == "") return false;

	for(x=0;x<Auxi.length;x++){
		if (Auxi2.indexOf(Auxi.charAt(x))<0){
			return false;
		}
	}
	return true;
}




function mudaTipoCamisa() {
	document.frm.tamanhocamisa.options.length = 1;
	switch(document.frm.tipocamisa.options[document.frm.tipocamisa.selectedIndex].value) {
	case '':
		break;
	case 'M':
		for(x=0; x<listaTamanhos.length; x++){
			var Option = document.createElement('option');
			var Texto = document.createTextNode(listaTamanhos[x]);
			Option.setAttribute('value', listaTamanhos[x]);
			Option.appendChild(Texto);
			document.frm.tamanhocamisa.appendChild(Option);
		}
		break;
	case 'F':
		var Option = document.createElement('option');
		var Texto = document.createTextNode('ÚNICO');
		Option.setAttribute('value', 'TU');
		Option.appendChild(Texto);
		document.frm.tamanhocamisa.appendChild(Option);
		break;
	}
}

function mudaHospedagem() {
	sHospedagem = document.frm.hospedagem.options[document.frm.hospedagem.selectedIndex].value;
	var subHospedagem = document.getElementById("subHospedagem");
	if (!subHospedagem) return;
	if (IsNumeric(sHospedagem)) {
		subHospedagem.style.display = '';
	} else {
		switch(sHospedagem) {
		case '':
			subHospedagem.style.display = 'none';
			break;
	
		case 'DI':
			subHospedagem.style.display = 'none';
			break;
			
		default:
			subHospedagem.style.display = '';
			break;
/*
		case 'SG':
			subHospedagem.style.display = '';
			break;
	
		case 'DM':
			subHospedagem.style.display = '';
			break;
	
		case 'CM':
			subHospedagem.style.display = '';
			break;
*/
		}
	}
}

function mudaCargo() {
	sCargo = document.frm.cargo.options[document.frm.cargo.selectedIndex].value;
	sHospedagem = document.frm.hospedagem;
	sPosuiSingle = false;

	for(i=0; i<sHospedagem.options.length; i++)
	{
		if(sHospedagem.options[i].value == 'SG')
			sPosuiSingle = true;
	}

	if(sCargo=='1')
	{
		if(!sPosuiSingle)
		{
			sCopia = [];
			for(i=1; i<sHospedagem.options.length; i++)
			{
				sCopia.push(new Option(sHospedagem.options[i].text, sHospedagem.options[i].value, false, false));
				sHospedagem.options[i] = null;
				i--;
			}

			sHospedagem.options[1] = new Option("Quarto Single", "SG", false, false);

			for(i=0; i<sCopia.length; i++)
			{
				sHospedagem.options[i+2] = sCopia[i];
			}
			sHospedagem.selectedIndex = 0;
		}
	}
	else
	{
		if(sPosuiSingle)
		{
			for(i=0; i<sHospedagem.options.length; i++)
			{
				if(sHospedagem.options[i].value == 'SG')
				{
					sHospedagem.options[i] = null;
					sHospedagem.selectedIndex = 0;
					break;
				}
			}
		}

	}
	/*
	sMenuTreinamento = document.getElementById('menuTreinamento');
	sSubTreinamento = document.getElementById('subTreinamento');
	sTreinamento = document.frm.treinamento;
	switch(sCargo) {
	case '':
	case '1':
		sMenuTreinamento.style.display = 'none';
		sSubTreinamento.style.display = 'none';
		break;
	case '2':
		sMenuTreinamento.style.display = '';
		sSubTreinamento.style.display = 'none';
		break;
	default:
		//Gerentes/outros – sempre habilitar treinamento
		sMenuTreinamento.style.display = 'none';
		sSubTreinamento.style.display = '';
		break;
	}
	sTreinamento[0].checked = false;
	sTreinamento[1].checked = false;
	*/
}

function mudaTraslado(valor)
{
	document.getElementById('subTraslado').style.display = (valor == 2 ? '' : 'none');
}


