function AtuPreco(strCdProd, oQtd)
{
	oPreco = window.document.getElementById("txth_AtuPreco");
	if(oQtd.value != null)
	{
		if(oQtd.value < 1)
		{
			oQtd.value = 1
		}
		else
		{
			oPreco.value = strCdProd;
			window.document.frmCarrinho.submit();
		}
	}
}

function FocTrat(strCampo)
{
	oCampo	= window.document.getElementById(strCampo);
	if( oCampo != null )
	{
		oCampo.focus();
	}
}

function ConfLimpCarr()
{
	if( confirm('Deseja excluir os itens do carrinho ?') )
	{
		oAcao = window.document.getElementById("txth_Acao");
		if( oAcao != null )
		{
			oAcao.value = "1"
			window.document.frmCarrinho.submit()
		}
	}
}

function VdEstoque(strCodProd, objQtd)
{
	oEstoque = window.document.getElementById('Est' + strCodProd);
	strMsg = "A quantidade não pode ser maior do que a disponível em nosso estoque.\n\nPara comprar quantidade maior, por favor, entre em contato com a nossa central de atendimento."
	if (oEstoque != null && objQtd != null)
	{
		if (parseInt(objQtd.value) > parseInt(oEstoque.value))
		{
			objQtd.value = oEstoque.value;
			alert(strMsg);
			//objQtd.focus();
			AtuPreco(strCodProd, objQtd)
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		return false;
	}	
}

function AltValor(valFrete,valTotal)
{
	el = window.document.getElementById("lblTotalComFrete");
	valFrete = valFrete.replace(".", "");
	valTotal = valTotal.replace(".", "");
	valFrete = valFrete.replace(",", ".");
	valTotal = valTotal.replace(",",".");
	valTotalComFrete = (parseFloat(valFrete) + parseFloat(valTotal));
	el.innerHTML = ("R$ " + valTotalComFrete.toFixed(2) ).replace(".",",");
}

function ConfAcao(strPergunta, strPagina)
{
	if(strPergunta != ' ')
	{
		if( confirm(strPergunta) )
		{
			if(strPagina)
			{
				location.replace(strPagina); 
			}
		}
		else
		{
			window.status = '';
		}
	}
	else
	{
		if(strPagina)
		{
			location.replace(strPagina); 
		}	
	}
}

