/*
Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
Copyright 2002 by Sharon Paine
Visit http://www.dynamicdrive.com for this script
*/

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

var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

// resize fix for ns4
var origWidth, origHeight;
if (ns4) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

// 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= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 600;
var offX= 20;	// how far from mouse to show tip
var offY= 12; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "8pt";
// 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= "#FFFFFF";
var tipBgColor= "#333333"; 
var tipBorderColor= "#154171";
var tipBorderWidth= 3;
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

//BEEL
messages[0] = new Array('pics/Brittany Beel Website.jpg','Brittany is a junior from the sunny and hurricane prone state of Florida! She loves singing (obviously) as well going to the movies (any chic flick or romantic comedy or movie with Reese Witherspoon), putting chocolate in her popcorn, watching SNL (SIMMA DOWN NOW!), and going to Disney World to eat caramel apples with Mickey Mouse. Brittany also is an avid shopper and enjoys going to Beverly Hills to walk on Rodeo Drive with Sandra Bullock (*true story*). When she&rsquo;s not shopping or mimicking SNL skits, she can be found near the Eiffel Tower, as she loves French! In fact, Brittany plans to major in French, but also to attend medical school...all while wearing high heels and her favorite lip gloss.');
//DUCK
messages[1] = new Array('pics/Brittany Website.jpg','Brittany... DUCK! is from Manalapan, New Jersey.  In addition to Rhythm & Blue, Brittany is currently involved in every Duke extracurricular activity.  Yeah, that&#8217;s right.  All of them.  We have no idea how she does it, but she pulls it off.  And she still has time to brush her teeth 6 times every day.  (Brittany&#8217;s gums have the consistency of Jell-O.)  Brittany likes hip-hop music, drama (yes, the theater kind... but mostly the ahhh-my-life-is-so-crazy kind), and rock candy.  And odds are, she didn&#8217;t get that joke you just told... ... ...until now.');
//EDIE
messages[2] = new Array('pics/Edie Website.jpg','Edie is a junior hailing from Charlotte- The Queen City of North Carolina! Double-majoring in Music and Theatre Studies, she will most likely use her Duke education to become a waitress or a bartender.  However, she will also use Duke University as a means for finding a sexy Econ major who she can marry solely for the money he will eventually make on Wall Street.  After she milks him for all he&#8217;s worth, she&#8217;ll divorce him, get a huge settlement and move to an obscenely large villa in the south of France.  Edie would also like to point out that she is, in no way, a greedy, manipulative, and&#47;or deceitful gold-digger.');
//ABBEY
messages[3] = new Array('pics/Abbey Website.jpg','Abbey is reppin&#8217; her hizzle state of North Carolina.  She is pretty much the most gangsta person you&#8217;ll ever meet.  Ever.  In between her prison sentences (who knew bein&#8217; fly was a crime?), she enjoys vegetable carving, eating waffles and drug trafficking Crystal Light.  She would like to give a special shoutout to God, her family and Jasmine, her puppy homedawg.');
//REN
messages[4] = new Array('pics/Ren Website.jpg','Ren is currently a senior in Trinity and she is majoring in ChangingMajors--it was biology, then music, then psychology, now cultural anthropology--by the time you finish reading this, it might&#8217;ve changed. When she&#8217;s not co-music directing RnB, Ren enjoys doing impersonations of popstars (aka spitney bears), painting her toenails, using cheesy pick-up lines, and being dared to eat large quantities of food. Oh, and north central Florida IS the south (GO GATORS).. and she&#8217;s from TAIWAN.. not China. Get it straight.');
//KATIE
messages[5] = new Array('pics/Katie Website.jpg','Katie comes from the land of the Yankees (sorry Scott) and take out Chinese food, but ever since coming to Duke last fall she can usually be found at Subway where she consumes all of her meals. Katie can also be spotted singing Enrique Iglesias, her karaoke artist of choice, or playing badminton, which, yes, is incredibly intense despite popular belief. Other pastimes include reenacting scenes from Grey&#8217;s Anatomy and South Park with her friends, hosting ping pong tournaments, watching Jeopardy religiously and taking baths. She is a complete acappella freak so she cannot wait for this year with Rhythm and Blue! yeyeyeye!');
//AMBER
messages[6] = new Array('pics/amber_site.jpg','Amber - Bio coming soon!');
//LAILA
messages[7] = new Array('pics/laila_site.jpg','Laila - Bio coming soon!');
//MATT
messages[8] = new Array('pics/Matt C Website.jpg','Matt - bio coming soon!');
//PEEF
messages[9] = new Array('pics/Peter Farmer Website.jpg','(Peef - bio coming soon!)');
//PEEP
messages[10] = new Array('pics/Peter Website.jpg','Peter is a junior from up north, Toronto, Canada. While he is still getting used to the hot sun of D-town, he has problems saying soda not pop, restroom/bathroom not washroom, silverware not cutlery. Since when were colour, centre, cheque spelled color, center, check? (These Americans need to learn how to spell, eh?) Singing makes up for approximately 74.233% of mass of Peter&#8217;s heart. Now that he&#8217;s in RnB, he sings, beatboxes, harmonizes, breathes, and lives RnB 25.47 hours a day. Also, if you approach him and call for his alter ego, Spiderman!, he might smile mischievously and say "FFTT FFTT".');
//JOSH
messages[11] = new Array('pics/Josh Website.jpg','Enough said');
//MICHAEL
messages[12] = new Array('pics/michael_site.jpg','Michael - Bio coming soon!');
//ELLIOTT
messages[13] = new Array('pics/elliott_site.jpg','Elliott - Bio coming soon!');
//AJ
messages[14] = new Array('pics/aj_site.jpg','AJ is the perfect Southern gentleman coming from Columbus, Georgia. He is a sophomore who can’t decide what he wants to major in because he‘s just so darn good at everything. AJ provides lots of laughs and a sense of style that would make Giorgio Armani jealous. After graduating, he would like to have a job where he makes enough money to match his desire for the finer things in life. His lifelong goal is to become the world’s greatest pop/ R&B (haha. R&B!!! get it?!) artist ever. Usher, just let it burn. Elton, can you feel the loss of fans?  Michael, there’s a new thriller in town!');
//ROBERT
messages[15] = new Array('pics/Robert Website.jpg','Robert Krattli is a junior coming from that well-known, highly superficial and highly tanned and bleached heaven, the OC.  In his spare time Robert enjoys hiking, swimming, playing tennis (rarely) and just being outside in nature climbing trees and such.  Being a social boy, one can often find him at the beach or lounging about in the sun (I mean, who DOESN&#8217;T work on their tan?).  He is also involved in Duke&#8217;s student-run musical theater group Hoof &#8217;n&#8217; Horn.  As of yet, Robert is still pre-med, despite orgo&#8217;s daunting weight on his shoulders and he hopes to become involved with Doctors Without Borders, traveling to exotic places. ');
//CHRIS
messages[16] = new Array('pics/chris_site.png','Chris is a sophomore from the single most awesome town in the world - Palo Alto, California. When not singing, plunking on the piano, or practicing his British accent, Chris enjoys embarrassing himself by attempting to dance. He also enjoys not embarrassing himself by showing people how it&rsquo;s done in various video games, speaking in foreign languages, and reading every fantasy book known to man. Chris is currently trying to determine what he should major in, but plans to pursue a career in law. <3 RnB');
//IAN
messages[17] = new Array('pics/ianSite.jpg','Ian - Bio coming soon!');
//BRIAN
messages[18] = new Array('pics/brian_site.jpg','Brian - Bio coming soon!');

