	var baseurl = ""
	
	<!-- ALL VARIABLES -->
	var mscDownloads = new Array()
	var mscDLinks = new Array()
	var mscPaths = new Array()
	var mscSoftwareData = new Array()
	
	mscDownloads[0] = "!#MegaScore Free"
	mscDownloads[1] = "x@MegaScore Free for Windows"
	
	mscDLinks[0] = "MSCfeatures.html"
	mscDLinks[1] = "MSCfeatures.html"
	
	mscPaths[0] = "software/Megascore-MAC.zip"
	mscPaths[1] = "software/Megascore-WIN.zip"
	
	mscSoftwareData[0] = "Oct. 27, 2009 (4.9 MB Zip)"
	mscSoftwareData[1] = "Oct. 27, 2009 (2.2 MB Zip)"
	
	var xenDownloads = new Array()
	var xenDLinks = new Array()
	var xenPaths = new Array()
	var xenSoftwareData = new Array()
	
	xenDownloads[0] = "!#XENTONE 1.2.1"
	xenDownloads[1] = "x@XENTONE 1.2.1 for Windows"
	
	xenDLinks[0] = "XENTsoftware.html"
	xenDLinks[1] = "XENTsoftware.html"
	
	xenPaths[0] = "software/XENTONE-MAC.zip"
	xenPaths[1] = "software/XENTONE-WIN.zip"
	
	xenSoftwareData[0] = "Jan. 21, 2011 (9.3 MB Zip)"
	xenSoftwareData[1] = "Jan. 21, 2011 (4.4 MB Zip)"
	
	var scrdDownloads = new Array()
	var scrdDLinks = new Array()
	var scrdPaths = new Array()
	var scrdSoftwareData = new Array()
	
	scrdDownloads[0] = "!#SCORDATURA 1.1.1"
	
	scrdDLinks[0] = "SCRDsoftware.html"
	
	scrdPaths[0] = "software/SCORDATURA-MAC.zip";
	
	scrdSoftwareData[0] = "Jan. 1, 2012 (15.4 MB Zip)";
	
	var tbxDownloads = new Array()
	var tbxDLinks = new Array()
	var tbxPaths = new Array()
	var tbxSoftwareData = new Array()

	tbxDownloads[0] = "User Manual (pdf)"
	tbxDownloads[1] = "Factory .cse Tuning Files List (pdf)"
	tbxDownloads[2] = "Factory .scl Scala Files List (pdf)"
	tbxDownloads[3] = "!#CSE 2.8.0 - Custom Scale Editor"
	tbxDownloads[4] = "x@CSE 2.8.0 - Custom Scale Editor for Windows"
	tbxDownloads[5] = "Factory .cse and .scl Files (zip)"
	tbxDownloads[6] = "Turkish / Arabic Maqam .cse and .scl Files (zip)"
	
	tbxDLinks[3] = "CSEsoftware.html"
	tbxDLinks[4] = "CSEsoftware.html"
	
	tbxPaths[0] = "manuals/TBX1UserManual.pdf"
	tbxPaths[1] = "additionals/TBX1FactoryPresets.pdf"
	tbxPaths[2] = "additionals/TBX1FactoryScalaFiles.pdf"
	tbxPaths[3] = "software/CSE-MAC.zip" //"#";
	tbxPaths[4] = "software/CSE-WIN.zip"
	tbxPaths[5] = "software/TBX1Files.zip"
	tbxPaths[6] = "software/Maqamat-OzanYarman.zip"
	
	tbxSoftwareData[0] = "Jan. 29, 2012 (10.7 MB Zip)" //"TEMPORARILY UNAVAILABLE ";
	tbxSoftwareData[1] = "Jan. 29, 2012 (10.3 MB Zip)"
	
	var tpx28Downloads = new Array()
	var tpxDLinks = new Array()
	var tpx28Paths = new Array()
	var tpx28SoftwareData = new Array()
	
	tpx28Downloads[0] = "TPX2s/4s/6 User Manual (pdf)"
	tpx28Downloads[1] = "TPX6s/8s User Manual (pdf)"
	tpx28Downloads[2] = "TPX Developer Guidelines (pdf)"
	tpx28Downloads[3] = "TPX Factory Preset Tuning Files (zip)"
	tpx28Downloads[4] = "!#TPXE 1.6.1 - Tonal Plexus Editor"
	tpx28Downloads[5] = "x@TPXE 1.6.1 - Tonal Plexus Editor for Windows"
	
	tpxDLinks[4] = "TPXEsoftware.html"
	tpxDLinks[5] = "TPXEsoftware.html"
	
	tpx28Paths[0] = "manuals/TPX2s4s6UserManual.pdf"
	tpx28Paths[1] = "manuals/TPX6s8sUserManual.pdf"
	tpx28Paths[2] = "additionals/TPXSoftInstGuide.pdf"
	tpx28Paths[3] = "software/TPXfiles.zip"
	tpx28Paths[4] = "software/TPXE-MAC.zip"
	tpx28Paths[5] = "software/TPXE-WIN.zip"
	
	tpx28SoftwareData[0] = "Oct. 3, 2010 (19.1 MB Zip)"
	tpx28SoftwareData[1] = "Oct. 3, 2010 (11.3 MB Zip)"
	
	var pscDownloads = new Array()
	var pscDLinks = new Array()
	var pscPaths = new Array()
	var pscSoftwareData = new Array()
	
	pscDownloads[0] = "!#PXSC 1.0.2 - Plexus Synth Control"
	pscDownloads[1] = "x@PXSC 1.0.2 - Plexus Synth Control for Windows"
	
	pscDLinks[0] = "PXSCsoftware.html"
	pscDLinks[1] = "PXSCsoftware.html"
	
	pscPaths[0] = "software/PXSC-MAC.zip"
	pscPaths[1] = "software/PXSC-WIN.zip"
	
	pscSoftwareData[0] = "Oct. 3, 2010 (5.3 MB Zip)"
	pscSoftwareData[1] = "Oct. 3, 2010 (2.2 MB Zip)"
	
	var hplfDownloads = new Array()
	var hplfDLinks = new Array()
	var hplfPaths = new Array()
	var hplfSoftwareData = new Array()
	
	hplfDownloads[0] = "!#HPLF 2.0.3 - Lo-Fi Microstudio"
	
	hplfDLinks[0] = "HPLFsoftware.html"
	
	hplfPaths[0] = "software/HPLF-MAC.zip"
	
	hplfSoftwareData[0] = "Mar. 15, 2011 (27.1 MB Zip)"
	
	var svDownloads = new Array()
	var svDLinks = new Array()
	var svPaths = new Array()
	var svSoftwareData = new Array()
	
	svDownloads[0] = "!#ScalaVista 1.0.4 - Scale Browser"
	svDownloads[1] = "x@ScalaVista 1.0.4 - Scale Browser for Windows"
	
	svDLinks[0] = "ScalaVistasoftware.html"
	svDLinks[1] = "ScalaVistasoftware.html"
	
	svPaths[0] = "#"; //"software/ScalaVista-MAC.zip"
	svPaths[1] = "#"; //"software/ScalaVista-WIN.zip"
	
	svSoftwareData[0] = "TEMPORARILY UNAVAILABLE "; //"Oct. 3, 2010 (6.2 MB Zip)"
	svSoftwareData[1] = "TEMPORARILY UNAVAILABLE "; //"Oct. 3, 2010 (3.5 MB Zip)"
	
	var theDownloads = new Array()
	var thePaths = new Array()
	var theDLinks = new Array()
	var theSoftwareData = new Array()
	var theSoftwareImage = ""
	
