/*
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= 300;
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= "#000080";
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('./images/bozeman02.jpg','Welcome to Bozeman - An ideal place to reside and recreate! Clean air, national forest access less than 10 miles away and moderate climate make this a perfect place for outdoor recreation. For those who like to stay a little closer to home enjoy shopping, parks, world-class museums, and arts and cultural opportunities.<br />&nbsp;<br /> Residents of Bozeman receive the benefits of a wonderful standard of living with year round recreational and cultural events. Bozeman is the place to be for that small town feel with big city amenities. The perfect place to do everything or nothing at all.',"#FFFFFF");
messages[1] = new Array('./images/boise_idaho.jpg','Welcome to Boise!<br />&nbsp;<br />Hard-working pioneers founded the Boise Metro area. Today’s “pioneers” are called entrepreneurs, and their initiative continues to fuel the metro area economy. Boise enjoys a national reputation for its well-educated workforce, low taxes, great business climate and impressive quality of life.',"#FFFFFF");
messages[2] = new Array('./images/Cheyenne.jpg','Visitors to Cheyenne can Live the Legend 365 days a year with both seasonal and year-round activities. Fishing, hunting, biking, hiking, boating, floating, swimming, camping, golfing and skiing are all available in the city or in nearby recreational areas. More than 600 acres of parks, plus 15 miles of the Cheyenne Greenway, offer plenty of places to play or relax.<br />&nbsp;<br />Cheyenne is the gateway to Wyoming, welcoming visitors on their way to Yellowstone and Grand Teton national parks and Devils Tower National Monument.','black','white');
messages[3] = new Array('./images/saltlake.jpg','One characteristic that everyone agrees on, is that Salt Lake is a vibrant community that is experiencing economic prosperity.<br />&nbsp;<br />The area&prime;s productive workforce, low unemployment, exceptional recreation and overall quality of life are a few of the reasons the Salt Lake valley is considered to be one of the nation&prime;s economic hot spots.', 'black','white');
messages[4] = new Array('./images/OgdenUT.jpg','Ogden sits attractively at the base of the Wasatch Mountains. It is one of Utah&prime;s largest cities. A one-time farming community, Ogden grew rapidly after becoming a hub for the intercontinental railroad. It was further bolstered by the creation of the huge Hill Air Force base nearby.','white', 'black');
messages[5] = new Array('./images/ProvoUT.bmp','Provo is Utah&prime;s third largest city with about 105,000 people. It is a clean, pleasant city beautifully situated between the Wasatch Mountains and 250-square mile Utah Lake.<br />&nbsp;<br />Provo&prime;s main claim to fame is Brigham Young University, a 30,000 student university founded and run as the leading Mormon institution of higher learning. It is the largest church affiliated university in the country and its cultural offerings and sports programs play an integral role in Provo.','white','black');
messages[6] = new Array('./images/Phoenix1.bmp','Phoenix is one of the three fastest growing cities in the country and the nation’s fifth-largest city with a population of nearly 1.4 million. The Greater Phoenix area has a population of 3.5 million. In the heart of the Greater Phoenix area is Tempe, an active university town.<br />&nbsp;<br />Greater Phoenix has consistently ranked among the nation&prime;s top cities in the number of Five Diamond/Five Star resorts. Metro Phoenix has more than 52,000 hotel rooms and is home to more than 200 golf courses. Visitors to Greater Phoenix account for about $5 billion in expenditures each year.','white', 'black');
messages[7] = new Array('./images/Tucson.bmp','Play outside any time of year in Tucson. Our warm, pleasant winters are perfect for outdoor fun. Come for rugged canyons to explore, mile after mile of pristine hiking and mountain bike trails and an unbelievably lush desert. Not to mention our in-your-face mountains and one awesome sunset after another. Plus, play round after round of some of the most spectacular golf you’ve experienced.<br />&nbsp;<br />Thrill your kids with an authentic Wild West experience, or an amazing tour of Kartchner Caverns. Go birding, stargazing or pamper your adventurous body and soul at one of our world-class spas. It’s all right here in warm and wonderful Tucson, Real. Natural. Arizona.','black','white');
messages[8] = new Array('./images/ElPaso.jpg','Welcome to our corner of Texas and explore our wonderful region. There is plenty to see and do in the Rio Grande Valley at the beginning of the Rocky Mountains. Experience walking tours of Downtown to get a taste of our history that spans 400 years, shopping, outdoor concerts at the Chamizal National Memorial, museums of every kind, the Zoo, and nature hikes through our four Texas State Parks.<br />&nbsp;<br />Come be a part of El Paso’s music and dance festivals, sports events, arts and culture. Our close neighbors in Ciudad Juarez, Mexico, and New Mexico also welcome and extend their hospitality. The Visitor Links will provide you with more information about interesting events and activities to entertain and awe you in El Paso.','black','white');
messages[9] = new Array('./images/santafe.jpg','Santa Fe "Town of the Holy Faith" is an ancient city nestled at 7000 feet in the foothills of the Sangre de Cristo Mountains . The city was established in 1610 and is the oldest capital city in the United States. 30 years after statehood, the most eminent physicists in the world gathered in the sacred Jemez mountains at a top secret facility called Los Alamos, "The Cottonwoods", to develop the atomic bomb and ultimately change the world forever.<br />&nbsp;<br />Today, the high desert of Santa Fe and Northern New Mexico are, of course, physically part of the American landscape but not always strictly of America. The Pueblo, Spanish, and Anglo cultures interweave the old with the new creating a rich, often mystifying "Land of Enchantment".','white','black');
messages[10] = new Array('./images/ColoradoSprings.bmp','Founded in 1871, Colorado Springs, Colorado&prime;s second-largest city, has evolved from a quaint, Victorian spa resort to a sophisticated city, with a charming "small town" ambiance. With over 50 attractions, Colorado Springs and the Pikes Peak region are the gateway to Southern Colorado&prime;s &quot;Outdoor Adventure Play Land.&quot;<br />&nbsp;<br />Located 80 miles south of Denver&prime;s International Airport and 1 and 1/2 hours east of world-class skiing, Colorado Springs is a vacation mecca, drawing over 6 million visitors annually.','black','white');
messages[11] = new Array('./images/denver.jpg','Denver is a vibrant city with 300 days of annual sunshine, year-round adventure and the breathtaking Rocky Mountains in our backyard.<br />&nbsp;<br />From a thriving arts and culture scene, world class attractions and endless shopping possibilities, to nationally recognized chefs, exciting nightlife and abundant outdoor recreation, Denver welcomes you to experience, explore and discover how the Mile High City will awaken your senses like nowhere else.','white','black');
messages[12] = new Array('./images/Loveland.jpg','From arts and hearts, history and beauty, and a warm Colorado welcome, the community of Loveland is the place to be. What makes Loveland special is the small-town atmosphere and strong sense of community found nestled in this beautiful city, just waiting to greet you with a warm, heartfelt welcome.','black','white');
messages[13] = new Array('./images/Boulder.bmp','Boulder is a city of 100,000, elevation 5,400 feet (1650 meters), located thirty miles northwest of Denver. Boulder is surrounded by a wonderful greenbelt with 120 miles of trails.<br />&nbsp;<br />The front range of the Rocky Mountains rises on the west side of town. The entire region is a paradise for hiking, cycling, rock climbing and almost every kind of outdoor activity except surfing.','white','black');
messages[14] = new Array('./images/albuquerque.jpg','Albuquerque is a city of contrasts. Nestled between the towering Sandia Mountains and the Rio Grande Valley, the city of Albuquerque is rich with culture and heritage, breathtaking landscape and equipped with vibrant energy that&prime;s indispensable to a fast-growing city.<br />&nbsp;<br />Year after year residents flock to the city to enjoy Albuquerque&prime;s quality of life and developing business environment. The city continues to grow its infrastructure, enhance its business policies and expand its outlook for current and future business prospects.','white','black');
messages[15] = new Array('./images/vegas.jpg','Falling in love with Las Vegas is easy to do. &quot;The Entertainment Capital of the World&quot; welcomes 35 million people a year.<br />&nbsp;<br />Visitors love to enjoy luxurious hotels, unique shopping experiences, dazzling and unusual stage shows, first rate restaurants, and world class gaming. Of course, Las Vegas is also a golfer&prime;s paradise, with plenty of championship golf courses.','white','black');
messages[16] = new Array('./images/FortCollins.jpg','Welcome to Fort Collins - This northern Colorado city is an outdoors-oriented community.<br />&nbsp;<br />With the nearby national park, Lory Park and Horsetooth State Park (and Horsetooth Reservoir), where you can do everything from boating and swimming (in the summer months) to horseback riding, camping, fishing, mountain biking and rock climbing.','white','black');

////////////////////  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;
}
