//dejavu8080.js -- vers 1.0.4.2   30/9/2010//Copyright Cos Russo, Dejavu Worlds 2008//1.0.4.1 inventoryList.php now on server so no need to post vars//1.0.4.2 show upper 2 categories as artist and album; adjust cart layout to suit; remove qty from digital list; adjust refreshCart()var currentArray;var $trackItems;var $thresholdDate;var $catchSafariSlack;//----------------HTML BUTTON OPS-------------------------------------------------------function changeTaxRegion(taxRegion,showButts) {	//taxRegion is 0,1,2 or 3 : 0=page load (onload) : 1,2,3=user change	if (taxRegion == 0) {		taxRegion = readCurrent('currentTaxRegion');		if (!taxRegion) {			taxRegion = getShopsData('defaultPricing');		}	} else {		storeCurrent('currentTaxRegion',taxRegion);	}	var $allProducts = document.getElementsByTagName('span');	if ($allProducts) {		var L1 = getShopsData('clientCountry');		for (var i=0; i<$allProducts.length; i++) {			var $Ltemp = $allProducts[i].id;			var $Lproduct = getProductInfo($Ltemp);			if ($Lproduct) {				document.getElementById($Ltemp).firstChild.data = "$" + cosFixed($Lproduct[0] + $Lproduct[0] * $Lproduct[taxRegion]/100);				//next line is for mp3 lists - bypasses tax text if &nbsp is missing in html				if (document.getElementById($Ltemp).childNodes[1].firstChild) {					if ($Lproduct[taxRegion] != 0) {						document.getElementById($Ltemp).childNodes[1].firstChild.data = (taxRegion == 3 ? " includes "+$Lproduct[4] : " includes "+$Lproduct[4]+" in "+L1);					} else {						document.getElementById($Ltemp).childNodes[1].firstChild.data = "";					}				}			}		}		if (showButts) {			updateButtons(taxRegion);		}	}}function changeCartTaxRegion(taxRegion,showButts) {	//taxRegion is 0,1,2 or 3 : 0=page load (onload) : 1,2,3=user change	if (taxRegion == 0) {		taxRegion = readCurrent('currentTaxRegion');		if (!taxRegion) {			taxRegion = getShopsData('defaultPricing');		}		if (showButts) {			updateButtons(taxRegion);		}	} else {		storeCurrent('currentTaxRegion',taxRegion);		location.reload();	}}function updateButtons(Ltemp) {	//the vars are needed as button/s may not exist depending on showInShop	var $locButton = document.getElementById('regionButton1');	var $domButton = document.getElementById('regionButton2');	var $intButton = document.getElementById('regionButton3');	if ($locButton) {		if (Ltemp == 1) {			$locButton.style.backgroundColor = "#FFF";			$locButton.style.borderColor = "#DC6";			$locButton.style.borderWidth = "4px";		} else {			$locButton.style.backgroundColor = "#BBB";			$locButton.style.borderColor = "#FFF";			$locButton.style.borderWidth = "2px";		}	}	if ($domButton) {		if (Ltemp == 2) {			$domButton.style.backgroundColor = "#FFF";			$domButton.style.borderColor = "#DC6";			$domButton.style.borderWidth = "4px";		} else {			$domButton.style.backgroundColor = "#BBB";			$domButton.style.borderColor = "#FFF";			$domButton.style.borderWidth = "2px";		}	}	if ($intButton) {		if (Ltemp == 3) {			$intButton.style.backgroundColor = "#FFF";			$intButton.style.borderColor = "#DC6";			$intButton.style.borderWidth = "4px";		} else {			$intButton.style.backgroundColor = "#BBB";			$intButton.style.borderColor = "#FFF";			$intButton.style.borderWidth = "2px";		}	}}//-----------------UTILITY OPS-------------------------------------------------------------//cosFixed formats currency. NOTE: Math.round maximum value is 21,474,836.47 (7FFFFFFF hex) on safari, explorer okfunction cosFixed($numToFix) {	$numToFix = (Math.round($numToFix * 100)).toString();	while ($numToFix.length <= 2) {		$numToFix = "0" + $numToFix;	}	var $cents = $numToFix.substr($numToFix.length - 2, $numToFix.length);	$numToFix = $numToFix.substr(0, $numToFix.length - 2);	if ($numToFix.length > 3) {		var $threes = "";		while ($numToFix.length > 3) {			$threes = "," + $numToFix.substr($numToFix.length - 3) + $threes;			$numToFix = $numToFix.substr(0, $numToFix.length - 3);		}		$numToFix = $numToFix.concat($threes);	}	return $numToFix.concat(".",$cents);}function cosFixedNumber($numToFix) {	return (Math.round($numToFix * 100))/100;}function isValidNumber(numToCheck) {	if (isNaN(numToCheck)) {		alert('The quantity field entry is not a number. Please enter a number.');		return false;	}	numToCheck = Math.round(Math.abs(numToCheck));	if (numToCheck == 0) {		alert('Please enter a number greater than 0.');		return false;	}	return numToCheck;}//-----------------CURRENTS OPS-------------------------------------------------------------function storeCurrent(name,value) {	//online editing:	//document.cookie = name + "=" + value + "; path=/; domain=.alidagame.com";	//offline editing:	document.cookie = name + "=" + value;}function readCurrent(name) {	var n = name + "=";	var ca = document.cookie.split(';');	for (var i=0;i < ca.length;i++) {		var c = ca[i];		if (c.charAt(0) == ' ') {			c = c.substring(1, c.length);		}		if (c.indexOf(n) == 0) {			return c.substring(n.length,c.length);		}	}	return false;}function currentFillArray() {	var ca = document.cookie.split(';');	//var ca = new Array(" order=ZEBRAS_2|COBRAS_55|ELEPHANTS_81|COCKS_22|DUCKS_43|crappers_2")	currentArray = new Array();	for (var i=0;i < ca.length;i++) {		var c = ca[i];		if (c.charAt(0) == ' ') {			c = c.substring(1, c.length);		}		if (c.indexOf('order=') == 0) {			var sepOrders = c.substring(6,c.length);			var sepData = sepOrders.split('|');			for (var j=0;j < sepData.length;j++) {				var Ltemp = sepData[j].split('_');				currentArray[j] = new Array(Ltemp[0],Ltemp[1]);			}		}	}}function arrayFillCurrent() {	var currentString = "";	for (var i=0;i < currentArray.length;i++) {		currentString += currentArray[i].join('_');		if (i < currentArray.length-1) {			currentString += "|";		}	}	//check length to make sure not over 48KB	if (currentString.length > 4080) {		alert('No more items can be added to the cart (maximum). Please process the current order, then place a new order for more items.');	} else {		//document.cookie = "order=" + currentString + "; path=/; domain=.alidagame.com";		document.cookie = "order=" + currentString;	}}//------------------CART OPS-------------------------------------------------------------function addToCart(code,quantity) {	var quantityOK = isValidNumber(quantity);	if (quantityOK) {		currentFillArray();		var $isItDownloadable = getProductInfo(code);		var flag = 0;		for (var i=0;i < currentArray.length;i++) {			if (currentArray[i][0] == code) {				if ($isItDownloadable[10] == 0) {					var n1 = Number(currentArray[i][1]);					currentArray[i][1] = Math.min(n1 + Number(quantityOK),999);				} else {					currentArray[i][1] = 1;				}				flag = 1;				break;			}		}		if (flag == 0) {			if ($isItDownloadable[10] == 0) {				currentArray[currentArray.length] = new Array(code,quantityOK);			} else {				currentArray[currentArray.length] = new Array(code,1);			}		}		arrayFillCurrent();	} else {		return false;	}}function removeFromCart(item) {	//currentFillArray();	var tempArray = new Array();	var j = 0;	for (var i=0;i < currentArray.length;i++) {		if (i != item) {			tempArray[j] = new Array(currentArray[i][0], currentArray[i][1]);			j++;		}	}	if (tempArray.length == 0) {		document.cookie = "order=null; expires=Thu, 2 Aug 2001 20:47:11 UTC";	} else {		currentArray = tempArray;		arrayFillCurrent();	}	location.reload();}function displayCart() {	currentFillArray();	var $itemsListFINAL = "<table align=\"center\" cellpadding=\"0\" cellspacing=\"1\">";	if (currentArray.length != 0) {		var taxRegion = readCurrent('currentTaxRegion');		if (!taxRegion) {taxRegion = getShopsData('defaultPricing');}		var $regionLabel = getShopsData('clientTaxesLabels');		var $freightType = getShopsData('freightType');		var $freightBasicCharge = getShopsData('freightBasicCharge');		var $freightTax = getShopsData('freightTax');		var $fTax = 0;		var $discountData = discountStatus();		var $itemsHeading = "<tr class=\"cartItemHeadings\"><td colspan=\"1\" class=\"cartItemQuantity\">QTY.</td><td colspan=\"2\" class=\"cartItemName\">PRODUCT NAME</td>";		$itemsHeading += "<td colspan=\"1\" class=\"cartItemPrices\">PRICE<br />ex tax</td><td colspan=\"1\" class=\"cartItemPrices\">TAX</td>";		$itemsHeading += "<td colspan=\"1\" class=\"cartItemPrices\">PRICE<br />inc tax</td><td colspan=\"1\" class=\"cartItemPrices\">SUB-TOTAL</td></tr>";		var $itemsHeadingMP3 = "<tr class=\"cartItemHeadings\"><td colspan=\"2\" class=\"cartItemName\">PRODUCT NAME</td><td colspan=\"2\" class=\"cartItemName\">ARTIST/CATEGORY</td>";		$itemsHeadingMP3 += "<td colspan=\"2\" class=\"cartItemPrices\">ALBUM/COLLECTION</td>";		$itemsHeadingMP3 += "<td colspan=\"1\" class=\"cartItemPrices\">SUB-TOTAL</td></tr>";		var $prodTax = new Array();		var $prodPriceTax = new Array();		var $itemTotal = new Array();		$trackItems = new Array();		var $trackItemsMP3 = new Array();		var $subTotal = 0;		var $subTotalMP3 = 0;		var $qtyTally = 0;		var $itemsList = "";		var $itemsListMP3 = "";		var $freightTotal = 0;		var $freightProduct = 0;		var $freightWeight = 0;		var $itemColor = "#EEE";		var $itemColorMP3 = "#EEE";		for (var i=0;i < currentArray.length;i++) {			$qtyTally += Number(currentArray[i][1]);			var $Lproduct = getProductInfo(currentArray[i][0]);			var $Lcatpath = getCategoryPath(currentArray[i][0]);			if ($Lproduct == null) {				//MUST UPDATE following line according to amount of items in getProductInfo array				$Lproduct = new Array(0.00,0,0,0,"none","ERROR:'"+currentArray[i][0]+"':missing in database",0.00,0.00,0.00,0.00,0,0);			}			$freightWeight += $Lproduct[9] * currentArray[i][1];			taxRegion = Number(taxRegion);			switch (taxRegion) {				case 1:				$Lproduct[1] == 0 ? $prodTax[i] = 0 : $prodTax[i] = cosFixedNumber(($Lproduct[0]) * ($Lproduct[1])/100);				$freightProduct += $Lproduct[6] * currentArray[i][1];				break;				case 2:				$Lproduct[2] == 0 ? $prodTax[i] = 0 : $prodTax[i] = cosFixedNumber(($Lproduct[0]) * ($Lproduct[2])/100);				$freightProduct += $Lproduct[7] * currentArray[i][1];				break;				case 3:				$Lproduct[3] == 0 ? $prodTax[i] = 0 : $prodTax[i] = cosFixedNumber(($Lproduct[0]) * ($Lproduct[3])/100);				$freightProduct += $Lproduct[8] * currentArray[i][1];				break;				default:				$prodTax[i] = 0;			}			//next 2 lines will not blow out past 2 dec places, so cosFixed will NOT cause listings to be out by a cent in the following			$prodPriceTax[i] = $Lproduct[0] + $prodTax[i];			$itemTotal[i] = currentArray[i][1] * $prodPriceTax[i];			if ($Lproduct[10] == 0) {				$subTotal += $itemTotal[i];				$trackItems[$trackItems.length] = i;				$itemsList += "<tr style=\"background:"+$itemColor+"\">";				$itemsList += "<td colspan=\"1\"><input type=\"text\" name=\"cartQty\" value=\""+currentArray[i][1]+"\" size=\"3\" maxlength=\"3\" /></td>";				$itemsList += "<td colspan=\"2\" class=\"cartItemName\">"+$Lproduct[5]+"</td><td colspan=\"1\" class=\"cartItemPrices\">$"+cosFixed($Lproduct[0])+"</td>";				$itemsList += "<td colspan=\"1\" class=\"cartItemPrices\">$"+cosFixed($prodTax[i])+"</td><td colspan=\"1\" class=\"cartItemPrices\">$"+cosFixed($prodPriceTax[i])+"</td>";				$itemsList += "<td colspan=\"1\" class=\"cartItemPrices\">$"+cosFixed($itemTotal[i])+"</td>";				$itemsList += "<td colspan=\"1\"><input type=\"button\" value=\"REMOVE\" style=\"font-size:8px\" onclick=\"removeFromCart("+i+");\" /></td></tr>";				$itemColor == "#EEE" ? $itemColor = "#FEFEEE" : $itemColor = "#EEE";			} else {				$subTotalMP3 += $itemTotal[i];				$trackItemsMP3[$trackItemsMP3.length] = i;				$itemsListMP3 += "<tr style=\"background:"+$itemColorMP3+"\">";				$itemsListMP3 += "<td colspan=\"2\" class=\"cartItemName\">"+$Lproduct[5]+"</td><td colspan=\"2\" class=\"cartItemName\">"+$Lcatpath[$Lcatpath.length-1]+"</td>";				$itemsListMP3 += "<td colspan=\"2\" class=\"cartItemPrices\">"+$Lcatpath[$Lcatpath.length-2]+"</td>";				$itemsListMP3 += "<td colspan=\"1\" class=\"cartItemPrices\">$"+cosFixed($itemTotal[i])+"</td>";				$itemsListMP3 += "<td colspan=\"1\"><input type=\"button\" value=\"REMOVE\" style=\"font-size:8px\" onclick=\"removeFromCart("+i+");\" /></td></tr>";				$itemColorMP3 == "#EEE" ? $itemColorMP3 = "#FEFEEE" : $itemColorMP3 = "#EEE";			}			//items ready for server			$itemsListFINAL += "<input type=\"hidden\" name=\"itemQty["+i+"]\" value=\""+currentArray[i][1]+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"itemCode["+i+"]\" value=\""+currentArray[i][0]+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"itemName["+i+"]\" value=\""+$Lproduct[5]+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"itemPrice["+i+"]\" value=\""+cosFixed($Lproduct[0])+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"itemTax["+i+"]\" value=\""+cosFixed($prodTax[i])+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"itemPriceTax["+i+"]\" value=\""+cosFixed($prodPriceTax[i])+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"itemTotal["+i+"]\" value=\""+cosFixed($itemTotal[i])+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"MP3Size["+i+"]\" value=\""+$Lproduct[11]+"\" />";		}		if (($itemsList) || ($itemsListMP3)) {			$itemsListFINAL += "<input type=\"hidden\" name=\"trackItems\" value=\""+$trackItems+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"trackItemsMP3\" value=\""+$trackItemsMP3+"\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"noOfItems\" value=\""+currentArray.length+"\" />";			$freightTotal += $freightBasicCharge[taxRegion-1];			if ($freightType > 2) {				var $freightRanges = new Array();				for (var range=1;range <= 15;range++) {					$freightRanges[range] = getShopsData('freightRange'+range);				}				for (var f=1;f <= 15;f++) {					if ($freightRanges[f] != null) {						switch ($freightType) {							case 3:							if (($subTotal >= $freightRanges[f][0]) && ($subTotal <= $freightRanges[f][1])) {								$freightTotal += $freightRanges[f][taxRegion+1];								f = 16;							}							break;							case 4:							if (($subTotal >= $freightRanges[f][0]) && ($subTotal <= $freightRanges[f][1])) {								$freightTotal += $subTotal * $freightRanges[f][taxRegion+1]/100;								f = 16;							}							break;							case 5:							if (($freightWeight >= $freightRanges[f][0]) && ($freightWeight <= $freightRanges[f][1])) {								$freightTotal += $freightRanges[f][taxRegion+1];								f = 16;							}							break;						}					} else {						//no more ranges						break;					}				}			} else {				if ($freightType == 2) {$freightTotal += $freightProduct;}			}			//next line takes care of both nil subtotal and nil deliverables with respect to freight			if ($subTotal == 0) {$freightTotal = 0;}			var $discountTOTAL = 0;			if ($discountData[0] == 1) {				switch ($discountData[1]) {					case 1:					$discountTOTAL = cosFixedNumber(($subTotal + $subTotalMP3)*$discountData[2]/100);					break;					case 2:					if (($subTotal + $subTotalMP3) > $discountData[5]) {						$discountTOTAL = cosFixedNumber(($subTotal + $subTotalMP3)*$discountData[2]/100);					}					break;					case 3:					if (($subTotal + $subTotalMP3) > $discountData[5]) {						$discountTOTAL = $discountData[3];					}					break;					case 4:					if ($qtyTally >= $discountData[6]) {						$discountTOTAL = cosFixedNumber(($subTotal + $subTotalMP3)*$discountData[2]/100);					}					break;					case 5:					if ($qtyTally >= $discountData[6]) {						$discountTOTAL = $discountData[3];					}					break;				}			}			//add freight tax			$freightTax[taxRegion-1] == 0 ? $fTax = 0 : $fTax = cosFixedNumber(($freightTotal) * ($freightTax[taxRegion-1])/100);			$freightTotal += $fTax;			if ($itemsList) {				$itemsListFINAL += "<tr><td colspan=\"8\" class=\"cartItemTitles\">Merchandise:</td></tr>" + $itemsHeading + $itemsList;				$itemsListFINAL += "<tr><td colspan=\"7\" class=\"cartTotals\">Subtotal = $" + cosFixed($subTotal) + "</td></tr>";				$itemsListFINAL += "<tr><td colspan=\"7\" class=\"cartTotals\">Freight on merchandise (" + $regionLabel[taxRegion-1] + ") = $" + cosFixed($freightTotal) + "</td></tr>";				$itemsListFINAL += "<tr><td>&nbsp</td></tr>";				//data ready for server				$itemsListFINAL += "<input type=\"hidden\" name=\"subTotal\" value=\"" + cosFixed($subTotal) + "\" />";				$itemsListFINAL += "<input type=\"hidden\" name=\"regionLabel\" value=\"" + $regionLabel[taxRegion-1] + "\" />";				$itemsListFINAL += "<input type=\"hidden\" name=\"freight\" value=\"" + cosFixed($freightTotal) + "\" />";			}			if ($itemsListMP3) {				$itemsListFINAL += "<tr><td colspan=\"8\" class=\"cartItemTitles\">Downloads:</td></tr>" + $itemsHeadingMP3 + $itemsListMP3;				$itemsListFINAL += "<tr><td colspan=\"7\" class=\"cartTotals\">Subtotal = $" + cosFixed($subTotalMP3) + "</td></tr>";				$itemsListFINAL += "<tr><td>&nbsp</td></tr>";				//data ready for server				$itemsListFINAL += "<input type=\"hidden\" name=\"subTotalMP3\" value=\"" + cosFixed($subTotalMP3) + "\" />";			}			$itemsListFINAL += "<tr><td colspan=\"7\"><hr size=\"1\" noshade></td></tr>";			$catchSafariSlack = Number(cosFixedNumber($freightTotal)+$subTotal+$subTotalMP3);			if ($discountTOTAL != 0) {				$itemsListFINAL += "<tr><td colspan=\"7\" class=\"cartFinalTotals\">Includes '" + $discountData[7] + "' discount = $" + cosFixed($discountTOTAL) + "</td></tr>";				$itemsListFINAL += "<tr><td colspan=\"7\" class=\"cartFinalTotals\">TOTAL = $" + cosFixed(cosFixedNumber($freightTotal)+$subTotal+$subTotalMP3-$discountTOTAL) + "</td></tr></table>";				//data ready for server: discountTotal left unformatted (no cosFixed - so no commas) php will then be able to calc				$itemsListFINAL += "<input type=\"hidden\" name=\"discountTotal\" value=\"" + $discountTOTAL + "\" />";			} else {				$itemsListFINAL += "<tr><td colspan=\"7\" class=\"cartFinalTotals\">TOTAL = $" + cosFixed(cosFixedNumber($freightTotal)+$subTotal+$subTotalMP3) + "</td></tr></table>";			}			//get data ready for server			$itemsListFINAL += "<input type=\"hidden\" name=\"clientRandName\" value=\"" + getShopsData('clientRandName') + "\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"clientCountry\" value=\"" + getShopsData('clientCountry') + "\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"taxRegion\" value=\"" + taxRegion + "\" />";						//total posted as raw Number() (otherwise js will concat.) - php can then calc			//also: discount NOT subtracted from posted total as php checks thresholdDate against server time			$itemsListFINAL += "<input type=\"hidden\" name=\"total\" value=\"" + Number(cosFixedNumber($freightTotal)+$subTotal+$subTotalMP3) + "\" />";			$itemsListFINAL += "<input type=\"hidden\" name=\"cartHost\" value=\"" + window.location.host + "\" />";		} else {			$itemsListFINAL += "<tr><td colspan=\"8\">YOUR SHOPPING CART IS EMPTY ...</td></tr></table>";		}	} else {		$itemsListFINAL += "<tr><td colspan=\"8\">YOUR SHOPPING CART IS EMPTY ...</td></tr></table>";	}	return $itemsListFINAL;}function checkoutCart() {	//check before checkout: MUST NOT let empty cart through	if (currentArray.length == 0) {		alert("Your shopping cart is empty ... ");		return false;	}	//must not allow > $10,000. Remember: discountTotal may not exist, so check first	var $checkLimit = document.refreshForm.total.value;	$cc = document.refreshForm.elements;	for (var dd = 0; dd < $cc.length ; dd++) {		if ($cc[dd].name == "discountTotal") {			var $checkLimit = (document.refreshForm.total.value)-(document.refreshForm.discountTotal.value);			break;		}	}	if ($checkLimit > 10000) {		alert("This shop cannot process single orders greater than $10,000. Please reduce the total of the shopping cart by removing some items.");		return false;	}	//catch out any mismatches between js vars and $_POST vars due to browser not refreshing correctly	if ($catchSafariSlack != document.refreshForm.total.value) {		//mismatch! reload ...		location.reload();		return false;	}	return true;}function refreshCart() {	if ($trackItems.length != 0) {		if ($trackItems.length == 1) {			//must check for single item as there will be NO DOM elements array			var quantityOK = document.refreshForm.cartQty.value;			quantityOK = isValidNumber(quantityOK);			if (quantityOK) {				currentArray[$trackItems[0]][1] = quantityOK;			} else {				return false;			}		} else {			for (var i=0;i < $trackItems.length;i++) {				var quantityOK = document.refreshForm.elements.cartQty[i].value;				quantityOK = isValidNumber(quantityOK);				if (quantityOK) {					currentArray[$trackItems[i]][1] = quantityOK;				} else {					return false;				}			}		}		arrayFillCurrent();		location.reload();	}}//------------------DISCOUNT OPS-------------------------------------------------------------function discountStatus() {	//array example format:1,2,10,50.00,17:3:2008,500.00,5,"Freaky Sale!","All items cut!"	var $discountTemp = getShopsData('discountArray');	if ($discountTemp[0] == 1) {				var $date = new Date();				$thresholdDate = $discountTemp[4].split(":");		if ($date.getFullYear() < $thresholdDate[2]) {			return $discountTemp;		}	else {			if ($date.getFullYear() == $thresholdDate[2]) {				if ($date.getMonth()+1 < $thresholdDate[1]) {					return $discountTemp;				} else {					if ($date.getMonth()+1 == $thresholdDate[1]) {						if ($date.getDate() <= $thresholdDate[0]) {							return $discountTemp;						}					}				}			}		}	}	return false;}function displayDiscount() {	var $discountData = discountStatus();	var $discountDisplay = "";	if ($discountData[0] == 1) {		var $months = new Array("dummy","January","February","March","April","May","June","July","August","September","October","November","December");				$discountDisplay += "<div class=\"discountWindow\"><table><tr><td class=\"discountType\">" + $discountData[7] + "</td></tr>";		$discountDisplay += "<tr><td class=\"discountType\">" + $discountData[8] + "</td></tr>";		switch ($discountData[1]) {			case 1:			$discountDisplay += "<tr><td class=\"discountType\">Discount: " + $discountData[2] + "% off the subtotal until " + $months[$thresholdDate[1]] + " " + $thresholdDate[0] + ", " + $thresholdDate[2] + "</td></tr>";			break;			case 2:			$discountDisplay += "<tr><td class=\"discountType\">Discount: Spend over $" + $discountData[5] + " and get " + $discountData[2] + "% off the subtotal until " + $months[$thresholdDate[1]] + " " + $thresholdDate[0] + ", " + $thresholdDate[2] + "</td></tr>";			break;			case 3:			$discountDisplay += "<tr><td class=\"discountType\">Discount: Spend over $" + $discountData[5] + " and get $" + $discountData[3] + " off the subtotal until " + $months[$thresholdDate[1]] + " " + $thresholdDate[0] + ", " + $thresholdDate[2] + "</td></tr>";			break;			case 4:			$discountDisplay += "<tr><td class=\"discountType\">Discount: Purchase more than " + $discountData[6] + " items and get " + $discountData[2] + "% off the subtotal until " + $months[$thresholdDate[1]] + " " + $thresholdDate[0] + ", " + $thresholdDate[2] + "</td></tr>";			break;			case 5:			$discountDisplay += "<tr><td class=\"discountType\">Discount: Purchase more than " + $discountData[6] + " items and get $" + $discountData[3] + " off the subtotal until " + $months[$thresholdDate[1]] + " " + $thresholdDate[0] + ", " + $thresholdDate[2] + "</td></tr>";			break;		}		$discountDisplay += "</table></div>";	}	return $discountDisplay;}//------------------PRE LOAD ROLLOVER OPS-------------------------------------------------------------function newImage(arg) {	if (document.images) {		var rslt = new Image();		rslt.src = arg;		return rslt;	}}function preloadRollImages(numButts) {	if (numButts != 0) {		if (document.images) {			var menu_01 = newImage("pictures/button1Normal.jpg");			var menu_02 = newImage("pictures/button2Normal.jpg");			var menuOver_01 = newImage("pictures/button1Over.jpg");			var menuOver_02 = newImage("pictures/button2Over.jpg");			if (numButts > 2) {				var menu_03 = newImage("pictures/button3Normal.jpg");				var menuOver_03 = newImage("pictures/button3Over.jpg");			}			if (numButts > 3) {				var menu_04 = newImage("pictures/button4Normal.jpg");				var menuOver_04 = newImage("pictures/button4Over.jpg");			}			if (numButts > 4) {				var menu_05 = newImage("pictures/button5Normal.jpg");				var menuOver_05 = newImage("pictures/button5Over.jpg");			}			if (numButts > 5) {				var menu_06 = newImage("pictures/button6Normal.jpg");				var menuOver_06 = newImage("pictures/button6Over.jpg");			}		}	}}//------------------------------ end ------------------------------------------------dejavu worlds
