<!--

		
		//Checa preenchimento
		function funLetras(valor) {
			resp = "";
			for (var i=0;i<valor.length;i++) {
				if (valor.charAt(i) != " ") {
					resp = "false";
				}
			}
			if (resp == "false") {
				return false;
			} else {
				return true;
			}	
		}

		//Checa preenchimento
		function funValidacao(campo,mensagem) {
			if (campo.value == "") {
				alert("Favor preencher o campo " + mensagem + "!");
				campo.focus();
				return true;
			} else {
				if (funLetras(campo.value)) {
					alert("Favor preencher o campo " + mensagem + "!");
					campo.focus();
					return true;		
				}
			}
		}

		//Checa EMAIL
		function verifica(email) {
				var achou_ponto=false;
				var achou_arroba=false;
				var achou_caracter=false;
				for (var i=0; i<email.length; i++) {
						if (email.charAt(i)=="@") achou_arroba=true;
						else if (email.charAt(i)==".") achou_ponto=true;
						else if (email.charAt(i)!=" ") achou_caracter=true;
				}
				return (achou_ponto & achou_arroba & achou_caracter);
		}

		menu_status = new Array(); 

		function showHide(theid){
			if (document.getElementById) {
			var switch_id = document.getElementById(theid);

				if(menu_status[theid] != 'show') {
				   switch_id.className = 'show';
				   menu_status[theid] = 'show';
				}else{
				   switch_id.className = 'hide';
				   menu_status[theid] = 'hide';
				}
			}
		}

		function showon(theid){
			if (document.getElementById) {
			var switch_id = document.getElementById(theid);
			   switch_id.className = 'showon';
			   menu_status[theid] = 'showon';
			}
		}


		function show(theid){
			if (document.getElementById) {
			var switch_id = document.getElementById(theid);
			   switch_id.className = 'show';
			   menu_status[theid] = 'show';
			}
		}


		function hide(theid){
			if (document.getElementById) {
			var switch_id = document.getElementById(theid);
			   switch_id.className = 'hide';
			   menu_status[theid] = 'hide';
			}
		}

		function switchClass(obj,strClassName) {
		 obj.className = strClassName;
		}

		function MM_reloadPage(init) {  //reloads the window if Nav4 resized
		  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
		  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		}
		MM_reloadPage(true);

		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_validateForm() { //v4.0
		  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
		  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
			if (val) { nm=val.name; if ((val=val.value)!="") {
			  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
				if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve conter um endereço de e-mail.\n';
			  } else if (test!='R') {
				if (isNaN(val)) errors+='- '+nm+' deve conter um número.\n';
				if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
				  min=test.substring(8,p); max=test.substring(p+1);
				  if (val<min || max<val) errors+='- '+nm+' deve conter um número entre '+min+' e '+max+'.\n';
			} } } else if (test.charAt(0) == 'R') errors += '» '+nm+' é de preenchimento obrigatório.\n'; }
		  } if (errors) alert('Os seguintes erros aconteceram:\n'+errors);
		  document.MM_returnValue = (errors == '');
		}

		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; }
		}

		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];}}
		}

		function MM_swapImgRestore() { //v3.0
		  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
		}

		function MM_swapImage() { //v3.0
		  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
		}

		function abre_popup(theURL,winName,features) { //v2.0
		  window.open(theURL,winName,features);
		}

//Checa CPF
function DFcheckCpf(v){
	var s=null
	var r=null
	if(v.length!=11||
		v=='00000000000'||v=='11111111111'||v=='22222222222'||v=='33333333333'||v=='44444444444'||
		v=='55555555555'||v=='66666666666'||v=='77777777777'||v=='88888888888'||v=='99999999999')return false
	s=0
	for(var i=0;i<9;i++)s+=parseInt(v.charAt(i))*(10-i)
	r=11-(s%11)
	if(r==10||r==11)r=0
	if(r!=parseInt(v.charAt(9)))return false
	s=0
	for(var i=0;i<10;i++)s+=parseInt(v.charAt(i))*(11-i)
	r=11-(s%11)
	if(r==10||r==11)r=0
	if(r!=parseInt(v.charAt(10)))return false
	return true
}

//Checa CNPJ
function valida_CNPJ(cnpj) {
	var i;
	cnpj = cnpj.replace(".", "");
	cnpj = cnpj.replace(".", "");
	cnpj = cnpj.replace("/", "");
	cnpj = cnpj.replace("-", "");
	var c  = cnpj.substr(0,12);
	var dv = cnpj.substr(12,2);

	  if (cnpj == "00000000000000") {
		 return false;
	  }

	  var d1 = 0;
	  var ms = "543298765432";

	for (i = 0; i < 12; i++) {
		d1 += c.charAt(i)*ms.charAt(i);
	}
	d1 = (d1 % 11);
	  if (d1 == 0 || d1 == 1) {
		 d1 = 0;
	  } else {
		 d1 = 11 - d1;
	  }

	  var d1 = 0;
	  var ms = "543298765432";

	for (i = 0; i < 12; i++) {
		d1 += c.charAt(i)*ms.charAt(i);
	}
	d1 = (d1 % 11);
	  if (d1 == 0 || d1 == 1) {
		 d1 = 0;
	  } else {
		 d1 = 11 - d1;
	  }

	  var c = c + d1;

	  var d2 = 0;
	  var ms = "6543298765432";
	for (i = 0; i < 13; i++) {
		d2 += c.charAt(i)*ms.charAt(i);
	}
	d2 = (d2 % 11);
	  if (d2 == 0 || d2 == 1) {
		 d2 = 0;
	  } else {
		 d2 = 11 - d2;
	  }

	if (dv.charAt(0) != d1 || dv.charAt(1) != d2) {
		return false;
	}
	  return true;
}

//Muda de campo após atingir o tamanho máximo
function DFchangeField(f){
	if(f.value.length==f.maxLength){
  	for(var i=0;i<f.form.length;i++){
    	if(f.form[i]==f&&f.form[i+1]){f.form[i+1].focus();break}
		}
	}
}

//Permitir apenas números
function DFonlyThisChars(numbers,letters,others,e){
	if(window.event)key=window.event.keyCode
	else if(e)key=e.which
	else return true
	S=(others)?others:''
	if(numbers)S+='0123456789'
	if(letters)S+='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	if(key==null||key==0||key==8||key==9||key==13||key==27)return true
	else if(S.indexOf(String.fromCharCode(key))!=-1)return true
	else return false
}
//-->
