// JavaScript Document
function validaForm(FM){
	if(naoPreench(FM.nome,'Informe seu nome'))return false;
	if(naoEmail(FM.email))return false;
	if(naoChecked(FM.lstDestinarios,'Informe o destinatário'))return false;
	if(FM.lstDestinarios[0].checked){
		if(naoPreench(FM.destinario,'Selecione o destinatário'))return false;
		if(naoChecked(FM.vinculo,'Informe sua relação com a instituição'))return false;
		if(FM.vinculo[0].checked || FM.vinculo[1].checked)
			if(naoPreench(FM.matricula,'Informe o número da matrícula'))return false;
	}
	if(naoPreench(FM.assunto,'Informe o assunto da mensagem'))return false;
	if(naoPreench(FM.mensagem,'Mensagem sem texto'))return false;
}
function shNMatricula(){
	var vncl = document.contato.vinculo
	if(!vncl[0].checked && !vncl[1].checked) shObj('dspNM','h');
	else shObj('dspNM','s');
}
function shVOutro(){
	var vncl = document.contato.vinculo
	if(!vncl[4].checked) shObj('dspOutraRelacao','h');
	else shObj('dspOutraRelacao','s');
}
function lstInst(lst){
	var dstnt = document.contato.destinario;
	dstnt.disabled = true;
	dstnt.options[dstnt.selectedIndex].text='Carregando lista. Aguarde...';
	document.getElementById('actionLstDest').src='lista_contatos.asp?lst='+lst.value+'&rnd='+new Date().getTime();
	if(lst.value==1){
		shObj('relacao','s');
		shNMatricula();
		shVOutro()
	}else{
		shObj('dspNM','h');
		shObj('relacao','h');
		shObj('dspOutraRelacao','h');
	}
}
function carregaLista(str){
	document.getElementById('lstInstuicoes').innerHTML=str;
}
function iniLista(){
	var lista = document.contato.lstDestinarios[0];
	lista.checked = true;
	lstInst(lista);
}
addEvent(window,"load",iniLista)