function float2moeda(num) {

   x = 0;

   if(num<0) {
      num = Math.abs(num);
      x = 1;
   }
   
   if(isNaN(num)) num = "0";
      cents = Math.floor((num*100+0.5)%100);

   num = Math.floor((num*100+0.5)/100).toString();

   if(cents < 10) cents = "0" + cents;
      for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
         num = num.substring(0,num.length-(4*i+3))+'.'
               +num.substring(num.length-(4*i+3));
	
	ret = num + ',' + cents;
	
	if (x == 1) ret = ' - ' + ret;return ret;
}

function validaContato(){
	
	var erro = 0;
	var msg = new Array();
	var index = 0;
	
	if(document.form_contato.nome.value==""){
		erro = 1;
		msg[index++] = "Nome"; 
	}
	if(document.form_contato.telefone.value==""){
		erro = 1;
		msg[index++] = "Telefone de Contato"; 
	}
	if(document.form_contato.email.value==""){
		erro = 1;
		msg[index++] = "E-mail"; 
	}
	if(document.form_contato.comentario.value==""){
		erro = 1;
		msg[index++] = "Comentário"; 
	}
	if(erro == 1){
		geraAlert(msg);
		return false;
	} else{
		document.form_contato.submit();
	}
}

function geraAlert(msg){
	var returnMessage = "Por favor, confira os seguintes campos obrigatórios: \n";
	for(var i=0; i < msg.length; i++){
		returnMessage += "-"+msg[i]+"\n";
	}
	alert(returnMessage);
}
