// JavaScript Document

/***********************************************
* Image w/ description tooltip- By Dynamic Web Coding (www.dyn-web.com)
* Copyright 2002-2007 by Sharon Paine
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* 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 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= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 850;
var offX= 5;	// 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= "#999999";
var tipBgColor= "#DDECFF"; 
var tipBorderColor= "#000080";
var tipBorderWidth= 0;
var tipBorderStyle= "ridge";
var tipPadding= 0;

// 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('image01.jpg','<center>Lady Vespa <br>Orchard Boulevard, Singapore <br> July 2007 Digital k750i by Jason Hui</center>',"#000000");
messages[1] = new Array('image02.jpg','<center>Stairs to the sky <br>Baghdad Street, Singapore <br> March 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[2] = new Array('image03.jpg','<center>Haji Lane, Singapore <br>March 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[3] = new Array('image04.jpg','<center>Headless models stole the show <br>Paragon, Singapore <br>July 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[4] = new Array('image05.jpg','<center>Wheelock Place, Singapore <br>July 2007 Digital Nikon D70 by Jason Hui</center>',"#000000");
messages[5] = new Array('image06.jpg','<center>Phantom soldiers in the city <br>Orchard Road, Singapore <br>July 2007 Digital color by Jason Hui</center>',"#000000");
messages[6] = new Array('image07.jpg','<center>Capitol Theatre, City Hall, Singapore <br>March 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[7] = new Array('image08.jpg','<center>Yellow space ship <br>Arab Street, Singapore <br> March 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[8] = new Array('image09.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");

messages[9] = new Array('image10.jpg','<center>Cherubic--young child giving out pamphlets along Orchard during Christmas <br>Wisma Atria, Singapore <br>December 2006  Film Lomo LCA, Kodak E100G slide, C41 cross-processed by Jason Hui</center>',"#000000");
messages[10] = new Array('image11.jpg','<center>The pigeon king <br> Bugis, Singapore <br> January 2007 Film Lomo LCA, Kodak Ektachrome, E100G at 64 gost, C41 cross-processed by Jason Hui</center>',"#000000");
messages[11] = new Array('image12.jpg','<center>Dorothy&#39;s shoes <br>Robinson Shopping Centre, Singapore <br>January 2007 Film Lomo LCA, Kodak slide, C41 Xpro by Jason Hui</center>',"#000000");
messages[12] = new Array('image13.jpg','<center>Honey comb <br> Shaw Tower, Singapore <br> January 2007 Film Lomo LCA, Kodak Ektachrome, E100G at 64 gost, C41 cross-processed as negative by Jason Hui</center>',"#000000");
messages[13] = new Array('image14.jpg','<center>A sea of gray -- elderly watching a performance <br> Far East, Singapore <br> January 2007 Film Nikon F65 by Jason Hui</center>',"#000000");
messages[14] = new Array('image15.jpg','<center>Hair up -- a stranger at Starbucks <br> Liat Towers, Singapore <br> October 2006 Digital Nikon D70 by Jason Hui</center>',"#000000");
messages[15] = new Array('image16.jpg','<center>A little girl, cross junction, Christmas and headlights <br>Orchard Road, Singapore <br> December 2006 Film Lomo LCA, Kodak Ektachrome, E100G at 64 gost, C41 cross-processed as negative by Jason Hui</center>',"#000000");
messages[16] = new Array('image17.jpg','<center>Takashimaya, Singapore <br> July 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[17] = new Array('image18.jpg','<center>Faceless people -- through a rain-stained window <br> Yio Chu Kang, Singapore <br> July 2007 Film Holga 120n by Jason Hui</center>',"#000000");
messages[18] = new Array('image19.jpg','<center>HDB council housing reflected off a Color Yashinon DX 1:1.7 lens <br>Bishan, Singapore <br> February 2007 Digital Nikon D70 by Jason Hui</center>',"#000000");
messages[19] = new Array('image20.jpg','<center>Orchard Road traffic <br> Orchard Road, Singapore <br> February 2007 Film Lomo LCA, Kodak Ektachrome, E100G at 64 gost, C41 cross-processed by Jason Hui</center>',"#000000");
messages[20] = new Array('image21.jpg','<center>Singapore <br> March 2007 Film Lomo LCA by Jason Hui</center>',"#000000");
messages[21] = new Array('image22.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[22] = new Array('image23.jpg','<center>Men with bras <br> Orchard Road, Singapore <br> January 2007 Film NikonF65, Kodak Gold 200, B&W conversion by Jason Hui</center>',"#000000");
messages[23] = new Array('image24.jpg','<center>Couples dating through the window of a high class restaurant <br> Paragon, Singapore <br> July 2007 Film Lomo LCA by Jason Hui</center>',"#000000");

messages[24] = new Array('image25.jpg','<center>Mentos sky <br> Arab Street, Singapore <br> March 2007  Film Lomo LCA by Jason Hui</center>',"#000000");
messages[25] = new Array('image26.jpg','<center>No parking <br> Haji Lane, Singapore <br> March 2007  Film Lomo LCA by Jason Hui</center>',"#000000");
messages[26] = new Array('image27.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[27] = new Array('image28.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[28] = new Array('image29.jpg','<center>Hair down: stranger at Starbucks <br> Liat Towers, Singapore <br> October 2006 Digital Nikon D70 by Jason Hui</center>',"#000000");
messages[29] = new Array('image30.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[30] = new Array('image31.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[31] = new Array('image32.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");

messages[32] = new Array('image33.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[33] = new Array('image34.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[34] = new Array('image35.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[35] = new Array('image36.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[36] = new Array('image37.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[37] = new Array('image38.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[38] = new Array('image39.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[39] = new Array('image40.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");

messages[40] = new Array('image41.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[41] = new Array('image42.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[42] = new Array('image43.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[43] = new Array('image44.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[44] = new Array('image45.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[45] = new Array('image46.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[46] = new Array('image47.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[47] = new Array('image48.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");

messages[48] = new Array('image49.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[49] = new Array('image50.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[50] = new Array('image51.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[51] = new Array('image52.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[52] = new Array('image53.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[53] = new Array('image54.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[54] = new Array('image55.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[55] = new Array('image56.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");

messages[56] = new Array('image57.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[57] = new Array('image58.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[58] = new Array('image59.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[59] = new Array('image60.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[60] = new Array('image61.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[61] = new Array('image62.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[62] = new Array('image63.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[63] = new Array('image64.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");

messages[64] = new Array('image65.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[65] = new Array('image66.jpg','<center>Downtown Singapore <br> 2007 Digital color by Winston Woo</center>',"#000000");
messages[66] = new Array('image67.jpg','<center>To market, to market to buy a fat hog <br> Haji Lane, Singapore <br> 2007 Film color by Jason Hui</center>',"#000000");
messages[67] = new Array('image68.jpg','<center>Singapore <br> 2007 Film color by Jason Hui</center>',"#000000");
messages[68] = new Array('image69.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[69] = new Array('image70.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[70] = new Array('image71.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[71] = new Array('image72.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");

messages[72] = new Array('image73.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[73] = new Array('image74.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[74] = new Array('image75.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[75] = new Array('image76.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[76] = new Array('image77.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[77] = new Array('image78.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[78] = new Array('image79.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[79] = new Array('image80.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");

messages[80] = new Array('image81.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[81] = new Array('image82.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[82] = new Array('image83.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[83] = new Array('image84.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[84] = new Array('image85.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");
messages[85] = new Array('image86.jpg','<center>Singapore <br> Digital color by Winston Woo</center>',"#000000");

////////////////////  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
	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 (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>')
