/* IMPORTANT: Put script after tooltip div or 
	 put tooltip div just before </BODY>. */

var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;
var cpu=0;
var ram=1;
var disk=2;
var cinema=3;
var symphony=4;
var converter=5;
var clock=6;
var preamp=7;
var jmp1=8;
var el84=9;
var cabinet=10;
var monitors=11;
var boombox=12;

var protools=13;
var logic=14;
var drumcore=15;
var ivory=16;
var sampletank=17;
var amplitube=18;
var autotune=19;
var melodyne=20;
var gold=21;
var tapehead=22;

var cactus=23;
var ntk=24;
var sm58=25;
var at=26;
var martin=27;
var strat=28;
var les=29;
var guild=30;
var kramer=31;
var digi=32;
var dx7=33;

var origWidth, origHeight;

// avoid error of passing event object in older browsers
if (nodyn) { event = "nope" }

///////////////////////  CUSTOMIZE HERE   ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tipFollowMouse= false;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 480;
var offX= 40;	// how far from mouse to show tip
var offY= 12; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "10pt";
// set default text color and background color for tooltip here
// individual tooltips can have their own (set in messages arrays)
// but don't have to
var tipFontColor= "black";
var tipBgColor= "beige"; 
var tipBorderColor= "#000080";
var tipBorderWidth= 1;
var tipBorderStyle= "ridge";
var tipPadding= 4;

// tooltip content goes here (image, description, optional bgColor, optional textcolor)
var messages = new Array();
// multi-dimensional arrays containing: 
// image and text for tooltip
// optional: bgColor and color to be sent to tooltip
messages[cpu] = new Array('','Lots of CPU power is needed for virtual instruments and plugins. Recent versions of Logic and ProTools take advantage of the multiple cores.');
messages[ram] = new Array('','The Mac Pro will hold 16G but 8G seems sufficient for even big virtual instruments like Ivory.');
messages[disk] = new Array('','Having several big internal hard drives makes it easy and quick to back up session files. The next step up would be to use RAID.');
messages[cinema] = new Array('','This beautiful, huge display lets you see the mix window and region windows all at once. It makes a great HD TV monitor as well.');
messages[digi] = new Array('','Used primarily as a dongle for ProTools and a midi router.');
messages[symphony] = new Array('','The Rosetta Symphony cards in the Mac and the converters allow an extremely low-latency audio channel for a host-based system.');
messages[converter] = new Array('','The Rosetta A/D and D/A converters are the best.');
messages[clock] = new Array('','A hyper-accurate clock allows the conversion to be completely transparent, preserving a high degree of imaging.');
messages[preamp] = new Array('','I use this class-A stereo pre-amp to give a big sound to vocals and acoustic guitar tracks.');
messages[jmp1] = new Array('','I used this great-sounding pre-amp for years on stage, since it allows a midi footswitch to select among the hundred or so presets. The 12AX7 tubes are an essential part of a great guitar sound.');
messages[el84] = new Array('','This power amp is a great companion to the JMP-1. The EL-84 tubes provide a mere 20 watts per channel, which means I could get that great-sounding power amp distortion at the relatively low volume levels required in a small club.');
messages[cabinet] = new Array('','This little cabinet is used for guitar tracking, with the JMP-1 and EL-84. It fits in my closet, where I have it close-miked with the SM-58. ');
messages[dx7] = new Array('','Used only as a midi keyboard controller.');
messages[monitors] = new Array('','These monitors come with a special mike and software that automatically calibrates the EQ based on the room acoustics. It also allows an application on the Mac to control volume and muting.');
messages[boombox] = new Array('','An important part of the mixing process is to make sure the track sounds good on a small system.');

messages[protools] = new Array('','The industry standard. Host systems are getting so powerful that the HD-based systems are no longer required for big-sounding productions.');
messages[logic] = new Array('','Version 8 of Apple\'s host system is much easier to use than Logic 7, and it has the interface for building comps out of multiple audio tracks.');
messages[drumcore] = new Array('','Although this has loops, I just use it for the drum kits, as a virtual instrument.');
messages[ivory] = new Array('','This is the best sounding digital piano I have heard.');
messages[sampletank] = new Array('','Loaded with the expansion packs, SampleTank provides thousands of usable instrument sounds.');
messages[amplitube] = new Array('','Although a real amp in a real studio with a good mike is hard to beat, this plugin provides a way to step through a variety of digitally modelled simulations until you get just the right guitar sound for the song.');
messages[autotune] = new Array('','All modern tracks have a bit of pitch correction.');
messages[melodyne] = new Array('','I\'m starting to use this more than AutoTune for pitch changes.');
messages[gold] = new Array('','The Waves Gold Bundle provides dozens of plugins I use for mixing in ProTools and Logic');
messages[tapehead] = new Array('','This great-sounding plugin makes drum tracks a bit thicker by simulating tape compression.');

messages[cactus] = new Array('','A high-end, large element tube condenser mic; it puts vocals and acoustic guitar tracks right up front in the mix.');
messages[ntk] = new Array('','This is a great, bright-sounding tube condensor mic.');
messages[sm58] = new Array('','A standard workhorse mic; I use it on the guitar cabinet.');
messages[at] = new Array('','A small-format condenser mic I used for vocals before I got the Cactus and the NTK.');
messages[martin] = new Array('','Martin builds beautiful guitars that make people better players. The Aura system provides a great alternative to a mic sound.');
messages[strat] = new Array('','I had this customized with big frets, Seymour Duncan pickups, and a 4-bolt neck fastener. It\'s sweeter than any girlfriend I ever had.');
messages[les] = new Array('','The thinner neck of the \'60 reissue plays better than the baseball-bat neck of the \'59, and the authentic Les Paul sound is essential on many rock tracks.');
messages[guild] = new Array('','Not a high-end guitar, but the wood is getting old and giving it a nice resonance.');
messages[kramer] = new Array('','Has a nice wide fretboard, fun to play.');

////////////////////  END OF CUSTOMIZATION AREA  ///////////////////

// preload images that are to appear in tooltip
// from arrays above
if (document.images) {
	var theImgs = new Array();
	for (var i=0; i<messages.length; i++) {
  	theImgs[i] = new Image();
		theImgs[i].src = messages[i][0];
  }
}

// to layout image and text, 2-row table, image centered in top cell
// these go in var tip in doTooltip function
// startStr goes before image, midStr goes between image and text
var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//		Global variables for tooltip. 
//		Set styles
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tipWidth+"px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;

/////////////////////////////////////////////////
//  doTooltip function
//			Assembles content for tooltip and writes 
//			it to tipDiv
/////////////////////////////////////////////////
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(evt,num) {
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	// set colors if included in messages array
	curBgColor = tipBgColor;
	curFontColor = tipFontColor;
	if (ie4||ie5||ns5) {
		var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//		If tipFollowMouse set false, so trackMouse function
//		not being used, get position of mouseover event.
//		Calculations use mouseover event position, 
//		offset amounts and tooltip width to position
//		tooltip within window.
/////////////////////////////////////////////////////////////
function positionTip(evt) {
	if (!tipFollowMouse) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')


