function envia(a)
    {
        document.location=a;
    }

function digito(evt)
	{
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46)
            return false;

         return true;
	}
function inteiro(campo)
	{
		valor=parseInt(campo.value);
		if (isNaN(valor)){valor=0};
		campo.value=parseInt(valor);
	}

function comprar(campo,frm)
	{
        document.forms[frm].elements[campo].value++;
        //alert(document.forms[frm].elements[campo].value);
        document.forms[frm].submit();
               /*
		valor=parseInt(campo.value);
		if (isNaN(valor)){valor=0};
		campo.value=parseInt(valor);*/
	}
function posiciona_menu()
    {
      if(document.getElementById('mm1'))
        {
            document.getElementById('mm1').style.left=findPosX(document.getElementById('m1'))+"px";
            document.getElementById('mm1').style.top=(findPosY(document.getElementById('m1'))+32)+"px";
        }
    }
    
function mostra_submenu(a)
	{
        posiciona_menu();
		document.getElementById(a).style.display = 'block';
	}
function esconde_submenu(a)
	{
		document.getElementById(a).style.display = 'none';
	}
function findPosY(obj)
{
	if(obj)
		{
			var curtop = 0;
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			}
			else if (obj.y)
				curtop += obj.y;
			return curtop;
		}
}
function findPosX(obj)
{
	if(obj)
		{
			var curleft = 0;
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curleft += obj.offsetLeft
					obj = obj.offsetParent;
				}
			}
			else if (obj.x)
				curleft += obj.x;
			return curleft;
		}
}

