/*
 * @author	Johan
 * --------------------
*/

function checkAmount(div,minAmount,totAmount)
{
	if(isNaN(totAmount) || totAmount<=0)
	{
		totAmount=0;
	}
	if (totAmount==0 && window.location.href.indexOf("orderForm")!=-1)
	{
		var fieldnumber=div.substring(3,5);
		var reference=document.getElementById("num"+fieldnumber).innerHTML.substring(4).replace("-","");
		loadFile("post", "/includes/removeFromCaddy.php", "remAward=0&remRef="+reference, "", "reloadCaddy" );
	}
	else
	{
		var times=Math.floor(totAmount/minAmount);
		var newAmount=times*minAmount;
		if(totAmount!=newAmount)
		{
			startAlert(7, { "minAmount": minAmount, "newAmount":  newAmount });
			document.getElementById(div).value=newAmount;
		}
	}
}