function getDownloadData(theProduct) {
	if (theProduct != "") {
		if (theProduct == "MSC") {
			theDownloads = mscDownloads
			theDLinks = mscDLinks
			thePaths = mscPaths
			theSoftwareData = mscSoftwareData
			theSoftwareImage = "MegaScore"
		}
		if (theProduct == "XENT") {
			theDownloads = xenDownloads
			theDLinks = xenDLinks
			thePaths = xenPaths
			theSoftwareData = xenSoftwareData
			theSoftwareImage = "XENT"
		}
		if (theProduct == "SCRD") {
			theDownloads = scrdDownloads
			theDLinks = scrdDLinks
			thePaths = scrdPaths
			theSoftwareData = scrdSoftwareData
			theSoftwareImage = "SCRD"
		}
		if (theProduct == "TBX1") {
			theDownloads = tbxDownloads
			theDLinks = tbxDLinks
			thePaths = tbxPaths
			theSoftwareData = tbxSoftwareData
			theSoftwareImage = "CSE"
		}
		if (theProduct == "TPX28") {
			theDownloads = tpx28Downloads
			theDLinks = tpxDLinks
			thePaths = tpx28Paths
			theSoftwareData = tpx28SoftwareData
			theSoftwareImage = "TPXE"
		}
		if (theProduct == "PXSC") {
			theDownloads = pscDownloads
			theDLinks = pscDLinks
			thePaths = pscPaths
			theSoftwareData = pscSoftwareData
			theSoftwareImage = "PXSC"
		}
		if (theProduct == "HPLF") {
			theDownloads = hplfDownloads
			theDLinks = hplfDLinks
			thePaths = hplfPaths
			theSoftwareData = hplfSoftwareData
			theSoftwareImage = "HPLF"
		}
		if (theProduct == "ScalaVista") {
			theDownloads = svDownloads
			theDLinks = svDLinks
			thePaths = svPaths
			theSoftwareData = svSoftwareData
			theSoftwareImage = "ScalaVista"
		}
	}
}

