/*
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= 160;
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= "#000000";
var tipBgColor= "#DDECFF"; 
var tipBorderColor= "#333333";
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
messages[0] = new Array('../tawards/atea2005/fas/ChanWaiMeng.jpg','<B>Dr Chan Wai Meng<BR>Centre for Language Studies</B>',"#DDECFF");
messages[1] = new Array('../tawards/atea2005/fas/RitaNiemann.jpg','<B>Ms Rita M. Niemann<BR>Centre for Language Studies</B>',"#DDECFF");
messages[2] = new Array('../tawards/atea2005/fas/LimSunSun.jpg','<B>Dr Lim Sun Sun<BR>Communications & New Media Programme</B>',"#DDECFF");
messages[3] = new Array('../tawards/atea2005/fas/RajeevPatke.jpg','<B>A/P Rajeev Patke<BR>English Language & Literature</B>',"#DDECFF");
messages[4] = new Array('../tawards/atea2005/fas/SunitaAbraham.jpg','<B>Dr Sunita Abraham<BR>English Language & Literature</B>',"#DDECFF");
messages[5] = new Array('../tawards/atea2005/fas/PhilipHolden.jpg','<B>A/P Philip Holden<BR>English Language & Literature</B>',"#DDECFF");
messages[6] = new Array('../tawards/atea2005/fas/SusanAng.jpg','<B>Dr Susan Ang<BR>English Language & Literature</B>',"#DDECFF");
messages[7] = new Array('../tawards/atea2005/fas/BruceLockhart.jpg','<B>Dr Bruce Lockhart<BR>History</B>',"#DDECFF");
messages[8] = new Array('../tawards/atea2005/fas/IanGordon.jpg','<B>A/P Ian Gordon<BR>History</B>',"#DDECFF");
messages[9] = new Array('../tawards/atea2005/fas/SimonAvenell.jpg','<B>Dr Simon Andrew Avenell<BR>Japanese Studies</B>',"#DDECFF");
messages[10] = new Array('../tawards/atea2005/fas/CeciliaLim.jpg','<B>A/P Cecilia Lim Teck Neo<BR>Philosophy</B>',"#DDECFF");
messages[11] = new Array('../tawards/atea2005/fas/KennethPTan.jpg','<B>Dr Kenneth Paul Tan<BR>Political Science</B>',"#DDECFF");
messages[12] = new Array('../tawards/atea2005/fas/GanapathyNara.jpg','<B>Dr Narayanan Ganapathy<BR>Sociology</B>',"#DDECFF");

messages[13] = new Array('../tawards/atea2005/den/KelvinFoong.jpg','<B>A/P Kelvin Foong Weng Chiong<BR>Preventive Dentistry</B>',"#DDECFF");

messages[14] = new Array('../tawards/atea2005/eng/SFarooq.jpg','<B>Prof Farooq Shamsuzzaman<BR>Chemical & Biomolecular Engineering</B>',"#DDECFF");
messages[15] = new Array('../tawards/atea2005/eng/RangaiahPandu.jpg','<B>A/P Rangaiah Gade Pandu<BR>Chemical & Biomolecular Engineering</B>',"#DDECFF");
messages[16] = new Array('../tawards/atea2005/eng/RichardLiew.jpg','<B>A/P Richard Liew Jat Yuen<BR>Civil Engineering</B>',"#DDECFF");
messages[17] = new Array('../tawards/atea2005/eng/RBala.jpg','<B>Dr Rajasekhar Balasubramanian<BR>Division of Environmental Science and Engineering</B>',"#DDECFF");
messages[18] = new Array('../tawards/atea2005/eng/TanKayChen.jpg','<B>A/P Tan Kay Chen<BR>Electrical & Computer Engineering</B>',"#DDECFF");
messages[19] = new Array('../tawards/atea2005/eng/PohKimLeng.jpg','<B>A/P Poh Kim Leng<BR>Industrial & Systems Engineering</B>',"#DDECFF");
messages[20] = new Array('../tawards/atea2005/eng/GohTN.jpg','<B>Prof Goh Thong Ngee<BR>Industrial & Systems Engineering</B>',"#DDECFF");
messages[21] = new Array('../tawards/atea2005/eng/LeeKimSeng.jpg','<B>A/P Lee Kim Seng<BR>Mechanical Engineering</B>',"#DDECFF");
messages[22] = new Array('../tawards/atea2005/eng/PooAN.jpg','<B>Prof Poo Aun Neow<BR>Mechanical Engineering</B>',"#DDECFF");

messages[23] = new Array('../tawards/atea2005/law/EleanorWong.jpg','<B>A/P Eleanor Wong<BR>Faculty of Law</B>',"#DDECFF");

messages[24] = new Array('../tawards/atea2005/sci/AlexIp.jpg','<B>Prof Ip Yuen Kwong, Alex<BR>Biological Sciences</B>',"#DDECFF");
messages[25] = new Array('../tawards/atea2005/sci/GohSuatHong.jpg','<B>Prof Goh Suat Hong<BR>Chemistry</B>',"#DDECFF");
messages[26] = new Array('../tawards/atea2005/sci/AndyHorTS.jpg','<B> Prof Hor Tzi Sum, Andy<BR>Chemistry</B>',"#DDECFF");
messages[27] = new Array('../tawards/atea2005/sci/BrettMclnnes.jpg','<B>A/P Brett McInnes<BR>Mathematics</B>',"#DDECFF");
messages[28] = new Array('../tawards/atea2005/sci/VictorTan.jpg','<B>A/P Victor Tan<BR>Mathematics</B>',"#DDECFF");
messages[29] = new Array('../tawards/atea2005/sci/KohKheeMeng.jpg','<B>Prof Koh Khee Meng<BR>Mathematics</B>',"#DDECFF");
messages[30] = new Array('../tawards/atea2005/sci/TanEngChye.jpg','<B>Prof Tan Eng Chye<BR>Mathematics</B>',"#DDECFF");
messages[31] = new Array('../tawards/atea2005/sci/GohSaySong.jpg','<B>A/P Goh Say Song<BR>Mathematics</B>',"#DDECFF");
messages[32] = new Array('../tawards/atea2005/sci/ChanLaiWah.jpg','<B>A/P Chan Lai Wah<BR>Pharmacy</B>',"#DDECFF");
messages[33] = new Array('../tawards/atea2005/sci/EdwardTeo.jpg','<B>A/P Teo Ho Khoon, Edward<BR>Physics</B>',"#DDECFF");
messages[34] = new Array('../tawards/atea2005/sci/SowChorngHaur.jpg','<B>Dr Sow Chorng Haur<BR>Physics</B>',"#DDECFF");
messages[35] = new Array('../tawards/atea2005/sci/AndyChiang.jpg','<B>Dr Chiang Kok Leong, Andy<BR>Statistics & Applied Probability</B>',"#DDECFF");

messages[36] = new Array('../tawards/atea2005/biz/RaviChandran.jpg','<B>A/P Ravi Chandran<BR>Business Policy</B>',"#DDECFF");
messages[37] = new Array('../tawards/atea2005/biz/NitinPangarkar.jpg','<B>A/P Pangarkar Nitin<BR>Business Policy</B>',"#DDECFF");
messages[38] = new Array('../tawards/atea2005/biz/ChngCheeKiong.jpg','<B>Dr Chng Chee Kiong<BR>Finance & Accounting</B>',"#DDECFF");
messages[39] = new Array('../tawards/atea2005/biz/JochenWirtz.jpg','<B>A/P Jochen Wirtz<BR>Marketing</B>',"#DDECFF");
messages[40] = new Array('../tawards/atea2005/biz/PremShamdasani.jpg','<B>A/P Prem N Shamdasani<BR>Marketing</B>',"#DDECFF");

messages[41] = new Array('../tawards/atea2005/soc/GaryTan.jpg','<B>Dr Gary Tan<BR>Computer Science</B>',"#DDECFF");
messages[42] = new Array('../tawards/atea2005/soc/ColinTan.jpg','<B>Dr Colin Tan Keng Yan<BR>Computer Science</B>',"#DDECFF");
messages[43] = new Array('../tawards/atea2005/soc/MohanKankanhalli.jpg','<B>Prof Mohan Kankanhalli<BR>Computer Science</B>',"#DDECFF");
messages[44] = new Array('../tawards/atea2005/soc/NgBoonYuen.jpg','<B>Ms Ng Boon Yuen<BR>Information Systems</B>',"#DDECFF");

messages[45] = new Array('../tawards/atea2005/sde/YenChingChiuan.jpg','<B>Dr Yen Ching-Chiuan<BR>Architecture</B>',"#DDECFF");
messages[46] = new Array('../tawards/atea2005/sde/WongNyukHien.jpg','<B>A/P Wong Nyuk Hien<BR>Building</B>',"#DDECFF");
messages[47] = new Array('../tawards/atea2005/sde/LowSuiPheng.jpg','<B>Prof Low Sui Pheng<BR>Building</B>',"#DDECFF");
messages[48] = new Array('../tawards/atea2005/sde/Alice.jpg','<B>A/P Alice Christudason<BR>Real Estate</B>',"#DDECFF");

messages[49] = new Array('../tawards/atea2005/celc/LeeWaiYing.jpg','<B>Ms Lee Wai Ying<BR>Centre for English Language Communication</B>',"#DDECFF");

messages[50] = new Array('../tawards/atea2005/usp/StephanieRupp.jpg','<B>Dr Stephanie Karin Rupp<BR>University Scholars Programme</B>',"#DDECFF");
messages[51] = new Array('../tawards/atea2005/usp/KennethPTan.jpg','<B>Dr Kenneth Paul Tan<BR>University Scholars Programme</B>',"#DDECFF");

messages[52] = new Array('../tawards/atea2005/med/CharanjitKaur.jpg','<B>A/P Charanjit Kaur<BR>Anatomy</B>',"#DDECFF");
messages[53] = new Array('../tawards/atea2005/med/FrankVoon.jpg','<B>A/P Francis Voon Chee Tet<BR>Anatomy</B>',"#DDECFF");
messages[54] = new Array('../tawards/atea2005/med/KhooHoonEng.jpg','<B>A/P Khoo Hoon Eng<BR>Biochemistry</B>',"#DDECFF");
messages[55] = new Array('../tawards/atea2005/med/ChiaSinEng.jpg','<B>A/P Chia Sin Eng<BR>Community, Occupational & Family Medicine</B>',"#DDECFF");
messages[56] = new Array('../tawards/atea2005/med/PaulTambyah.jpg','<B>A/P Paul Tambyah<BR>Medicine</B>',"#DDECFF");
messages[57] = new Array('../tawards/atea2005/med/MaheshChoolani.jpg','<B>Dr Mahesh Choolani<BR>Obstetrics & Gynaecology</B>',"#DDECFF");
messages[58] = new Array('../tawards/atea2005/med/DeniseGoh.jpg','<B>Dr Denise Goh Li Meng<BR>Paediatrics</B>',"#DDECFF");
messages[59] = new Array('../tawards/atea2005/med/ZubairAmin.jpg','<B>Dr Zubair Amin<BR>Paediatrics</B>',"#DDECFF");
messages[60] = new Array('../tawards/atea2005/med/TanChayHoon.jpg','<B>A/P Tan Chay Hoon<BR>Pharmacology</B>',"#DDECFF");
messages[61] = new Array('../tawards/atea2005/med/ShenShali.jpg','<B>Dr Shen Shali<BR>Physiology</B>',"#DDECFF");





////////////////////  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;
}
