/************************************************************************************
Menu Shopping Cart Summary
Shopping Cart Code
************************************************************************************/
function showItems() {
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) {
  		countend = document.cookie.length;
   	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	itemcount = 0;
	for (var i = 0; i <= fulllist.length; i++) {
		if (fulllist.substring(i,i+1) == '[') {
			itemstart = i+1;
			thisitem = 1;
		} else if (fulllist.substring(i,i+1) == ']') {
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			totprice = totprice + itemtotal;
			itemlist=itemlist+1;
			itemcount = eval(itemcount) + eval(thequantity);
			var newItem2 = theitem
			newItem = newItem2.substr(0,18)
		} else if (fulllist.substring(i,i+1) == '|') {
			if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
					if (thisitem==3) theurl = fulllist.substring(itemstart, i);				
						if (thisitem==4) theitemnum = fulllist.substring(itemstart, i);
							if (thisitem==5) theweight = fulllist.substring(itemstart, i);
					thisitem++;
					itemstart=i+1;
		}
	}
	document.write('<a href="bbasket.htm" class="s0Cd"><strong><font size="-1" face="Arial,Helvetica,sans-serif" color="#FFFFFF">View Cart</strong><span class="s0Cd">&nbsp;&nbsp;<strong>|</strong>&nbsp;&nbsp;</span><font size="-1" face="Arial,Helvetica,sans-serif" color="#FFFFFF"><strong>Checkout</strong></font></span><br><strong><img src="images/ecart.gif" width="30" height="30" border="0" alt="Shopping Cart"></a><br><span class="s0Cd">&nbsp;'+itemcount+'&nbsp;items,&nbsp;Total&nbsp;$&nbsp;'+alterError(totprice)+'&nbsp;&nbsp;&nbsp;&nbsp;</font></span></strong>');
}
function alterError(value) {
	if (value<=0.99) {
		newPounds = '0';
	} else {
		newPounds = parseInt(value);
	}
	newPence = parseInt((value+.0008 - newPounds)* 100);
	if (eval(newPence) <= 9) newPence='0'+newPence;
	newString = newPounds + '.' + newPence;
	return (newString);
}
function buyItem(newItem, newPrice, newUrl, newItemnum, newWeight, newQuantity) {
		index = document.cookie.indexOf("TheBasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
		countend = document.cookie.indexOf(";", index);
   		if (countend == -1) {
   			countend = document.cookie.length;
   		}
        document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+"|"+newPrice+"|"+newUrl+"|"+newItemnum+"|"+newWeight+"|"+newQuantity+"]";
}
function reLoad() {
	window.location = "bbasket.htm";
}

function showdate() {
var day="";
var month="";
var ampm="";
var ampmhour="";
var myweekday="";
var year="";
mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getYear();
year = myyear;
myhours = mydate.getHours();
ampmhour  =  (myhours > 12) ? myhours - 12 : myhours;
ampm =  (myhours >= 12) ? ' PM' : ' AM';
mytime = mydate.getMinutes();
myminutes =  ((mytime < 10) ? ':0' : ':') + mytime;
if(myday == 0)
day = " Sunday, ";
else if(myday == 1)
day = " Monday, ";
else if(myday == 2)
day = " Tuesday, ";
else if(myday == 3)
day = " Wednesday, ";
else if(myday == 4)
day = " Thursday, ";
else if(myday == 5)
day = " Friday, ";
else if(myday == 6)
day = " Saturday, ";
if(mymonth == 0) {
month = "January ";}
else if(mymonth ==1)
month = "February ";
else if(mymonth ==2)
month = "March ";
else if(mymonth ==3)
month = "April ";
else if(mymonth ==4)
month = "May ";
else if(mymonth ==5)
month = "June ";
else if(mymonth ==6)
month = "July ";
else if(mymonth ==7)
month = "August ";
else if(mymonth ==8)
month = "September ";
else if(mymonth ==9)
month = "October ";
else if(mymonth ==10)
month = "November ";
else if(mymonth ==11)
month = "December ";
if (navigator.appName == "Netscape")
year=1900 + year;
document.write(month);
document.write(myweekday + ", " + year + "   "); }


function showad() {
var item = 5;
random = Math.random();
rand = Math.round( (item-1) * random) + 1;

link = new Array;
banner = new Array;

link[1] = "";
link[2] = "";
link[3] = "http://www.tshirts-n-more.com/";
link[4] = "http://www.wantsound.com/";
link[5] = "http://www.wantsound.com/";
var link = link[rand];

banner[1] = "images/adbanners/banner1.gif";
banner[2] = "images/adbanners/banner1.gif";
banner[3] = "images/adbanners/banner3.gif";
banner[4] = "images/adbanners/banner4.gif";
banner[5] = "images/adbanners/banner4.gif";
var banner = banner[rand];

document.write('<A href="' + link + '"><IMG src="' + banner + '" border="0" alt="Click Here"></A>') }


