var CONST_ACEITAR	= 40;
var CONST_IMPRIMIR	= 31;
var URL_Aceitar = "cadonline.cgi";

function MM_findObj(n, d) { //v4.0
	var p,i,x;  
	
	if(!d) d=document; 
	
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}

  	if(!(x=d[n])&&d.all) x=d.all[n]; 
	
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  	
	if(!x && document.getElementById) x=document.getElementById(n); 
	
	return x;
}


function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	
	for (i=0; i<(args.length-2); i+=3) 
		if ((obj=MM_findObj(args[i]))!=null) { 
			v=args[i+2];
    		if (obj.style) { 
				obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; 
			}
    	obj.visibility=v; 
	}
}


//script by Rodrigo Roesler
function pula(obj1, dest, num) {
	
	if (obj1.value.length==num) {
		obj2=obj1.form;
		destino=eval("obj2."+dest);
		destino.focus();
	}
}

		
function chatOnline() {
	var foto = window.open("","janela","width=420,height=420,resizable=no,toolbar=0,location=0,directories=0,status=no,menubar=0");
    setTimeout ("document.dados.submit();",10);
}

function abre(url,janela,larg,alt,scroll){
	window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars="+scroll+",resizable=no,copyhistory=no,width="+larg+",height="+alt);
}

function help(campo) {
	janela=window.open("help/help_" + campo + ".html","isbt","scrollbars=no,menubar=no,statusbar=no,personal=no,width=250,height=300");
}

function hotsite(html){
	remote = window.open(html,'hotsite','left=10,top=10,width=550,height=515,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no');
}

function Envia() {
	if (validaForm(document.frmTela)){                                                                        
		document.frmTela._wc.value 			= VmParam[CONST_ACEITAR].wc;              
		document.frmTela.operacao.value   	= VmParam[CONST_ACEITAR].op;                      
		document.frmTela.target   			= "_top";                                 
		document.frmTela.action   			= URL_Aceitar;
		document.frmTela.method 			= "post";                                                                                                                                                   
		document.frmTela.submit();                                                                       
	}
}