var productName = new Array()
var leadTime = new Array()
var available = new Array()
var currentPrice = new Array()
var oldPrice = new Array()
var domesticStandard = new Array()
var domesticExpress = new Array()
var internationalStandard = new Array()
var internationalExpress = new Array()
var audioShip = 17
var leadTimeUpdated = "Aug 1, 2011"
var discountPercentage = "0"
var thisDiscount = ""
var preorderDiscount = "15"

var caseNames = new Array("Pelican 1495","Pelican 1600","DoskoSport 10303","Pelican 1700","DoskoSport 10202","SKB-4214W","SKB-5014W","SKB-5014W","Pelican 1090")
var casePrices = new Array(150, 180, 100, 300, 130, 300, 350, 350, 100)

productName[0] = "TBX1"
leadTime[0] = 1
available[0] = "5-10 Days"
oldPrice[0] = 299
currentPrice[0] = 299
domesticStandard[0] = 18
domesticExpress[0] = 58
internationalStandard[0] = 96
internationalExpress[0] = 110

productName[1] = "TPX2"
// use -1 leadTime to show "contact"
leadTime[1] = 10
available[1] = "6-8 WEEKS"
oldPrice[1] = 1292
currentPrice[1] = 999
domesticStandard[1] = 42
domesticExpress[1] = 76 - domesticStandard[1]
internationalStandard[1] = 230
internationalExpress[1] = 260 - internationalStandard[1]

productName[2] = "TPX4"
leadTime[2] = 10
available[2] = "7-9 WEEKS"
oldPrice[2] = 2025
currentPrice[2] = 1599
domesticStandard[2] = 44
domesticExpress[2] = 95 - domesticStandard[2]
internationalStandard[2] = 276
internationalExpress[2] = 308 - internationalStandard[2]

productName[3] = "TPX6s"
leadTime[3] = 10
available[3] = "8-10 WEEKS"
oldPrice[3] = 2760
currentPrice[3] = 2499
domesticStandard[3] = 53
domesticExpress[3] = 121 - domesticStandard[3]
internationalStandard[3] = 358
internationalExpress[3] = 428 - internationalStandard[3]

productName[4] = "TPX6"
leadTime[4] = 10
available[4] = "6-8 WEEKS"
oldPrice[4] = 2760
currentPrice[4] = 2199
domesticStandard[4] = 48
domesticExpress[4] = 105 - domesticStandard[4]
internationalStandard[4] = 297
internationalExpress[4] = 330 - internationalStandard[4]

productName[5] = "Megascore"
leadTime[5] = 0
available[5] = "Free"
oldPrice[5] = 0
currentPrice[5] = 0
domesticStandard[5] = 0
domesticExpress[5] = 0
internationalStandard[5] = 0
internationalExpress[5] = 0

productName[6] = "MGBx"
leadTime[6] = 2
available[6] = ""
<!--synth / amp -->
oldPrice[6] = 349
currentPrice[6] = 300
domesticStandard[6] = 17
domesticExpress[6] = 55
internationalStandard[6] = 23
internationalExpress[6] = 59

<!-- TBX1 chip upgrades -->
productName[7] = "CHIP"
leadTime[7] = 0
available[7] = "NOW SHIPPING"
<!--joystick add-on-->
oldPrice[7] = 50
currentPrice[7] = 40
<!-- back to chip -->
domesticStandard[7] = 2
domesticExpress[7] = 10
internationalStandard[7] = 5
internationalExpress[7] = 15

productName[8] = "SCORDATURA"
leadTime[8] = 0
available[8] = "License is emailed"
oldPrice[8] = 53
currentPrice[8] = 59
domesticStandard[8] = 0
domesticExpress[8] = 0
internationalStandard[8] = 0
internationalExpress[8] = 0

<!-- TPX chip upgrades -->
productName[9] = "CHPS"
leadTime[9] = 0
available[9] = "NOW SHIPPING"
oldPrice[9] = 4
currentPrice[9] = 4
domesticStandard[9] = 5
domesticExpress[9] = 11
internationalStandard[9] = 7
internationalExpress[9] = 14