////////////////////  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 for all but ns4. 
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ns4)? document.tipDiv.document: (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = (ns4)? document.tipDiv: 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) {
		if (ns4) document.captureEvents(Event.MOUSEMOVE);
		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
	if (messages[num][2])	var curBgColor = messages[num][2];
	else curBgColor = tipBgColor;
	if (messages[num][3])	var curFontColor = messages[num][3];
	else curFontColor = tipFontColor;
	if (ns4) {
		var tip = '<table bgcolor="' + tipBorderColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding="' + tipBorderWidth + '" border="0"><tr><td><table bgcolor="' + curBgColor + '" width="100%" cellspacing="0" cellpadding="' + tipPadding + '" border="0"><tr><td>'+ startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr + '</td></tr></table></td></tr></table>';
		tooltip.write(tip);
		tooltip.close();
	} else 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) {
	mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
	mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.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) {
		mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
		mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ns4)? tooltip.width: (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ns4)? tooltip.height: (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns4||ns5)? window.innerWidth-20+window.pageXOffset: document.body.clientWidth+document.body.scrollLeft;
	var winHt = (ns4||ns5)? window.innerHeight-20+window.pageYOffset: document.body.clientHeight+document.body.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = (ns4)? mouseX-(tpWd+offX): mouseX-(tpWd+offX)+"px";
	else tipcss.left = (ns4)? mouseX+offX: mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = (ns4)? winHt-(tpHt+offY): winHt-(tpHt+offY)+"px";
	else tipcss.top = (ns4)? mouseY+offY: mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

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

//-->