// visita randômica
function random(url,janela,larg,alt,scroll,pos1,pos2){
window.open(url,janela,"toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars='+scroll+',resizable=yes,copyhistory=yes,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}
// ajuda abre
function ajuda(url,janela,larg,alt,scroll,pos1,pos2){
window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}
// janelas abre
function abre(url,janela,larg,alt,scroll,pos1,pos2){ 
window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=no,copyhistory=no,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}
//show hide layers v4.0
function MM_findObj(n, d) { 
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;
}
//show hide layers v3.0
function MM_showHideLayers() { 
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; }
}
//limitador caracteres
function CheckLen(Target) {
	StrLen = Target.value.length;

	maxLeght = 4000

	if (StrLen > maxLeght ) {
		Target.value = Target.value.substring(0,( maxLeght-1 ));
		CharsLeft = 0;
	}
	else {
		CharsLeft = maxLeght - StrLen;
	}
	document.Main.CharsLeft.value = CharsLeft;
}
//tratamento da imagem
function muda(elemento,alt,minimo,maximo) {
	var valor;
	field = document.opers[elemento];
	if (field.value.length > 0){
		valor = 0 + parseInt(field.value) + alt;
	} else {
		valor = alt;
	}	
	if (valor > maximo){
		valor = valor - (maximo-minimo);
	} else if (valor < minimo){
		valor = valor + (maximo-minimo);
	}
	field.value = ''+valor;
	document.opers.submit();
};
//preload de imagens
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}