function calcTotals()
{
	var countItems = '';
	var costItems = 0;
	var formCountItems = eval('document.shopForm.numItems');
	var formCostItems = eval('document.shopForm.costItems');
	var cookieSplit = document.cookie.split(';');
	var foundIndex = checkExists(cookieSplit);
	if(foundIndex != -1)
	{
			cookieSubSplit = cookieSplit[foundIndex].split(',');
			for(var j=0; j < cookieSubSplit.length; j++)
			{
				if(cookieSubSplit[j].indexOf('pkc') != -1)
				{
					var trimSubCookie = trim(cookieSubSplit[j]);
					var funcName = eval('price' + trimSubCookie.substring(4));
					var quantity2 = cookieSubSplit[j + 1].substring(3);
					var quantity4 = cookieSubSplit[j + 2].substring(3);
					costItems = costItems + (funcName(quantity2,quantity4));
				}
				if(cookieSubSplit[j].indexOf('q2') != -1 || cookieSubSplit[j].indexOf('q4') != -1)
					{
						if(countItems == '')
						{
							
							countItems = parseInt(cookieSubSplit[j].substring(3));
						}
						else
						{
							countItems = countItems + parseInt(cookieSubSplit[j].substring(3));
							
						}
					}
			}
	}
	if(countItems != ''){formCountItems.value = countItems;}
	else{formCountItems.value = '0';}
	if(costItems > 0){formCostItems.value = '$' + costItems.toFixed(2);}
	else{formCostItems.value = '$0';}
}
function checkExists(cookieSplit)
{
	var blnFound;
	var foundIndex;
	for(i=0; i < cookieSplit.length; i++) 
	{
		if(cookieSplit[i].indexOf('pkc') != -1)
		{
			blnFound = true;
			foundIndex = i;
		}
	}
	if(blnFound == true){return foundIndex;}
	else{return -1;}
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}