// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function calculate_fees()
{
	price = parseInt($('product_price').value) + parseInt($('product_shipping_cost').value);
	$('total_fees').innerHTML = Math.round(payson_fee(price) + our_fee(price)) + "kr, varav " + Math.round(payson_fee(price)) + " kr går till Payson.";
}

function payson_fee(price)
{
	return 3 + price * 0.03;
}

function our_fee(price)
{
	t = price * 0.05;
	if(t < 10)
	{
		t = 10;
	}
	if(t > 100)
	{
		t = 100;
	}
	return t;
}