function DownloadList(theProduct) {
	getDownloadData(theProduct)
	for (j = 0; j < theDownloads.length; j++) {
		if (theDownloads[j].charAt(1) == "#") {
			DownloadSoftwareList(theProduct, j)
		}
		else { 
			if (theDownloads[j].charAt(0) != "x") {
				document.write("<a href='"+baseurl+thePaths[j]+"'>"+theDownloads[j]+"</a><br>")
			}
		}
	}
}

function DownloadBar(theProduct) {
	getDownloadData(theProduct)
	for (j = 0; j < theDownloads.length; j++) {
		if (theDownloads[j].charAt(1) == "#") {
			DownloadTable(theProduct)
		}
		else { 
			if (theDownloads[j].charAt(0) != "x") {
				document.write("<a href='"+baseurl+"downloads.html'>"+theDownloads[j]+"</a><br>")
			}
		}
	}
}

function Humanize() {
	document.write("<FORM NAME='HUMAN'><p><font color='#cc3300'><b>REQUIRED &rarr;</b> ")
	document.write("<i>Please type the following word before downloading ")
	document.write("(necessary to combat web robots): </i></font>")
	document.write("<b>music</b> <INPUT id='NOBOTS' type='text' NAME='NOBOTS' size='5'></p></FORM>")
}

function verifyDownload(theForm) {
	if (document.HUMAN.NOBOTS.value == "music") {
		theForm.UserName.value = document.CONTACT.USER_NAME.value
		theForm.Email.value = document.CONTACT.EMAIL.value
		theForm.Message.value = document.CONTACT.MESSAGE.value
		return true
	} 
	else {
		alert("You must type the word 'music' into the entry field above the download table in order to download the files. Please introduce yourself as well, and let me know what you think!")
		return false
	}
}

