<!--

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+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' tem preenchimento obrigatórios.\n'; }
  } if (errors) alert('Ocorreram os seguintes erros:\n'+errors);
  document.MM_returnValue = (errors == '');
}

	// -------------------------------------------------------
	// Form validation
	function validaForm(f){
		for (i=0 ; i<f.length ; i++){        
			e = f.elements[i];
			str = e.title.split(";");
			//if (e.title=="Campo Obrigatório" && e.value == ""){
			if (str[1]=="Campo Obrigatório" && e.value == ""){
				alert("O campo "+str[0]+" deve ser preenchido");
				e.focus();
				return (false);
			} 
			e = null;
		}
		return(true);
	}
	
	// E-Mail validation
	function validaMail(emailId){
		var email = document.getElementById(emailId);
		if(email.value!=""){
			if (email.value.indexOf("@") <= 0 || email.value.indexOf(".") <= 0){
				alert("Formato do e-mail inválido.")
				email.focus()
				return (false);
			}
		}
		return (true);
	}

	// -------------------------------------------------------
	// only numbers
    function onlyNumbers(evt) {
      var charCode = (evt.which) ? evt.which : evt.keyCode
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        alert("Apenas números")
        return false
      }
      return true
    }
    
	// -------------------------------------------------------
	// only RGB values
    function onlyRGB(evt) {
      var charCode = (evt.which) ? evt.which : evt.keyCode
      if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 65 || charCode > 70) && (charCode < 97 || charCode >102) ) {
        //alert("Please make sure entries are numbers only.")
        return false
      }
      return true
    }
    

    // -------------------------------------------------------
    // only numbers
    function checkNumber(evt) {
      var charCode = (evt.which) ? evt.which : evt.keyCode
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        //alert("Please make sure entries are numbers only.")
        return false
      }
      return true
    }
	// -------------------------------------------------------
	function validaCep(c,evt){
		if(checkNumber(evt)){
			if(c.value.length==5) c.value=c.value.slice(0,5)+"-"+c.value.slice(5,c.value.length);
			return true;
		}else{return false;}
	} 
		




function popupUC(pg,nome,w,h,s){//popUp Unico Central
	var x; 	var y;
	x = (screen.width-w)/2;	y = (screen.height-h)/2;	
	window.open(pg,nome,'scrollbars='+s+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+w+',height='+h+',left='+x+',top='+y+',window.focus( )');	
		
}

//-->