function popup (a,b,x,y,s) {
	window.open (a,b,'width=' + x + ',height=' + y + ',resizable=0,status=0,menubar=0,scrollbars='+s);
}

function modelo(mod){
	for (i_radio=0;i_radio<document.frm_mod.mod.length;i_radio++){
		if (document.frm_mod.mod[i_radio].checked){
			document.frm_mod.fr_txt.value=i_radio;
			if(!mod){
				popup('pop_modelo.asp?mod='+i_radio+'', 'pop1',697,440,1);
			}else{popup('pop_modelo_roteiro.asp?mod='+i_radio+'', 'pop1',697,450,1);}
		}
	}
}

function surfto(form) {
	var myindex=form.select1.selectedIndex;
	if (form.select1.options[myindex].value != 0)
	{ location=url+form.select1.options[myindex].value}
	return false;
}

function pesquisa(){

	if (document.frm_talao.talao.value.length==0){
		alert("você precisa digitar o número do talão !");
		return false;
	}
	
	v_t=document.frm_talao.talao.value;
	

	popup('pop_resposta.asp?talao='+v_t+'','pop1',470,350,1);
}

function d_mod(v_doc){
	v_doc=(document.frm_doc.fr_doc.value);
	popup('pop_doc_reg.asp?doc='+v_doc+'','pop1',350,350,0); 
} 


function check(keyPressed)     {
       if (event.keyCode == 13 ) 
        {
              pesquisa();
       }
}


function gerap() {
	ihtm = document.getElementById('htm').innerHTML;
	for(i=0;i<document.Print.elements.length;i++){
		ihtm = ihtm.replace(/<INPUT/,document.Print.elements[i].value + "<I");
	}
	document.getElementById('htm').innerHTML = ihtm;
	window.print();
}


function converteTX() {

	tx = document.getElementById('htm').innerHTML;
	txt = tx;
	txp = 0;
	for(var i=0;i<tx.length;i++){
		if(tx.charAt(i)=='.') {
			txp++;
		} else {
			if(txp>3){
				str = '';
				for(var j=0;j<txp;j++) str+='.';			
				txt = txt.replace(str,'<input type="text" style="width:' +(txp*5)+ 'px">');
			}
			txp = 0;
		}
	}
	document.getElementById('htm').innerHTML = txt;
}


 function frmSubmit() {
		
	merro = "";

	if(document.frm.nome.value.length < 1) merro += "· Nome\n";	
	if(document.frm.mail.value.length < 1) merro += "· E-mail\n";	
	if(document.frm.assunto.value.length < 1) merro += "· Assunto\n";	
	if(document.frm.texto.value.length < 1) merro += "· Mensagem\n";	
	if(merro.length > 1) {
		alert("Os campos abaixo são de preenchimento obrigatório.\nPor favor, preencha-os corretamente:\n\n"+merro);
		return false;
	}
	return true;
} 