// JavaScript Document

// GameRacer Delivery Codes and Pricing
var DELGBRGRCLUB01 = 12.77;
var DELGBRGRCLUB02 = 17.01;
var DELGBRGRCLUB03 = 17.02;
var DELGBRGRPRO01 = 10.21;
var DELGBRGRPRO02 = 10.21;
var DELGBRGRPRO03 = 10.21;
var DELGBRACDFSWPS2 = 8.51;
var DELGBRACTMSTXB1 = 8.51;


//Formats a value in 0.00 format.
//Optionally prepends a £
function formatPrice(pPrice, pAddPound)
{
	// Return nothing if not passed a number
	if (isNaN(pPrice)) return "";
	
	// Mulitply by 100 and round off to remove unwanted precision
	var sPrice = "" + Math.round(100 * pPrice);
	
	// Fix for small prices
	if (sPrice.length == 1)
		sPrice = "00" + sPrice;
	else if (sPrice.length == 2)
		sPrice = "0" + sPrice;
	
	// Put last 2 digits after a decimal point
	var sFormattedPrice = sPrice.substr(0, sPrice.length - 2) + "." + sPrice.substr(sPrice.length - 2);
	
	// Add the £ sign
	var bAddPound;
	if (formatPrice.arguments.length == 2)
	{
		bAddPound = new Boolean(pAddPound);
	}
	else
	{
		bAddPound = false;
	}
	if (bAddPound) sFormattedPrice = "£" + sFormattedPrice;
	
	// Return
	return sFormattedPrice;
}	