function IntroduceYourself() {
	document.write("<FORM NAME='CONTACT'>")
	document.write("<p><font color='#cc3300'><b>OPTIONAL* &rarr;</b> &nbsp;<i>Introduce yourself! ")
	document.write("</i></font><b>Name:</b> ")
	document.write("<INPUT type='text' id='user_name' size='16' name='USER_NAME' value=''>")
	document.write("&nbsp;<b>Email:</b> <INPUT type='text' name='EMAIL' size='23'></p>")
	document.write("<p><b>Comment:</b> <INPUT type='text' name='MESSAGE' size='90'></p></FORM>")
	document.write("<p class='note'><font color='#cc3300'>*</font> Your privacy is taken seriously; ")
	document.write("names and emails are strictly voluntary, and are never given to any third party.</p>")
}

function SetUserData() {
	var TheCookType = ""
	var TheCookData = ""
	var TheCookText = ""
	var TheCookValue = ""
	var AllCookies = new Array
	var TextFields = new Array
	var DataFields = new Array
	var Sep = "!"
	var ShipCookie = -1
	var ShipMode = ""
	var AddressText = ""
	var cr = "\r\n"
	var theTempName = ""
	
	AllCookies = document.cookie.split("; ")

	if (AllCookies[0] != "") {
		for (var j = 0; j < AllCookies.length; j++) {
			TheCookType = AllCookies[j].split("=")[0]
			
			if (TheCookType == "ShipInfo") {
				TheCookData = AllCookies[j].split("=")[1]
				TheCookText = TheCookData.split("?")[0]
				TheCookValue = TheCookData.split("?")[1]
				TextFields = TheCookText.split(Sep)
				DataFields = TheCookValue.split(Sep)		
				theTempName = DataFields[0]
				if (DataFields[1] != "") { theTempName += " "+DataFields[1] }
				theTempName += DataFields[2]
				document.CONTACT.USER_NAME.value = theTempName
				document.CONTACT.EMAIL.value = DataFields[9]
				document.CONTACT.MESSAGE.value = " "
				
			}	
		}
	}
}
	
