function getCookie(name){
var cookie,list,i,equals,match;
cookie=document.cookie;
if(cookie.length==0){
return '';
}

else{
list=cookie.split(';');
for(i=0;i<list.length;i=i+1){
equals=list[i].indexOf('=');
match=list[i].substring(0,equals);
if(match.substr(0,1)==' '){
match=match.substr(1);
}
if(match==name){
return list[i].substring(equals+1,list[i].length);
}
}
return '';
}
}

var c=getCookie("count");
var st=getCookie("subtotal");
if (c.length==0)
{
document.write("<div class='cookClass'>0&nbsp;|&nbsp;$0.00</div>");
}
else{
document.write("<div class='cookClass'>"+c+"&nbsp;|&nbsp;"+st+"</div>");
}

function formatCurrency(num) {num = num.toString().replace(/\$|\,/g,'');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);}

Number.prototype.formatMoney = function(c, d, t){
	var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
	return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};

var tfs;

tfs = 100 - (st.split('$').join(''));

$(document).ready(function(){
if (c.length==0)
{
$(".shippingNotification").append("Spend $100 More & Get Free Shipping!");
}
else
{
if (tfs > 0)
{
$(".shippingNotification").append("Spend "+formatCurrency(tfs)+" More & Get Free Shipping!");
}
else
{
$(".shippingNotification").append("You are Eligible for Free Shipping!");
}
}
});