/***********************************************
* 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= 377;
var offX= 0;	// how far from mouse to show tip
var offY= 0; 
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= "#000080";
var tipBorderWidth= 1;
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('','<h2>GUATEMALA:</h2>Rudolfo Asensio, MD<br />Antigua. For many years we have supported a cleft pallet clinic in the mountains outside of Guatemala City.  Dr. Asensio is a gem and does wonderful work. We have supplied much of the operating room and a dental clinic for post-op needs. He specializes in the very young and does great work throughout this beautiful country.',"#FFFFFF");

messages[1] = new Array('','<h2>EL SALVADOR:</h2>Nina Paloma<br />San Salvador. We continue a close working relationship with the FUDEM group we helped get started many years ago.   Both their eye and dental programs are thriving and regularly visit rural elementary schools and orphanages.    Their major source of funding comes from the sale of prescription glasses.  We have provided the optics lab and many of the supplies to make this happen.   We rebuilt the earthquake destroyed Rosales Hospital outpatient eye surgery unit in 2003; it continues to be busy to the point of overcrowding.',"#FFFFFF");

messages[2] = new Array('','<h2>NICARAGUA:</h2>Dennise Alonzo<br />Managua.  At every turn this country deals itself a bad hand.  After some real progress in our eye programs, Nicaragua elected for itself an unstable government and things slowed down.  However, we continue in our support of the National Training Center and a wonderful private cardiac group.  The cardiologists make good use of a large quantities of extremely valuable supplies sent. ',"#FFFFFF");

messages[3] = new Array('','<h2>HAITI:</h2>Jean Claude Cadet, MD<br />Port au Prince.  We support the national training center and through them assist a number of worthy charities around the country.  This is a country that needs our support.  We are helping to put in place a much needed medical infrastructure.   The national training center serves as the hub, providing sub-specialty services, while satellite referral clinics screen and offer the general needs. ',"#FFFFFF");

messages[4] = new Array('','<h2>BRAZIL:</h2>Rodrigo Myrrha<br />Belo Horizonte.  Our program in Belo consists of a large Deseret House for poor patients and their families while being treated at the nearby hospitals.  There was a real need for housing the individuals who travel from outside the city for medical treatment who had no place to stay.  They were sleeping on the streets outside the hospital.  We have a dental clinic at the Deseret House where local dentist volunteer their time to provide services. ',"#FFFFFF");

messages[5] = new Array('','<h2>URUGUAY:</h2>Ronaldo Walker<br />Montevideo. We have just begun our work with a number of excellent Ophthalmologists.  They are eager to do more charity and to make a difference in their country.   We will continue to send supplies and watch to see what the future holds for this program.  ',"#FFFFFF");

messages[6] = new Array('','<h2>ARGENTINA:</h2>Ronaldo Walker<br />Buenos Aires, Tucuman, and Cordoba. In each of these cities we provide supplies and equipment that allow the resident physicians more surgical opportunities.   Our programs in Buenos Aires and Cordoba are Ophthalmic and assist in the training of new residents.  In Cordoba we periodically perform outreach clinics, but the majority of the patients are identified at the hospital.  In Tucuman we perform both eye and plastic surgeries.  Our Cleft lip/pallet team in Cordoba includes orthodontics and post op speech therapy. ',"#FFFFFF");

messages[7] = new Array('','<h2>PARAGUAY:</h2>Ronaldo Walker<br />Asuncion.  We have helped to establish the first cleft lip program in the country.  With the needed training we are encouraged with the possibilities of this young pair of doctors.  In addition, we support the National Ophthalmic Training Center’s needs in doing more charity.',"#FFFFFF");

messages[8] = new Array('','<h2>BOLIVIA:</h2>Joel Moya, MD<br />La Paz, Oruo, Cochabamba.   Our eye team based in La Paz performs outreach programs; they have a strong relationship with the Bolivian Air Force which provides their transportation to remote sites.   However, the political unrest has slowed down operations considerably.  Our doctors are now doing more work within the city. We also have an operating room in the San Gabriel Hospital for cleft lip/pallet surgeries.   In Oruro and Cochabamba we assist local ophthalmologists who assist the poor in their areas.',"#FFFFFF");

messages[9] = new Array('','<h2>PERU:</h2>Gabriella Quezada, MD<br />Lima.  Dr Quezada and Dr. Davila are growing a nice organization that provides services inside and around Lima.   They have organized a team that conducts periodic outreach programs and consistently performs eye surgeries for the poor.  It is our plan to eventually establish a permanent charity clinic outside of Lima.',"#FFFFFF");

messages[10] = new Array('','<h2>CHILE:</h2>Hernan Valenzuela, MD<br />Santiago.  Deseret works closely with the University of Chile eye department.   The University team performs a half dozen outreach programs in various remote areas each year.  The program has matured and is now essentially self-funding.  We have established a Deseret exam clinic inside the University.   We continue to look for areas to support this fine group as they provide much needed services. ',"#FFFFFF");

messages[11] = new Array('','<h2>NIGERIA:</h2>Kunle Hasson, MD<br />Lagos.  Our Deseret clinic in Lagos  continues to operate at least 5 days a week.    The Deseret/Hinckley Eye Hospital, located about one hour outside the city, continues to get busier and has established country-wide screening programs.  This is the only hospital of its kind in a country of 200 million! ',"#FFFFFF");

messages[12] = new Array('','<h2>ZIMBABWE:</h2>Reg Nield<br />Harare.  In spite of the serious economic and political climate, the program we initiated here continues to flourish.  It is led by a local board which manages to handle most of its own supplies and financing.   Dozens of African eye surgeons are actively involved in a very prolific cataract program.  In addition, some of the local plastic surgeons have join the ranks and provide us with cleft lip and pallet surgeries. We also have a Deseret AIDS education program in Zimbabwe.  It was a spin off of the original eye/dental project.  This has played a major part in decreasing the incidents of HIV infections in this country.   It is recognized as being a new and more effective method for dealing with this plague.  The AIDS program is funded largely through the efforts of Steve Mann. ',"#FFFFFF");

messages[13] = new Array('','<h2>UGANDA:</h2>Natwatwa Lule, DDS<br />Kampala.   We continue outreach dental programs to schools and orphanages throughout the country (once or twice a week).    The National Dental School provides a dozen students to assist with each outreach trip, we ensure the supplies are on hand and provide the transportation.   In appreciation of their partnership, we provide the basic tools (hand instruments) needed for the graduating dental students. ',"#FFFFFF");

messages[14] = new Array('','<h2>EGYPT:</h2>Ahmed Hathoot and Yasser Saif<br />We are supporting two independent programs, each with a slightly different delivery method (both follow the Deseret philosophy) and both are highly prolific.  The two groups are learning to coordinate and work well together.  We are beginning our support of a highly trained group of Neurosurgeons from the University of Cairo as they work with needy hydrocephalus children. ',"#FFFFFF");

messages[15] = new Array('','<h2>PALESTINE:</h2>Bailee Brown<br />We are involved here by our outfitting an American/Palestinian group that makes one or two yearly trips.  The response and interchange with the local medical community has been very positive and we have been able to reach areas where no services are otherwise available.',"#FFFFFF");

messages[16] = new Array('','<h2>INDIA:</h2>Arun Sethi, MD<br />New Delhi, Chennai.  We operate a four- story Arunadaya-Deseret Eye Hospital in Gurgon, just outside of Delhi.  In addition to this hospital, this program works out of four clinics within Delhi.    In Chennai we have a great relationship with a state of the art cardiac group.  About every other month we supply Chennai with valuable supplies and they do charity work on our behalf.',"#FFFFFF");

messages[17] = new Array('','<h2>MYANMAR:</h2>Khn Tu, MD<br />Our doctors not only perform eye surgeries within the city of Rangoon, but have identified a number of other creditable programs outside of the city to support.  The political situation makes our work a little more difficult, but we continue to see progress. ',"#FFFFFF");

messages[18] = new Array('','<h2>CAMBODIA:</h2>Rose Foundation<br />Phnom Penh.  We support a local group that is providing a variety of services to the poor.   It is lead by a Canadian doctor who has moved to Phnom Penh.  They are well organized and well respected within the country.  Currently we sponsor, with the needed supplies, 50 eye surgeries each month. ',"#FFFFFF");

messages[19] = new Array('','<h2>INDONESIA:</h2>Subandriyo<br />Jakarta, Bandung, Yogyakarta, Bali.  We operate in two national eye training centers where our programs have helped to increase the number of charity cataract surgeries by almost 400 percent!   Recently, we equipped an operating room of a new private facility built by our partner doctors in Bandung. ',"#FFFFFF");

messages[20] = new Array('','<h2>PHILIPPINES:</h2>Manny Hernandez<br />Manila, Davao, and Cebu.  This is still such a wonderful place to see all the aspects of Deseret.  The three Deseret Houses are being well utilized, our relationship with the local doctors and hospitals is strong, and we continue to become a more valuable part of the Philippine society.  We have our own maxillofacial clinic and eye clinic.    Our artificial limb program is active, we are the main source for the countries club feet surgeries, nobody does more charity eye work than us, and the country’s premiere cleft lip/pallet surgeons are our valuable partners. ',"#FFFFFF");

messages[21] = new Array('','<h2>TONGA:</h2>Wayne Chisholm, DDS<br />Nuku’alofa.  For most of the year we have had at least one dentist in our state of the art facility.  We are the dental community for this country.  In addition, we supply a medical specialist to assist with the countries needs when appropriate.  ',"#FFFFFF");


////////////////////  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 + '">';
var midStr = '<tr><td valign="top" style="text-align:left; padding:10px;">';
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) {
		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>')

