function 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=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];}}
}
function alternar(objeto){
        estado = objeto.style.display;
		objeto.style.display = (estado == "block") ? "none" : "block";
}
function fecha_menu(nome,qt) {
	for (i=1;i<=qt;i++) {
		objeto = document.getElementById(nome + i);
		objeto.style.display = "none";
	}
}
function limita(field,validos) {
	var valid = "" + validos
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	field.value = field.value.substring(0, field.value.length-1);
	field.focus();
   }
}

function valtexto(campo) {
	campo.style.backgroundColor="";
	campo.style.borderWidth="";
	if (campo.value == ""){
		campo.style.backgroundColor="#ffbbbb";
		campo.style.borderWidth="1";
		campo.focus();
		return 1;
	}
}
function valselect(campo) {
	campo.style.backgroundColor="";
	campo.style.borderWidth="";
	if (campo.selectedIndex == 0){
		campo.style.backgroundColor="#ffbbbb";
		campo.style.borderWidth="1";
		campo.focus();
		return 1;
	}
}
function valemail(campo) {
	campo.style.backgroundColor="";
	campo.style.borderWidth="";
	var mail=campo.value;
    apos=mail.indexOf("@");
	dotpos=mail.lastIndexOf(".");
	if (apos<1||dotpos-apos<2) {
		campo.style.backgroundColor="#ffbbbb";
		campo.style.borderWidth="1";
		campo.focus();
		return 1;
	}
}
function valradio(campo) {
	for (var x=campo.length-1; x > -1; x--) {
			campo[x].style.backgroundColor="";
    }
    var cnt = -1;
    for (var i=campo.length-1; i > -1; i--) {
        if (campo[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) {
		return 0;
	}
    else {
		for (var v=campo.length-1; v > -1; v--) {
			campo[v].style.backgroundColor="#ff0000";
    	}
		return 1;
	}
}