function imgOn (imgId)
{
	document.getElementById(imgId).src = "gui/" + imgId + "_over.gif";
}


function imgOff (imgId)
{
	document.getElementById(imgId).src ="gui/" + imgId + ".gif";
}

function imgOnM(img, ID, bEdit)
{
	var sPrefix = "";
	if (bEdit)
	{
		sPrefix = "../";
	}
	document.getElementById(img + ID).src = sPrefix + "gui/" + img + "_i.gif";
}


function imgOffM(img, ID, bEdit)
{
	var sPrefix = "";
	if (bEdit)
	{
		sPrefix = "../";
	}
	document.getElementById(img + ID).src = sPrefix + "gui/" + img + "_o.gif";
}

// Note: Used to disable a link in admin.
function NotAvailable(x)
{
}

//Check if the cart is Empty, if it is empty then customer cann't fill the finalise form
//And Check if total price of the order is less than minimum purchase.
function CheckCart(NumOfTotalItems, MinimumOrderAmount, TotalAmountWithGST)
{
	if (parseFloat(NumOfTotalItems) == 0) 
	{
		alert('Your shopping cart is empty.\r\nPlease place an order first.');
		return false;
	}
	
	if(parseFloat(TotalAmountWithGST) < parseFloat(MinimumOrderAmount))
	{
		alert('Minimum order is ' + formatCurrency(MinimumOrderAmount));
		return false;
	}
	
	return true;
}


function formatCurrency(num) 
{
	num = num.toString().replace(/\$|\,/g,'');	// Remove $ and ,

	if (isNaN(num))
	{
		num = "0";
	}

	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num * 100 + 0.50000000001);
	cents = num % 100;
	num = Math.floor(num / 100).toString();
	if (cents < 10)
	{
		cents = "0" + cents;
	}
	for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
	{
		num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
	}
	return (((sign) ? '' : '-') + '$' + num + '.' + cents);
}
