   function validateField(field, div_validate) 
   {
   	   var fld = field;
	   var dv = div_validate;
	   if(document.getElementById(fld).value == '' || document.getElementById(fld).value == null){
		   var ni = document.getElementById(dv);
		   var newdiv = document.createElement('div');
		   newdiv.setAttribute('id',dv+'_child');
		   newdiv.setAttribute( 'style', 'width: 150px; background-color:#FF0000; color:#FFFFFF; font-weight:bold');
		   newdiv.innerHTML = 'Campo obrigatório!';
		   ni.appendChild(newdiv);
		   return false;
	   }else return true;
   }
   function cleanDiv(div_validate)
   {
   		var dv = div_validate; 	
	   	var d = document.getElementById(dv);   	  
	   	var olddiv = document.getElementById(dv+'_child');
	   	if(olddiv !=null){
	   		d.removeChild(olddiv);
	   	}
   }
   function formatar(mascara, documento){
	  var tecla = window.event.keyCode;
	  tecla     = String.fromCharCode(tecla);
	  if(!((tecla >= "0") && (tecla <= "9")))
	  {
		   window.event.keyCode = 0;
	  }
	  else{	  
		  var i = documento.value.length;
		  var saida = mascara.substring(0,1);
		  var texto = mascara.substring(i)
		  
		  if (texto.substring(0,1) != saida){
			documento.value += texto.substring(0,1);
		  }
	  }	  
	}