//Recalcalculate
function currencyFormat(amount)
{
 amount += "";
 var x = amount.split('.');
 var x1 = x[0];
 var x2 = x.length > 1 ? "." + x[1] : "";
 var rgx = /(\d+)(\d{3})/;

 while (rgx.test(x1)) {
  x1 = x1.replace(rgx, "$1" + "," + "$2");
 }

 return x1 + x2;
}


function centFormat(amount) 
{
    amount -= 0;
    
    return (amount == Math.floor(amount)) ? amount + '.00' : ((amount * 10 == Math.floor(amount * 10)) ? amount + '0' : amount);
}

function RoundOff(x, y) 
{
    var scale = Math.pow(10, y);
    
    return Math.round(x * scale) / scale;
}
function calculate()//recalculate function
{	
	var CartList = GetCookie(WishCartName).split('|');
	var total= 0;
	var amt = 0;
	
	for (var cntr = 0; cntr < CartList.length; cntr++)
	{			
		var item = CartList[cntr].split(':');
		amt = (item[1] * 1) * item[2];
		total = total + (item[1] * 1) * item[2];
		
		document.getElementById("amt"+cntr).innerHTML = "$ " + currencyFormat(centFormat(RoundOff(amt,2)));;
	}
	//document.getElementById('DIVtotal').innerText = currencyFormat(centFormat(RoundOff(total,2)));
	document.getElementById("DIVtotal").innerHTML = "Total Amount $ " + currencyFormat(centFormat(RoundOff(total,2)));;
	
}
//end recalculate
//create div inner HTML
