<!--
function valida(f){
	var erro = "";
	f.email.value = f.email.value.replace( /^\s+|\s+$/g, "");
	var emailRe = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if((!(emailRe.test(f.email.value)))||(f.email.value == "")||(f.email.value == f.email.defaultValue)){
		erro += "Seu e-mail parece inválido\n";
	}
	f.sugestao.value = f.sugestao.value.replace( /^\s+|\s+$/g, "");
	if((f.sugestao.value == "")||(f.sugestao.value == f.sugestao.defaultValue)){
		erro += "Você precisa escrever uma mensagem\n";
	}
	f.nome.value = f.nome.value.replace( /^\s+|\s+$/g, "");
	if((f.nome.value == "") || (f.nome.value == f.nome.defaultValue)){
		erro += "Você precisa inserir seu nome\n";
	}
	if(erro != ""){ 
		erro = "Houveram alguns erros, por favor verifique:\n" + erro;
		alert(erro);
		return false;
	}else{
		f.enviar.value = true;
		return true; 
	}
}
function limpacampo(divid) {
	var div = "ajax["+divid+"]";
	$(div).innerHTML = '';
	document.fire('start:dom');
}
function colocacampo(id,divid,tipo) {
	var id = id;
	var divid = divid;
	var tipo = tipo;
	var div = "ajax["+divid+"]";
	var url = 'pega.php';
	var pars = 'acao=' + tipo + '&id=' + id;
	var myAjax = new Ajax.Updater(div,url,{method: 'get',parameters: pars, onComplete:function() {document.fire('start:dom');}});
}

//mostra mensagem na página, como por exemplo, o campeonato que o animal irá participar
function colocacat(data,especie,raca,sexo,divid,tipo) {
	var data = data;
	var especie = especie;
	var raca = raca;
	var sexo = sexo;
	var divid = divid;
	var tipo = tipo;
	var div = "ajax["+divid+"]";
	var url = 'pega.php';
	var pars = 'acao=' + tipo + '&data=' + data + '&especie=' + especie + '&raca=' + raca + '&sexo=' + sexo;
	var myAjax = new Ajax.Updater(div,url,{method: 'get',parameters: pars});
}
function escrevehtml(div,conteudo) {
	$(div).update(conteudo);
}
function toggleBox(id, display) {
	// DOM3 = IE5, NS6
	if (document.getElementById) {
	document.getElementById(id).style.display = display;
	// Netscape 4
	} else if (document.layers) {
	document.layers[id].display = display;
	// IE 4
	} else if (document.all) {
	document.all[id].style.display = display;
	}
}
function selectChange1() {
	if(document.forms[0].especie.selectedIndex != '0') {
   window.location='fazer_inscricao.php?especie='+document.forms[0].especie.options[document.forms[0].especie.selectedIndex].value;
	}
}
function selectChange2() {
	if(document.forms[0].raca.selectedIndex != '0') {
   window.location='fazer_inscricao.php?especie='+document.forms[0].especie.options[document.forms[0].especie.selectedIndex].value+'&raca='+document.forms[0].raca.options[document.forms[0].raca.selectedIndex].value;
	}
}
function selectChange3(sexo) {
	if(document.forms[0].sexo.selectedIndex != '0') {
   window.location='fazer_inscricao.php?especie='+document.forms[0].especie.options[document.forms[0].especie.selectedIndex].value+'&raca='+document.forms[0].raca.options[document.forms[0].raca.selectedIndex].value+'&sexo='+sexo;
	}
}
function selectChange4(aptidao) {
	if(document.forms[0].aptidao.selectedIndex != '0') {
   window.location='fazer_inscricao.php?especie='+document.forms[0].especie.options[document.forms[0].especie.selectedIndex].value+'&raca='+document.forms[0].raca.options[document.forms[0].raca.selectedIndex].value+'&sexo='+document.forms[0].sexo.options[document.forms[0].sexo.selectedIndex].value+'&aptidao='+aptidao;
	}
}
function pagina(pagina) {
	window.location=pagina;
}
function mkp(pg,name,w,h,scrollb) {
	return window.open(pg,name,'width='+w+',height='+h+',scrollbars='+scrollb+',toolbar=0,resizable=0,top=10,left=10');
}
// Aqui definimos o tempo para fechar o pop-up
function abrir(){
	mkp('popup.php','popup',400,393);
}

//alterna CPF/CNPJ na página de cadastro do expositor
function alternaCpfCnpj(qual){
	document.getElementById('campo_cpf').style.display = 'none';
	document.getElementById('campo_cnpj').style.display = 'none';
	document.getElementById('campo_'+qual).style.display = 'block';
}

//pega valor de radiobuttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

//função chamada ao enviar formulário de login
function fazLogin(form){
	form.login.value = form[getCheckedValue(form.cpfOuCnpj)].value;
	return true;
}

//função que testa se os campos de regulamento estão marcados
function testaRegulamento(form){
	msg = "";
	if(!form.regulamento1.checked){
		msg += "Você deve estar de acordo com o regulamento das inscrições\n";
	}
	if(!form.regulamento2.checked){
		msg += "Você deve estar de acordo com o regulamento geral da Expofeira\n";
	}
	if(msg == ""){
		return true;
	}else{
		alert(msg);
		return false;
	}
}

//testa se há bloqueador de pop-ups habilitado.
function testaPopUp(){
	//var Janela = window.open('', '', '');
	var Janela = mkp('','','','','');
	if(Janela==null){
		return false;
	}else{
		Janela.close();
		return true;
	}
}

// -->