productName[10] = "XENTONE"
leadTime[10] = 0
available[10] = "License is emailed"
oldPrice[10] = 53
currentPrice[10] = 59
domesticStandard[10] = 0
domesticExpress[10] = 0
internationalStandard[10] = 0
internationalExpress[10] = 0

productName[11] = "U-PLEX"
leadTime[11] = 10
available[11] = "3-5 WEEKS"
oldPrice[11] = 699
currentPrice[11] = 599
domesticStandard[11] = 33
domesticExpress[11] = 65 - domesticStandard[11]
internationalStandard[11] = 196
internationalExpress[11] = 241 - internationalStandard[11]

productName[12] = "HPLF"
leadTime[12] = 0
available[12] = "License is emailed"
oldPrice[12] = 22
currentPrice[12] = 22
domesticStandard[12] = 0
domesticExpress[12] = 0
internationalStandard[12] = 0
internationalExpress[12] = 0

productName[13] = "CSE"
leadTime[13] = 0
available[13] = "License is emailed"
oldPrice[13] = 22
currentPrice[13] = 22
domesticStandard[13] = 0
domesticExpress[13] = 0
internationalStandard[13] = 0
internationalExpress[13] = 0

var freeProducts = new Array('TPXE','ScalaVista','PXSC','MegaScore')
for (var j=0; j < 4; j++) {
	productName.push(freeProducts[j])
	leadTime.push(0)
	available.push("Free")
	oldPrice.push(0)
	currentPrice.push(0)
	domesticStandard.push(0)
	domesticExpress.push(0)
	internationalStandard.push(0)
	internationalExpress.push(0)
}

function LeadTime(product, quan, wantLink) {

	if (product.substr(0,1) == "*") {
		return "custom"
	}

	var theProduct = product.substr(0,4)
	var addedTime = 0
	var found = 0
	var ca = 0

	document.write("<font color = #cc3300>")
	
	for (n=0; n < productName.length; n++) {
		if (theProduct == productName[n].substring(0,4) && found == 0) {
			found = 1
			if (available[n].substring(0,7) == "Release") {
				discountPercentage = preorderDiscount
			}
			else {
				discountPercentage = "0"
			}
			if (available[n] != "") {
				if (wantLink) {
					document.write("<a href='#about_leadtime' rel='ibox'>"+available[n]+"</a>")
				}
				else {
					document.write(available[n])
				}
			}
			else {
				if (leadTime[n] > 0) {
					addedTime = (quan-1) * leadTime[n]
					if (wantLink) {
						document.write("<a href='#about_leadtime' rel='ibox'>"+(leadTime[n]+addedTime)+" weeks</a>")
					}
					else {
						document.write((leadTime[n]+addedTime)+" weeks")
					}
				}
				else {
					if (leadTime[n] < 0) {
						document.write("<a href='contact.html'>contact</a>")
					}
					else {
						document.write((leadTime[n]+addedTime)+" weeks")
					}
				}	
			}
		}
	}
	
	if (found == 0) {
		n = 6
		if (quan <= 2) { 
			addedTime = leadTime[n] + 0
		}
		if (quan > 2 && quan <= 4) { 
			addedTime = leadTime[n] + 1
			discountPercentage = "5"
		}
		if (quan > 4 && quan <= 10) { 
			addedTime = leadTime[n] + 2
			discountPercentage = "10"
		}
		if (quan > 10 && quan <= 20) { 
			addedTime = leadTime[n] + 4
			discountPercentage = "15"
		}
		if (quan > 20 && quan <= 50) { 
			addedTime = leadTime[n] + 6
			discountPercentage = "20"
		}
		if (wantLink) {
			document.write("<a href='#about_leadtime' rel='ibox'>"+(addedTime)+"-"+(addedTime+1)+" weeks</a>")
		}
		else {
			document.write((addedTime)+"-"+(addedTime+1)+" weeks")
		}
	}
	document.write("</font>")
	return discountPercentage
}

function isFree(product) {
	var j = freeProducts.indexOf(product)
	return j
}

