function DisplayRollCost(inputAmount,displayLabelName,rollLength,cutPrice,rollPrice){
	var totalCost;
	if (inputAmount >= rollLength){
		totalCost = "&pound;" + format(rollPrice * inputAmount);
	}
	else{
		totalCost = "&pound;" + format(cutPrice * inputAmount);
	}
	
	document.getElementById(displayLabelName).innerHTML = totalCost;
}


   
function format(num)
{
	if(isNaN(num))
		num = 0;
		
	var dol = Math.floor(num).toString();
	var cents = Math.floor((num*100+.5)%100).toString();

	for (var i = 0; i < Math.floor((dol.length-1)/3)-i; i++)
		dol = dol.slice(0,-(4*i+3))+','+dol.slice(-(4*i+3));

	if (cents.length == 0)
	{
		cents = "00"; 
	}
	else if (cents.length==1)
	{
		cents = "0" + cents;
	}
	return dol+"."+cents;
}    

function FindProduct(inputControl){
	var inputCtrl = document.getElementById(inputControl);
	var cpId = inputCtrl.value;
	document.location = "\quickbuy.aspx?cpId=" + cpId;
}
