<!-- APPLE QUICKTIME JAVASCRIPT PATCH -->
/*

File: AC_QuickTime.js

Abstract: This file contains functions to generate OBJECT and EMBED tags for QuickTime content.

Version: <1.1>

*/

/************** LOCALIZABLE GLOBAL VARIABLES ****************/

var gArgCountErr =	'The "%%" function requires an even number of arguments.'
				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';

/******************** END LOCALIZABLE **********************/

var gTagAttrs				= null;
var gQTGeneratorVersion		= 1.0;

function AC_QuickTimeVersion()	{ return gQTGeneratorVersion; }

function _QTComplain(callingFcnName, errMsg)
{
    errMsg = errMsg.replace("%%", callingFcnName);
	alert(errMsg);
}

function _QTAddAttribute(prefix, slotName, tagName)
{
	var		value;

	value = gTagAttrs[prefix + slotName];
	if ( null == value )
		value = gTagAttrs[slotName];

	if ( null != value )
	{
		if ( 0 == slotName.indexOf(prefix) && (null == tagName) )
			tagName = slotName.substring(prefix.length); 
		if ( null == tagName ) 
			tagName = slotName;
		return '' + tagName + '="' + value + '"';
	}
	else
		return "";
}

function _QTAddObjectAttr(slotName, tagName)
{
	// don't bother if it is only for the embed tag
	if ( 0 == slotName.indexOf("emb#") )
		return "";

	if ( 0 == slotName.indexOf("obj#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("obj#", slotName, tagName);
}

function _QTAddEmbedAttr(slotName, tagName)
{
	// don't bother if it is only for the object tag
	if ( 0 == slotName.indexOf("obj#") )
		return "";

	if ( 0 == slotName.indexOf("emb#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("emb#", slotName, tagName);
}


function _QTAddObjectParam(slotName, generateXHTML)
{
	var		paramValue;
	var		paramStr = "";
	var		endTagChar = (generateXHTML) ? ' />' : '>';

	if ( -1 == slotName.indexOf("emb#") )
	{
		// look for the OBJECT-only param first. if there is none, look for a generic one
		paramValue = gTagAttrs["obj#" + slotName];
		if ( null == paramValue )
			paramValue = gTagAttrs[slotName];

		if ( 0 == slotName.indexOf("obj#") )
			slotName = slotName.substring(4); 
	
		if ( null != paramValue )
			paramStr = '<param name="' + slotName + '" value="' + paramValue + '"' + endTagChar;
	}

	return paramStr;
}

function _QTDeleteTagAttrs()
{
	for ( var ndx = 0; ndx < arguments.length; ndx++ )
	{
		var attrName = arguments[ndx];
		delete gTagAttrs[attrName];
		delete gTagAttrs["emb#" + attrName];
		delete gTagAttrs["obj#" + attrName];
	}
}

		

// generate an embed and object tag, return as a string
function _QTGenerate(callingFcnName, generateXHTML, args)
{
	// is the number of optional arguments even?
	if ( args.length < 4 || (0 != (args.length % 2)) )
	{
		_QTComplain(callingFcnName, gArgCountErr);
		return "";
	}
	
	// allocate an array, fill in the required attributes with fixed place params and defaults
	gTagAttrs = new Object();
	gTagAttrs["src"] = args[0];
	gTagAttrs["width"] = args[1];
	gTagAttrs["height"] = args[2];
	gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
		//Important note: It is recommended that you use this exact classid in order to ensure a seamless experience for all viewers
	gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";

	// set up codebase attribute with specified or default version before parsing args so
	//  anything passed in will override
	var activexVers = args[3]
	if ( (null == activexVers) || ("" == activexVers) )
		activexVers = "6,0,2,0";
	gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;

	var	attrName,
		attrValue;

	// add all of the optional attributes to the array
	for ( var ndx = 4; ndx < args.length; ndx += 2)
	{
		attrName = args[ndx].toLowerCase();
		attrValue = args[ndx + 1];

		// "name" and "id" should have the same value, the former goes in the embed and the later goes in
		//  the object. use one array slot 
		if ( "name" == attrName || "id" == attrName )
			gTagAttrs["name"] = attrValue;

		else 
			gTagAttrs[attrName] = attrValue;
	}

	// init both tags with the required and "special" attributes
	var objTag =  '<object '
					+ _QTAddObjectAttr("classid")
					+ _QTAddObjectAttr("width")
					+ _QTAddObjectAttr("height")
					+ _QTAddObjectAttr("codebase")
					+ _QTAddObjectAttr("name", "id")
					+ _QTAddObjectAttr("tabindex")
					+ _QTAddObjectAttr("hspace")
					+ _QTAddObjectAttr("vspace")
					+ _QTAddObjectAttr("border")
					+ _QTAddObjectAttr("align")
					+ _QTAddObjectAttr("class")
					+ _QTAddObjectAttr("title")
					+ _QTAddObjectAttr("accesskey")
					+ _QTAddObjectAttr("noexternaldata")
					+ '>'
					+ _QTAddObjectParam("src", generateXHTML);
	var embedTag = '<embed '
					+ _QTAddEmbedAttr("src")
					+ _QTAddEmbedAttr("width")
					+ _QTAddEmbedAttr("height")
					+ _QTAddEmbedAttr("pluginspage")
					+ _QTAddEmbedAttr("name")
					+ _QTAddEmbedAttr("align")
					+ _QTAddEmbedAttr("tabindex");

	// delete the attributes/params we have already added
	_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex",
					"hspace","vspace","border","align","noexternaldata","class","title","accesskey");

	// and finally, add all of the remaining attributes to the embed and object
	for ( var attrName in gTagAttrs )
	{
		attrValue = gTagAttrs[attrName];
		if ( null != attrValue )
		{
			embedTag += _QTAddEmbedAttr(attrName);
			objTag += _QTAddObjectParam(attrName, generateXHTML);
		}
	} 

	// end both tags, we're done
	return objTag + embedTag + '></em' + 'bed></ob' + 'ject' + '>';
}

// return the object/embed as a string
function QT_GenerateOBJECTText()
{
	return _QTGenerate("QT_GenerateOBJECTText", false, arguments);
}

function QT_GenerateOBJECTText_XHTML()
{
	return _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
}

function QT_WriteOBJECT()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT", false, arguments));
}

function QT_WriteOBJECT_XHTML()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT_XHTML", true, arguments));
}

<!-- H-PI JAVASCRIPT BY AARON ANDREW HUNT-->
	var msgParts = new Array()
	var msgLinks = new Array()
	var recentParts = new Array()
	var recentLinks = new Array()
	var theTime = new Date()
	var theMonth = theTime.getMonth()
	var theDay = theTime.getDate()
	var theYear = theTime.getFullYear()
	var theMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
	var baseurl = "http://www.h-pi.com/"
	var cartid = "thecart"
	var rssid = "rss"
	var hpiid = "webfront"
	var normalcart = new Image(28,28);
	var glowingcart = new Image(28,28);
	var normalrss = new Image(14,14);
	var glowingrss = new Image(14,14);
	var normalhpi = new Image(305,50);
	var glowinghpi = new Image(305,50);
	normalcart.src=baseurl+'images/shoppingcart.png'
	glowingcart.src=baseurl+'images/shoppingcartsel.png'
	normalrss.src=baseurl+'images/rss.gif'
	glowingrss.src=baseurl+'images/rsssel.gif'
	normalhpi.src=baseurl+'images/hpiheader.jpg'
	glowinghpi.src=baseurl+'images/hpiheader_glowing.jpg'
	
	var mdiv = "&equiv;"
	var fhdiv = "&nbsp;&nbsp;"
	var hdiv = "&nbsp;&nbsp;&nbsp;&rarr;&nbsp;&nbsp;"
	var hsdiv = "&nbsp;:"
	var hpre = "<font size=3>&nbsp;</font>"
	var smdiv = "&nbsp;&oplus;&nbsp;"
	var imdiv = "&oplus;"
	var URL = location.href
	var linkURL = ""
	var thislink = ""
	var selClass = new Array("class='sel'","","","","","")

	<!-- ALL MAIN VARIABLES -->
	var navCats = new Array()
	var catLinks = new Array()
	var catLengths = new Array()
	var navItems = new Array()
	var navLinks = new Array()

	<!-- ALL SUBMENU VARIABLES -->
	var subLengths = new Array()
	var subItems = new Array()
	var subLinks = new Array()
	
navCats.push("MAIN")
catLinks.push("index.html")
catLengths.push(4)

	navItems.push("Shopping Cart")
	navLinks.push("shoppingcart.html")
	subLengths.push(0)
	
	navItems.push("About")
	navLinks.push("about.html")
	subLengths.push(0)
		
	navItems.push("FAQ")
	navLinks.push("faq.html")
	subLengths.push(3)
		
		subItems.push("General FAQ")
		subItems.push("Tuning Box FAQ")
		subItems.push("Tonal Plexus FAQ")
		
		subLinks.push("faq.html")
		subLinks.push("TBX1faq.html?p=FAQ")
		subLinks.push("TPX28faq.html?p=FAQ")
	
	//navItems.push("Prototypes")
	//navLinks.push("prototypes.html")
	//subLengths.push(7)
	
		//subItems.push("About Prototypes")
		//subItems.push("Scale Station")
		//subItems.push("MIDI Action Stomp Hub")
		//subItems.push("External Plexus Control")
		//subItems.push("mini MOD Controllers")
		//subItems.push("MegaTuner")
		//subItems.push("Tonal Plexus Prototypes")
		
		//subLinks.push("prototypes.html")
		//subLinks.push("protoSCST.html")
		//subLinks.push("protoMASH.html")
		//subLinks.push("protoEPC1.html")
		//subLinks.push("protoMiniMOD.html")
		//subLinks.push("protoMTR1.html")
		//subLinks.push("protoTPX.html")	

	navItems.push("Search Site")
	navLinks.push("googlesearch.html")
	subLengths.push(0)
	
navCats.push("Tuning Box")
catLinks.push("TBX1buy.html")
catLengths.push(7)
	
		navItems.push("Buy")
		navLinks.push("TBX1buy.html")
		subLengths.push(0)
		
		navItems.push("Setups")
		navLinks.push("TBX1setups.html")
		subLengths.push(0)
		
		navItems.push("Compatibility")
		navLinks.push("gm.html?p=TBX1")
		subLengths.push(0)
		
		navItems.push("Custom Scale Editor")
		navLinks.push("CSEsoftware.html")
		subLengths.push(4)
		
			subItems.push("Details")
			subItems.push("Download")
			subItems.push("Donate")
			subItems.push("Bug Reports")
			
			subLinks.push("CSEsoftware.html")
			subLinks.push("downloads.html?p=CSE")
			subLinks.push("softwarebuy.html#CSE_buy")
			subLinks.push("CSEreports.html?p=CSE")
		
		navItems.push("Scale Archive")
		navLinks.push("cgi-bin/filearchive.pl?folder=csefiles&extension=.cse")
		subLengths.push(0)
		
		navItems.push("FAQ")
		navLinks.push("TBX1faq.html")
		subLengths.push(0)
		
		navItems.push("Upgrade")
		navLinks.push("TBX1upgrade.html")
		subLengths.push(0)
		

navCats.push("Tonal Plexus")
catLinks.push("TPX28buy.html")
catLengths.push(11)

	navItems.push("Buy")
	navLinks.push("TPX28buy.html")
	subLengths.push(0)
	
	navItems.push("Layout")
	navLinks.push("TPX28keyboard.html")
	subLengths.push(0)
	
	navItems.push("Intervals")
	navLinks.push("TPX28intervals.html")
	subLengths.push(0)
	
	navItems.push("Tuning Editor")
	navLinks.push("TPXEsoftware.html")
	subLengths.push(4)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Bug Reports")
		
		subLinks.push("TPXEsoftware.html")
		subLinks.push("downloads.html?p=TPXE")
		subLinks.push("softwarebuy.html#TPXE_buy")
		subLinks.push("TPXEreports.html?p=TPXE")

	navItems.push("Scale Archive")
	navLinks.push("cgi-bin/filearchive.pl?folder=tpxfiles&extension=.tpx")
	subLengths.push(0)
	
	navItems.push("Synth Editor")
	navLinks.push("PXSCsoftware.html")
	subLengths.push(4)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Bug Reports")

		subLinks.push("PXSCsoftware.html")
		subLinks.push("downloads.html?p=PXSC")
		subLinks.push("softwarebuy.html#PXSC_buy")
		subLinks.push("PXSCreports.html?p=PXSC")	
	
	navItems.push("Videos")
	navLinks.push("videos.html")
	subLengths.push(0)
	
	navItems.push("Compatibility")
	navLinks.push("gm.html?p=TPX28")
	subLengths.push(0)
	
	navItems.push("Comparison Charts")
	navLinks.push("TPX28compare.html")
	subLengths.push(0)
	
	navItems.push("FAQ")
	navLinks.push("TPX28faq.html")
	subLengths.push(0)
	
	navItems.push("Upgrade")
	navLinks.push("TPX28upgrade.html")
	subLengths.push(0)


//navCats.push("GADGETS")
//catLinks.push("gadgets.html")
//catLengths.push(4)
	
//	navItems.push("Buy")
//	navLinks.push("gadgetsbuy.html")
//	subLengths.push(0)
	
//	navItems.push("USB project board")
//	navLinks.push("gadget.php?p=0")
//	subLengths.push(0)
	
//	navItems.push("Key row expander")
//	navLinks.push("gadget.php?p=1")
//	subLengths.push(0)
	
//	navItems.push("Key matrix expander")
//	navLinks.push("gadget.php?p=2")
//	subLengths.push(0)


navCats.push("SOFTWARE")
catLinks.push("softwarebuy.html")
catLengths.push(9)
	
	navItems.push("Buy")
	navLinks.push("softwarebuy.html")
	subLengths.push(0)
	
	navItems.push("SCORDATURA")
	navLinks.push("SCRDsoftware.html")
	subLengths.push(4)
		
		subItems.push("Buy")
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Bug Reports")
		
		subLinks.push("softwarebuy.html#SCRD_buy")
		subLinks.push("SCRDsoftware.html")
		subLinks.push("downloads.html?p=SCRD")
		subLinks.push("SCRDreports.html?p=SCRD")
	
	navItems.push("XENTONE")
	navLinks.push("XENTsoftware.html")
	subLengths.push(4)
		
		subItems.push("Buy")
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Bug Reports")
		
		subLinks.push("softwarebuy.html#XENTONE_buy")
		subLinks.push("XENTsoftware.html")
		subLinks.push("downloads.html?p=XENT")
		subLinks.push("XENTreports.html?p=XENT")		
		
	navItems.push("HPLF 2")
	navLinks.push("HPLFsoftware.html")
	subLengths.push(4)
		
		subItems.push("Buy")
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Bug Reports")
		
		subLinks.push("softwarebuy.html#HPLF_buy")
		subLinks.push("HPLFsoftware.html")
		subLinks.push("downloads.html?p=HPLF")
		subLinks.push("HPLFreports.html?p=HPLF")	
			
	navItems.push("CSE")
	navLinks.push("CSEsoftware.html")
	subLengths.push(4)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Bug Reports")
		
		subLinks.push("CSEsoftware.html")
		subLinks.push("downloads.html?p=CSE")
		subLinks.push("softwarebuy.html#CSE_buy")
		subLinks.push("CSEreports.html?p=CSE")

	navItems.push("TPXE")
	navLinks.push("TPXEsoftware.html")
	subLengths.push(4)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Bug Reports")
		
		subLinks.push("TPXEsoftware.html")
		subLinks.push("downloads.html?p=TPXE")
		subLinks.push("softwarebuy.html#TPXE_buy")
		subLinks.push("TPXEreports.html?p=TPXE")

	navItems.push("ScalaVista")
	navLinks.push("ScalaVistasoftware.html")
	subLengths.push(4)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Bug Reports")
		
		subLinks.push("ScalaVistasoftware.html")
		subLinks.push("downloads.html?p=ScalaVista")
		subLinks.push("softwarebuy.html#ScalaVista_buy")
		subLinks.push("ScalaVistareports.html?p=ScalaVista")	
		
	navItems.push("PXSC")
	navLinks.push("PXSCsoftware.html")
	subLengths.push(4)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Bug Reports")
			
		subLinks.push("PXSCsoftware.html")
		subLinks.push("downloads.html?p=PXSC")
		subLinks.push("softwarebuy.html#PXSC_buy")
		subLinks.push("PXSCreports.html?p=PXSC")		
		
	navItems.push("MEGASCORE")
	navLinks.push("MSCfeatures.html")
	subLengths.push(14)
		
		subItems.push("Details")
		subItems.push("Download")
		subItems.push("Donate")
		subItems.push("Introduction")
		subItems.push("Staff")
		subItems.push("Clefs")
		subItems.push("Naturals")
		subItems.push("Signs")
		subItems.push("Accidentals")
		subItems.push("Shifts")
		subItems.push("Inflections")
		subItems.push("Keys")
		subItems.push("Scales")
		subItems.push("Paper")	
		
		subLinks.push("MSCfeatures.html")
		subLinks.push("downloads.html")
		subLinks.push("softwarebuy.html#MegaScore_buy")
		subLinks.push("MSCintro.html")
		subLinks.push("megastaff/staff.html")
		subLinks.push("megastaff/clefs.html")
		subLinks.push("megastaff/naturals.html")
		subLinks.push("megastaff/signs.html")
		subLinks.push("megastaff/accidentals.html")
		subLinks.push("megastaff/shifts.html")
		subLinks.push("megastaff/inflections.html")
		subLinks.push("megastaff/keys.html")
		subLinks.push("megastaff/scales.html")
		subLinks.push("staffpaper.html")

navCats.push("DOWNLOADS")
catLinks.push("downloads.html")
catLengths.push(6)

	navItems.push("Software & Manuals")
	navLinks.push("downloads.html")
	subLengths.push(0)
	
	navItems.push("Music Files")
	navLinks.push("musicFiles.html")
	subLengths.push(0)
	
	navItems.push("Videos")
	navLinks.push("videos.html")
	subLengths.push(0)
	
	navItems.push("Soundfonts")
	navLinks.push("soundfonts.html")
	subLengths.push(0)
	
	navItems.push("Megastaff Paper")
	navLinks.push("staffpaper.html")
	subLengths.push(0)
	
	navItems.push("Free Books on Tuning")
	navLinks.push("tuningbooks.html")
	subLengths.push(0)
	
navCats.push("XENTONALITY")
catLinks.push("theory/foreword.html")
catLengths.push(3)

	navItems.push("H-System Music Theory")
	navLinks.push("theory/foreword.html")
	subLengths.push(8)
	
		subItems.push("Foreword")
		subItems.push("1 Naturals")
		subItems.push("2 Intervals")
		subItems.push("3 Accidentals")
		subItems.push("4 Measurement")
		subItems.push("5 Triads")
		subItems.push("6 Superscales")
		subItems.push("7 H-System")
	
		subLinks.push("theory/foreword.html")
		subLinks.push("theory/naturals1.html")
		subLinks.push("theory/intervals1.html")
		subLinks.push("theory/accidentals1.html")
		subLinks.push("theory/measurement1.html")
		subLinks.push("theory/triads1.html")
		subLinks.push("theory/superscales1.html")
		subLinks.push("theory/huntsystem1.html")
		
	navItems.push("Microtonal History")
	navLinks.push("eop-quotes.html")
	subLengths.push(6)
	
		subItems.push("Quotes")
		subItems.push("Microtonal Pioneers")
		subItems.push("Schoenberg")
		subItems.push("Bartok")
		subItems.push("Ogolevets")
		subItems.push("Tuning Pitches")
		
		subLinks.push("eop-quotes.html")
		subLinks.push("eop-pioneers.html")
		subLinks.push("eop-schoenberg.html")
		subLinks.push("eop-bartok.html")
		subLinks.push("eop-ogolevets.html")
		subLinks.push("eop-tuning.html")
	
	navItems.push("Instrument Galleries")
	navLinks.push("eop-keyboards.html")
	subLengths.push(2)
	
		subItems.push("Keyboards")
		subItems.push("Guitars")
		
		subLinks.push("eop-keyboards.html")
		subLinks.push("eop-guitars.html")
		
navCats.push("NEWS")
catLinks.push("webupdates.html")
catLengths.push(5)
	
	navItems.push("Recent News")
	navLinks.push("webupdates.html")
	subLengths.push(0)
	
	navItems.push("Blog")
	navLinks.push("wordpress/")
	subLengths.push(0)
	
	navItems.push("Press Releases")
	navLinks.push("press.html")
	subLengths.push(0)

	navItems.push("In Print")
	navLinks.push("print.html")
	subLengths.push(0)
	
	navItems.push("Email Archive")
	navLinks.push("emails.html")
	subLengths.push(0)
	
navCats.push("&nbsp;CONTACT&nbsp;")
catLinks.push("contact.html")
catLengths.push(2)

	navItems.push("Email & Voicemail")
	navLinks.push("contact.html")
	subLengths.push(0)
	
	navItems.push("Live Chat")
	navLinks.push("microchat/?newchat")
	subLengths.push(0)

	<!-- iPhone FLAG -->
	var is_iphone = false;
	var agent = navigator.userAgent.toLowerCase();
	var find_iphone = (agent.indexOf('iphone'));
	if (find_iphone > -1) { is_iphone = true; }

	<!-- DATE -->
	var CurrentDate = "<a class='topmenu' href='"+baseurl+"webupdates.html'>"
	CurrentDate += theMonths[theMonth]+" "+theDay+", "+theYear+"</a>"
	
	<!-- NEWS MESSAGES WITH LINKS -->
	msgParts.push("CSE 2.8 Released")
	msgLinks.push("href='"+baseurl+"wordpress/?p=93'")

	msgParts.push("Mark L. Vines on the Tonal Plexus")
	msgLinks.push("href='"+baseurl+"wordpress/?p=92'")

	var CurrentMsg = ""
	for (var j=0; j< msgParts.length; j++) {
		if (j > 0 && j < msgParts.length) { CurrentMsg += ", " }
		CurrentMsg += "<a class='topmenu' " + msgLinks[j] + ">" + msgParts[j] + "</a>"
	}
	
function navHeader(selectedItem, whichSubmenu, selectedSubitem) {
	
	<!-- HEADER -->
	<!-- 800x600 PAGE CONTAINER TABLE-->
	document.write("<center><table border='0' bgcolor='#ffffff' width='800' style='width:800px;' height='100%' cellpadding='0' cellspacing='0'>")
	<!-- OPEN GRAPHIC ROW -->
	document.write("<tr><td bgcolor='000000' height='50'>")
	
		<!-- TOP BANNER TABLE-->
		document.write("<table width=100% height='50' cellspacing='0' cellpadding='0' border='0'>")
		document.write("<tr><td width=240 height='50'><a class='home' href='"+baseurl+"index.html'>")
		document.write("<img id='webfront' border='0' width='305' height='50' valign='top' src='"+baseurl+"images/hpiheader.jpg' onmouseover='document.getElementById(hpiid).src=glowinghpi.src' onmouseout='document.getElementById(hpiid).src=normalhpi.src'></a></td>")
		<!-- CART ICON -->
		document.write("<th height='50' width='36' class='hpihead'><a class='plain' href='"+baseurl+"shoppingcart.html'>")
		document.write("<img id='thecart' border=0 valign=top src='"+baseurl+"images/shoppingcart.png' onmouseover='document.getElementById(cartid).src=glowingcart.src' onmouseout='document.getElementById(cartid).src=normalcart.src'></a>")
		document.write("</th>")
		<!-- CURRENT DATE -->
		document.write("<td class='hpihead' height='50' style='white-space: nowrap; width: 107px;'>&nbsp;&nbsp;"+CurrentDate+" &ndash;</td>")
		<!-- CURRENT MESSAGE -->
		document.write("<td class='hpihead' height='50' style='width: 327px;'>"+CurrentMsg+"</td>")
		<!-- RSS ICON -->
		document.write("<td class='hpihead' height='50'><a class='plain' href='"+baseurl+"rss.xml'>")
		document.write("<img id='rss' border=0 height='14' hspace='4' valign=top src='"+baseurl+"images/rss.gif' onmouseover='document.getElementById(rssid).src=glowingrss.src' onmouseout='document.getElementById(rssid).src=normalrss.src'></a></td>")
		document.write("</tr></table></td></tr>")
	
	<!-- OPEN MENU -->
	document.write("<tr><td><ul id='nav' class='dropdown dropdown-horizontal'>")
	var t = 0
	var k = 0
	var subStart = 0
	var subEnd = 0
	var navStart = 0
	var navEnd = 0
	linkURL = baseurl
	<!-- ADD EACH HEADER MENU ITEM -->
	for (k=0; k < navCats.length; k++) {
		document.write("<li><a class='topmenu' href='"+linkURL+catLinks[k]+"'>"+navCats[k]+"</a><ul>")
		<!-- DROPDOWN ITEMS START WHERE? -->
		if (k > 0) {
			navStart = navStart + catLengths[k-1]
		}
		navEnd = navStart + catLengths[k]
		<!-- ADD EACH DROPDOWN ITEM -->
		for (t = navStart; t < navEnd; t++) {
			<!-- SUBITEMS START WHERE? -->
			if (t > 0) {
				subStart = subStart + subLengths[t-1]
			}
			if (subLengths[t] == 0) {
				<!-- NO SUBITEMS, CLOSE DROPDOWN LIST -->
				if (navItems[t] == "Live Chat") {
					document.write("<li><a onclick='openLiveChat()'>Live Chat</a></li>")			
				} else {
					document.write("<li><a href='"+linkURL+navLinks[t]+"'>"+navItems[t]+"</a></li>")
				}
			}
			else {
				document.write("<li><a class='dir' href='"+linkURL+navLinks[t]+"'>"+navItems[t]+"</a>")
				<!-- ADD EACH SUBITEM -->
				subEnd = subStart + subLengths[t]
				document.write("<ul>")
				for (j = subStart; j < subEnd; j++) {
					document.write("<li><a href='"+linkURL+subLinks[j]+"'>"+subItems[j]+"</a></li>")
				}
				<!-- FINISHED SUBITEMS, CLOSE SUBITEMS LIST, CLOSE DROPDOWN ITEM -->
				document.write("</ul></li>")
			}
		}
		<!-- CLOSE DROPDOWN LIST -->
		document.write("</ul></li>")
	}
	<!-- CLOSE MENU -->
	document.write("</ul></td></tr>")

	<!-- OPEN EMPTY PAGE CONTAINER -->
	document.write("<tr><td valign='top' height='550'>")	
}

function openLiveChat() {
	window.location = 'http://www.h-pi.com/microchat/index.php?newchat';				
}

function introheader(whichIntro) {
	document.write("<div class='intromenu'>")
	var subStart = 0
	var subEnd = 0
	var navStart = 0
	var navEnd = 0
	var navType = "sub"
	for (j = 0; j < navItems.length; j++) {
		if (whichIntro == navItems[j]) {
			for (var k = 1; k <= j; k++) {
				subStart = subStart + subLengths[k-1]
			}
			subEnd = subStart + subLengths[j] - 1
		}
	}
	if (subStart == subEnd) {
		navType = "cat"
		for (j = 0; j < navCats.length; j++) {
			if (whichIntro == navCats[j]) {
				for (var k = 1; k <= j; k++) {
					navStart = navStart + catLengths[k-1]
				}
				navEnd = navStart + catLengths[j] - 1
			}
		}
	}
	linkURL = baseurl
	document.write(whichIntro.toUpperCase()+"&nbsp;&rarr;&nbsp;") 
	if (navType == "sub") {
		for (j = subStart+1; j < subEnd+1; j++) {	
			thislink = subLinks[j]
			document.write("<a class='intromenu' href='"+linkURL+thislink+"'>"+subItems[j].toUpperCase()+"</a>")
			if (j != subEnd) {
				document.write(" "+imdiv+" ")
			}
		}
	}
	else {
		for (j = navStart+1; j < navEnd+1; j++) {	
			thislink = navLinks[j]
			document.write("<a class='intromenu' href='"+linkURL+thislink+"'>"+navItems[j].toUpperCase()+"</a>")
			if (j != navEnd) {
				document.write(" "+imdiv+" ")
			}
		}
	}
	document.write("</div>")
}


function gotoPage(whichCat) {
	document.location = whichCat
}


function RefreshAllImages() {
	var msec = clocktime.getUTCSeconds();
	for (var j = 0; j < document.images.length; j++) {
		document.images[j].src = document.images[j].src+'?'+msec
	}
}

function preventErrors(e) {
	if (e == "earlybird") {
		return true
	}
	else {
		return false
	}
}

function embedQTFile(theQTFileName) {
	var theMediaType = theQTFileName.split(".")[1]
	if (theMediaType == "mov") {
		QT_WriteOBJECT(theQTFileName, '350', '260', '', 'autoplay', 'false', 'loop', 'false', 'align', 'middle');
	}
	if (theMediaType == "mid") {
		QT_WriteOBJECT(theQTFileName, '100', '20', '', 'autoplay', 'false', 'loop', 'false', 'align', 'middle');
	}
}

function frameMe(theId) {
	var theElement = document.getElementById(theId);
	theElement.style.border = "1px solid #ddd";
}

function unframeMe(theId) {
	var theElement = document.getElementById(theId);
	theElement.style.border = "1px solid #fff";
}

function graphicShopLinks() {
	document.write("<center><br><table><tr>")
	document.write("<th><a class='plain' href='TBX1buy.html'><img class='framed' id='shop1' src='images/shop_tuningbox.jpg'></a></th>")
	document.write("<th><a class='plain' href='TPX28buy.html'><img class='framed' id='shop2' src='images/shop_keyboards.jpg'></a></th>")
	document.write("<th><a class='plain' href='softwarebuy.html'><img class='framed' id='shop3' src='images/shop_software.jpg'></a></th>")
	document.write("</tr><tr><th><a class='shop' href='TBX1buy.html'>TBX1</a></th>")
	document.write("<th><a class='shop' href='TPX28buy.html'>Keyboards</a></th>")
	document.write("<th><a class='shop' href='softwarebuy.html'>Software</a></th></tr>")
	document.write("</tr></table></center><br><br>")
}

function sendpage() {
	var printPageURL = "send2friend/friend.php?js=on&id="+document.URL
	window.open(printPageURL,"pop","width=650,height=500,toolbars=0,scrollbars=1")
}

function printpage() {
	window.open("printpage/printpage.php","pop","width=750,height=500,toolbars=0,scrollbars=1")
}

function theFooter() {
	document.write("</td><tr><td><div class='foot' id='theFooter'>&copy;2012 H-Pi Instruments</div></td></tr></table></center>")
}