function DownloadTable(theProduct, withHeader, withFooter) {
	getDownloadData(theProduct)
	for (k = 0; k < theDownloads.length; k++) {
		if (theDownloads[k].charAt(0) == "!") {
			theDownloads[k] = theDownloads[k].split("#")[1]		
			if (withHeader == true) {
				document.write("<p align='center'><table class='download' width=99% border=1 cellpadding=4 cellspacing=0><tr>")
				document.write("<th class='downloads'>Software</th><th bgcolor='#ffffff'>")
				document.write("<img vspace=6 hspace=30 valign='middle' src='images/MacOSX_Universal_50px.gif'>(10.4+/G4/Intel)</th><th bgcolor='#ffffff'>")
				document.write("<img vspace=7 hspace=20 valign='middle' src='images/windows_logo.jpg'>(XP/Vista/7)</th></tr>")
			}
			
			document.write("<tr><td class='dl'><table><tr><td><a class='plain' href='softwarebuy.html#"+theSoftwareImage+"_buy'>")
			var theShopID = '"shop_'+theProduct+'"'
			document.write("<img class='framed' alt="+theShopID+" align='left' width='58' height='52' src='images/SoftwareImages/boxes_small/"+theSoftwareImage+"_box_small.jpg'>&nbsp;")
			document.write("</a></td><td><b><a class='plain' href='"+theDLinks[k]+"'>"+theDownloads[k]+"</a></b></td></tr></table><th class='dl'>")
			
			document.write("<FORM NAME='DOWNLOAD' METHOD='POST' ACTION='/cgi-bin/formmail.pl' onSubmit='return verifyDownload(this)'>")
			document.write("<INPUT type='hidden' NAME='recipient' VALUE='contact@h-pi.com'>")
			document.write("<INPUT type='hidden' NAME='subject' VALUE='"+theDownloads[k]+"-MAC Download'>")
			document.write("<INPUT type='hidden' NAME='redirect' VALUE='http://h-pi.com/"+thePaths[k]+"'>")
			document.write("<INPUT type='hidden' NAME='UserName' VALUE=''>")
			document.write("<INPUT type='hidden' NAME='Email' VALUE=''>")
			document.write("<INPUT type='hidden' NAME='Message' VALUE=''>")
			document.write("<INPUT type='hidden' NAME='App' VALUE='"+theDownloads[k]+" - MAC'>")
			var p = theSoftwareData[0].indexOf("(")-1
			var theReleaseDate = theSoftwareData[0].substr(0, p)
			var theFileSize = theSoftwareData[0].substr(p+2, theSoftwareData[0].length - (p+2) - 1)
			document.write("<p align='left'><font color='#fff'>release date:</font> &nbsp;"+theReleaseDate+"</p>")
			document.write("<p align='right'><font color='#fff'>file size:</font>&nbsp;"+theFileSize+" &nbsp;&nbsp;&nbsp;")
			if (theSoftwareData[0] != "TEMPORARILY UNAVAILABLE ") {
				document.write("<INPUT type='SUBMIT' VALUE='Download'>")
			}
			document.write("</p></FORM></th>")
			
			if ( theSoftwareData[1] != undefined ) {
				document.write("<th class='dl'><FORM NAME='DOWNLOAD' METHOD='POST' ACTION='/cgi-bin/formmail.pl' onSubmit='return verifyDownload(this)'>")
				document.write("<INPUT type='hidden' NAME='recipient' VALUE='contact@h-pi.com'>")
				document.write("<INPUT type='hidden' NAME='subject' VALUE='"+theDownloads[k]+"-WIN Download'>")
				document.write("<INPUT type='hidden' NAME='redirect' VALUE='http://h-pi.com/"+thePaths[k+1]+"'>")
				document.write("<INPUT type='hidden' NAME='UserName' VALUE=''>")
				document.write("<INPUT type='hidden' NAME='Email' VALUE=''>")
				document.write("<INPUT type='hidden' NAME='Message' VALUE=''>")
				document.write("<INPUT type='hidden' NAME='App' VALUE='"+theDownloads[k]+" - WIN'>")
				var p = theSoftwareData[1].indexOf("(")-1
				var theReleaseDate = theSoftwareData[1].substr(0, p)
				var theFileSize = theSoftwareData[1].substr(p+2, theSoftwareData[1].length - (p+2) - 1)
				document.write("<p align='left'><font color='#fff'>release date:</font> &nbsp;"+theReleaseDate+"</p>")
				document.write("<p align='right'><font color='#fff'>file size:</font>&nbsp;"+theFileSize+" &nbsp;&nbsp;&nbsp;")
				if (theSoftwareData[1] != "TEMPORARILY UNAVAILABLE ") {
					document.write("<INPUT type='SUBMIT' VALUE='Download'>")
				}
				document.write("</p></FORM></th>")
			}
			else {
				document.write("<td><center>&mdash;</center></td>")
			}
			document.write("</tr>")
			if (withFooter == true) {
				document.write("<tr><th bgcolor='#ffffff' colspan='2'>The Windows versions are reported to")
				document.write(" work on Linux Ubuntu using <a target='parent' href='http://www.winehq.org/site/download'>WineHQ</a>.</th>")
				document.write("<th bgcolor='#ffffff'><img vspace=6 hspace=3 valign='middle' src='images/linux_logo.gif'> + ")
				document.write("<img vspace=6 hspace=3 valign='middle' src='images/winehq_logo.gif'> (Ubuntu/WineHQ)</th>")
				document.write("</tr></table></p>")
			}
		}
	}
}

function DownloadSoftwareList(theProduct, m) {
	<!-- document.write("<a href='"+baseurl+thePaths[m]+"'>"+theDownloads[m].split("#")[1]+" for Mac</a><br>") -->
	<!-- document.write("<a href='"+baseurl+thePaths[m+1]+"'>"+theDownloads[m+1].split("@")[1]+"</a><br>") -->
	document.write("<a href='"+baseurl+"downloads.html'>"+theDownloads[m].split("#")[1]+" for Mac</a><br>")
	document.write("<a href='"+baseurl+"downloads.html'>"+theDownloads[m+1].split("@")[1]+"</a><br>")
}
