//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////   DM Global Map Popup Script 
/////////////   Created 28/05/2005
/////////////   JMN

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;

var origWidth, origHeight;
if (ns4) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

if (nodyn) { event = "nope" }

var tipFollowMouse= true;	
var tipWidth= 60;
var offX= 10;	// how far from mouse to show tip
var offY= 10; 
var tipFontFamily= "Verdana, arial, helvetica, sans-serif";
var tipFontSize= "8pt";
var tipFontColor= "#000000";
var tipBgColor= "#ffffff"; 
var tipBorderColor= "#000000";
var tipBorderWidth= 0;
var tipBorderStyle= "none";
var tipPadding= 0;

var messages = new Array();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////// ADD ALL DATAMINE OFFICE INFORMATION BELOW
//////////////////// Do not alter the order of the existing entries
//////////////////// Ensure you increment the messages number for new entries 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

//####CUSTOMSTART
messages[0] = new Array('','<font size = "1" color = "#000080"><strong>Datamine Canada</strong></font><br>866 Newgate Avenue, Unit 2<br>Sudbury, Ontario<br>P3A 5J9<br>Canada<br>Tel:+1 705 688 0101<br>Fax: +1 705 688 9533<br>Toll Free: 1 800 240 6941<br>Email:info@datamine.ca<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>46.5133914867, -80.9841026622</center>','','');    //Datamine Canada Quick Office Details
messages[1] = new Array('','<font size = "1" color = "#000080"><strong>Datamine North America</strong></font><br>44 Union Blvd. Suite 110<br>Lakewood CO 80228<br>USA<br>Tel: +1 303 985 7713<br>Fax: +1 303 985 7612<br>Toll Free: 1 800 499 7877<br>Email:info@datamine-na.com<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>39.7171363598, -105.131728215</center>','','');    //Datamine North America Quick Office Details
messages[2] = new Array('','<font size = "1" color = "#000080"><strong>Datamine Perú</strong></font><br>Av. Jorge Basadre, 592 Of. 703<br>Torre Azul,  San Isidro<br>Lima 27<br>Peru<br>Tel: +51 1 222 6000<br>Fax: +51 1 221 4305<br>Email:info@datamine.com.pe<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>-12.0946062999, -77.0378927047</center>','','');    //Datamine Peru Quick Office Details
messages[3] = new Array('','<font size = "1" color = "#000080"><strong>Datamine Brazil (Sao Paolo)</strong></font><br>Rua Helena, 309 - Unidade 75<br>CEP 04552-050 - São Paulo<br>SP, BRASIL<br>Peru<br>Tel: +55 11 38464501<br>Fax: +55 11 38464501<br>Email:info@datamine.com.br<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>-23.5932234231, -46.6872426456</center>','','');    //Datamine Brazil Sao Paolo Quick Office Details
messages[4] = new Array('','<font size = "1" color = "#000080"><strong>Datamine Chile</strong></font><br>Santa Magdalena, 75<br>Oficina 903, Providencia<br>Santiago 751-0038<br>Chile<br>Tel: +56 2 334 5952 / +56 2 231 8063<br>Fax: +56 2 334 5951<br>Email:info_dla@datamine.cl<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>-33.4205480768, -70.6093943647</center>','','');    //Datamine Chile Quick Office Details
messages[5] = new Array('','<font size = "1" color = "#000080"><strong>Datamine International (UK)<br>Unit A, Underwood Business Park</strong></font><br>Wookey Hole Road, Wells<br>Somerset BA5 1AF<br>United Kingdom<br>Tel: +44 1749 683350<br>Fax: +44 1749 678237<br>Email:info@datamine.co.uk<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>51.216453, -2.663223</center>','','');    //Datamine International Quick Office Details
messages[6] = new Array('','<font size = "1" color = "#000080"><strong>Datamine Australia</strong></font><br>23 Belgravia Street<br>PO Box 328<br>Belmont WA 6104<br>Australia<br>Tel: +61 8 9479-1771<br>Fax: +61 8 9479-1115<br>Email:info@datamine.com.au<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>31.9447554638S, 115.924544551E</center>','','');    //Datamine Australia Quick Office Details
messages[7] = new Array('','<font size = "1" color = "#000080"><strong>Datamine International (India)</strong></font><br>C-484, Sarita Vihar<br>New Delhi 110 076<br>India<br>Tel: +91 11 26948393 / +91 11 26975970<br>Fax: +91 11 26951698<br>Email:datamine@vsnl.com<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>28.5290871221, 77.2912283363</center>','','');    //Datamine India Quick Office Details
messages[8] = new Array('','<font size = "1" color = "#000080"><strong>Datamine South Africa</strong></font><br>08 Bentley Office Park<br>Corner Bevan & Wessel Rd<br>Rivonia 2128<br>South Africa<br>Tel: +27 11 253 3360<br>Fax: +27 11 253 3378<br>Email:support@datamine.co.za<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>26.0397288586, 28.0613605598</center>','','');    //Datamine South Africa Quick Office Details
messages[9] = new Array('','<font size = "1" color = "#000080"><strong>Datamine Brazil (Belo Horizonte)</strong></font><br>Rua da Paisagem, 240 Sala 421<br>34000-000  Belo Horizonte<br>MG, Brasil<br>Tel: +55 31 32256855<br>Fax: +55 31 32256855<br>Email:info@datamine.com.br<br><br><center><strong>Google Earth Reference</strong><br>Decimal Latititude &amp; Longitude<br>-19.9810725812, -43.9453710904</center>','','');    //Datamine Brazil Belo Horizonte Office Details
//####CUSTOMEND

////////////////////  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


//huge global routine for image and text

var startStr = '<img src="../Icon_Popups/';
var startTXTstr = '<table width="' + (tipWidth + 200)+ '" background = "../Images/Tri_Diamond_Small.gif" style = "background-repeat: no-repeat;"><tr><td align="center" width="100%" border = "0">';

var midStr = '" border="0">';
var midTXTstr = '</td></tr><tr><td valign="top">';

var endStr = '</td></tr></table>';
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;
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link

function doTooltip(evt,num) {

if (messages[num][0] != "") {


	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="' + tipBgColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding="' + tipBorderWidth + '" border="0" style = "border-style: none;"><tr><td><font size = "8pt">'+ startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr + '</font></td></tr></table>';
		tooltip.write(tip);
		tooltip.close();
		
	} else if (ie4||ie5||ns5) {
		var tip = '<table bgcolor="' + tipBgColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding = 0" border="0" background = "../Images/Tri_Diamond_Small.gif" style = "background-repeat: no-repeat;"><tr><td><font size = "8pt">'+ startStr + messages[num][0] + midStr + endStr + '</font></td></tr></table>'
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);

} else if (messages[num][0] == "") {

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="' + tipBgColor + '" 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 = '<table border = 1><tr><td><table class = "popupTable" bgcolor="' + tipBgColor + '" width="' + (tipWidth + 200) + '" border = "0" background = "../Images/Tri_Diamond_Small.gif" style = "background-repeat: no-repeat;"><tr><td width = "14"></td><td><font size = "1">' + messages[num][1]  + endStr + '</font></td></tr></table></td></tr></table>';
		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);
}

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;
}





























































































































































































































































































































































































































































































































































































