/* Image w/ description tooltip v2.0
* Created: April 23rd, 2010. This notice must stay intact for usage 
* Author: Dynamic Drive at http://www.dynamicdrive.com/
* Visit http://www.dynamicdrive.com/ for full source code
*/


var ddimgtooltip={

	tiparray:function(){
		var tooltips=[]
		//define each tooltip below: tooltip[inc]=['path_to_image', 'optional desc', optional_CSS_object]
		//For desc parameter, backslash any special characters inside your text such as apotrophes ('). Example: "I\'m the king of the world"
		//For CSS object, follow the syntax: {property1:"cssvalue1", property2:"cssvalue2", etc}

		tooltips[0]=["images/tips/slashpine.jpg", "Slash pine is a valuable southern pine for reforestation projects and is naturally found in wet flatwoods swampy areas and shallow pond edges", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"400px"}]

		tooltips[1]=["images/tips/longleaf.jpg", "Longleaf pine is the legendary southern yellow pine of forest history and is common in flatwoods, sandhill, and upland hardwood ecosystems.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"300px"}]

		tooltips[2]=["images/tips/pondcypress.jpg", "Pond Cypress is closely related to Bald Cypress. However, pond cypress typically prefers a more isolated, thriftier life style and is most frequently found in isolated depressions feed by nutrient poor, shallow ground water.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"300px"}]

		tooltips[3]=["images/tips/baldcypress.jpg", "Bald Cypress grows along rivers\, streams\, and creeks as well as in swamps with slow moving water. It can live up to 600 years old. It is a legendary tree of the Deep South known for its \"knees\,\" moss-draped crown\, and buttressed trunk", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"300px"}]

		tooltips[4]=["images/tips/oak.jpg", "Live oak is the southern symbol of strength. Lining the historic streets of small towns, the reclining branches create a canopy of speckled light. On the Gulf Coast, live oaks often support many types of epiphytic plants, including Spanish moss which hangs in weeping garlands, giving the trees a striking appearance. Live oak is a fast-growing tree. Sweet edible acorns are usually produced in great abundance and are of value to many birds and mammals including wild turkeys, wood ducks, jays, quail, whitetail deer, raccoons, and squirrels.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"400px"}]

		tooltips[5]=["images/tips/mapletree.jpg", "Florida is home to several maple tree varieties. Maple trees are prized for their timber and ornamental value. Their sap is used to produce maple syrup\, and the trees are commonly planted as shade trees. They propagate through winged seed pods that spin like propellers as they fall to the ground. The leaves of the maple tree are large and green\, but turn a variety of colors in fall.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"400px"}]

		tooltips[6]=["images/tips/southernmagnolia.jpg", "Southern magnolia\, also known as bull bay or evergreen magnolia\, is one of the best-known trees in the state of Florida. It occurs naturally in rich hammock soils and on the border of river swamps along with other hardwoods. The southern magnolia is noted for its large handsome flowers that appear at intervals during the summer months. The flowers stand out with their large showy cream white petals surrounding a splash of bright purple in the center and their pleasing fragrance. The \"sweet magnolia\" of the South well deserves the place given to it in story and song.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"400px"}]

		tooltips[7]=["images/tips/gumtree.jpg", "In Florida, we have two kinds of trees commonly called gums, sweet gum and the tupelos. Sweet gum got its name in the way we might expect, from its sticky sap. But the gums that adorn our local maps with such enticing names as Gum Root Swamp, Gum Pond and Gum Slough are the tupelos. In our area there are three: swamp tupelo, water tupelo and Ogeechee tupelo. Among the most notable animal associates of tupelos are bees. Honey made by bees that have sipped on Ogeechee tupelo blooms is considered by many to be a delicacy. For diabetics, it's much more. Because of high fructose and low dextrose content, it is the only kind of honey they are able to safely eat. ", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"400px"}]

		tooltips[8]=["images/tips/hickory.jpg", "Florida has two varieties of hickory trees, the scrub hickory, and the water hickory. The scrub hickory is identified by the abundant, rust-colored scales on the buds and lower leaf surfaces.<br/>Water hickory is also called bitter pecan or swamp hickory.  It is best known for its use in smoking meats, such as ham and bacon, whose rich, hickory-smoked flavor are a southern tradition. Water hickory trees regenerate aggressively in swamps and wetlands. Several wildlife species consume the fruits of water hickory trees, including wild hogs, wood ducks and squirrels, who depend heavily on the nuts in their diets. The trees also provide refuge for numerous smaller animals and birds.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"600px"}]

		tooltips[9]=["images/tips/goldenrod_butterfly.jpg", "One of the last big flower shows each year is provided by the goldenrods. There are at least 130 species of goldenrod in the United States alone.  They are all perennials with large clusters of small yellow flowers that appear from the end of summer until frost.The many goldenrod species can be difficult to distinguish, due to their similar bright, golden yellow flower heads that bloom in late summer. Goldenrod is often unfairly blamed for causing hay fever in humans. The pollen causing these allergy problems is mainly produced by Ragweed, blooming at the same time as the goldenrod, but is wind-pollinated. Goldenrod pollen is too heavy and sticky to be blown far from the flowers, and is thus mainly pollinated by insects.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"300px"}]

		tooltips[11]=["images/tips/blazingstar.jpg", "The Prairie Blazing Star is generally described as a perennial forb/herb. This is native to the U.S. and has its most active growth period in the summer. The Prairie Blazing Star has green foliage and inconspicuous purple flowers, with a smattering of conspicuous brown fruits or seeds. The greatest bloom is usually observed in the mid summer, with fruit and seed production starting in the summer and continuing until fall.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue", width:"300px"}]

		return tooltips //do not remove/change this line
	}(),

	tooltipoffsets: [20, -30], //additional x and y offset from mouse cursor for tooltips

	//***** NO NEED TO EDIT BEYOND HERE

	tipprefix: 'imgtip', //tooltip ID prefixes

	createtip:function($, tipid, tipinfo){
		if ($('#'+tipid).length==0){ //if this tooltip doesn't exist yet
			return $('<div id="' + tipid + '" class="ddimgtooltip" />').html(
				'<div style="text-align:center"><img src="' + tipinfo[0] + '" /></div>'
				+ ((tipinfo[1])? '<div style="text-align:left; margin-top:5px">'+tipinfo[1]+'</div>' : '')
				)
			.css(tipinfo[2] || {})
			.appendTo(document.body)
		}
		return null
	},

	positiontooltip:function($, $tooltip, e){
		var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1]
		var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(), 
		x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(ddimgtooltip.tooltipoffsets[0]*2) : x
		y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y
		$tooltip.css({left:x, top:y})
	},
	
	showbox:function($, $tooltip, e){
		$tooltip.show()
		this.positiontooltip($, $tooltip, e)
	},

	hidebox:function($, $tooltip){
		$tooltip.hide()
	},


	init:function(targetselector){
		jQuery(document).ready(function($){
			var tiparray=ddimgtooltip.tiparray
			var $targets=$(targetselector)
			if ($targets.length==0)
				return
			var tipids=[]
			$targets.each(function(){
				var $target=$(this)
				$target.attr('rel').match(/\[(\d+)\]/) //match d of attribute rel="imgtip[d]"
				var tipsuffix=parseInt(RegExp.$1) //get d as integer
				var tipid=this._tipid=ddimgtooltip.tipprefix+tipsuffix //construct this tip's ID value and remember it
				var $tooltip=ddimgtooltip.createtip($, tipid, tiparray[tipsuffix])
				$target.mouseenter(function(e){
					var $tooltip=$("#"+this._tipid)
					ddimgtooltip.showbox($, $tooltip, e)
				})
				$target.mouseleave(function(e){
					var $tooltip=$("#"+this._tipid)
					ddimgtooltip.hidebox($, $tooltip)
				})
				$target.mousemove(function(e){
					var $tooltip=$("#"+this._tipid)
					ddimgtooltip.positiontooltip($, $tooltip, e)
				})
				if ($tooltip){ //add mouseenter to this tooltip (only if event hasn't already been added)
					$tooltip.mouseenter(function(){
						ddimgtooltip.hidebox($, $(this))
					})
				}
			})

		}) //end dom ready
	}
}

//ddimgtooltip.init("targetElementSelector")
ddimgtooltip.init("*[rel^=imgtip]")
