		function ehinteiro(str)
		{
		 var chartemp, i;
		 if (str.length == 0)
		 { 
		  return false;
		 }
		 else
		 {
		  for (i = 0; i < str.length; i++)
		  {
		   chartemp = str.substring(i, i + 1);
		   if (chartemp < "0" || chartemp > "9")
		   {
		    return false;
		   }
		  }
		  return true;
		 }
		}
		function ehnumero(str)
		{
		 var temponto, chartemp, i;
		 if (str.length == 0)
		 { 
		  return false;
		 }
		 else
		 {
		  if (str.substring(0, 1) == "," || str.substring(0, 1) == ".")
		  {
		   return false;
		  }
		  else
		  {
		   temponto = 0;
		   for (i = 0; i < str.length; i++)
		   {
		    chartemp = str.substring(i, i + 1);
		    if (chartemp < "0" || chartemp > "9")
		    {
		     if (chartemp != "." && chartemp != ",")
		     {
			return false;
		     }
		     else
		     {
			if (temponto == 0)
			{
			 temponto = 1;
			}
			else
			{
			 return false;
			}
		     }
		    }
		   }
		   return true;
		  }
		 }
		}
		function soma(campo, fracao)
		{
		 var i, novovalor, deltax;
		 novovalor = campo.value;
		 deltax = 1;
		 if (ehnumero(novovalor))
		 {
		  novovalor = novovalor.replace(",", ".");
		  i = parseFloat(novovalor);
		  if (fracao == 0)
		  { i = Math.round(i); }
		  else if (fracao == 2)
		  {
		   if (novovalor.substring(novovalor.length-2, novovalor.length) != ".5")
		   {
		    i = parseFloat(novovalor);
		    i = Math.round(i);
		   }
		   deltax = 0.5;
		  }
		  i = i + deltax;
		  novovalor = i.toString();
		  if (ehinteiro(novovalor) && fracao > 0)
		  {
		   novovalor = novovalor + ".0";
		  }
		  campo.value = novovalor;
		  
		 }
		 else
		 {
		  if (fracao == 1)
		  { campo.value = "1.0"; }  
		  else if (fracao == 2)
		  { campo.value = "0.5"; }
		  else
		  { campo.value = "1"; }
		 }
		}
		function subtrai(campo, fracao)
		{
		 var i, novovalor, deltax;
		 novovalor = campo.value;
		 deltax = 1;
		 if (ehnumero(novovalor))
		 {
		  novovalor = novovalor.replace(",", ".");
		  i = parseFloat(novovalor);
		  if (fracao == 0)
		  { i = Math.round(i); }
		  else if (fracao == 2)
		  {
		   if (novovalor.substring(novovalor.length-2, novovalor.length) != ".5")
		   {
		    i = parseFloat(novovalor);
		    i = Math.round(i);
		   }
		   deltax = 0.5;
		  }
	