/*(function($){
	$(document).ready(function() {
		$.fn.personDetail = function(options) {
			this.each(function() {
				var $this = $(this);
				var title = this.title;
				var id = this.id;
				var pDive = document.getElementById(id+1).innerHTML;
			  
					$this.hover(function(e) {
						// mouse over
						$('<div class="img-container" />')
						  .appendTo('body')
						  .html(pDive)
						  .css({
							top: e.pageY + 10,
							left: e.pageX + 10
						  })
						  .fadeIn(500);
					 
					}, function() {
						// mouse out
						$('.img-container').remove();
					});	
				 
				
				$this.mousemove(function(e) {
					$('.img-container').css({
						top: e.pageY + 10,
						left: e.pageX + 20
					 });
				});
				
			  });
			 return this;
		}
		$('.person').personDetail();
	});//EOF ready
})(jQuery);
*/

 

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/stories/01.jpg", "<b>Simon Dunford</b> <br><b>Crown & Bridge Metalwork Department</b><p>Simon has been with Precision Dental Studio for 20 years.  Simon leads the Metalwork Department.  His considerable expertise and experience in the construction of metal sub structures, and his understanding of precious metal alloys, ensures excellence in fit and design.</p>", {background:"#ffffff", color:"black", border:"1px ridge #DDECFF"}]
		tooltips[1]=["/images/stories/02.jpg", "<b>Mike Clark</b><br><b>Prosthetic Department</b><p>Mike is head of the Prosthetic Department. As well as performing his technical role, Mike organises work scheduling and ensures the smooth running of the Prosthetic Department. Mike is your first point of call for technical advice and is always at hand to give advice to PDS clients.</p>", {background:"#ffffff", color:"black", border:"1px ridge #DDECFF"}]
		tooltips[2]=["/images/stories/03.jpg",  "<b>Sue Biss</b><br><b>Accounts Department</b><p>Sue is another longstanding member of staff.  She looks after customer accounts and ensures account queries are dealt with promptly.</p>", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		tooltips[3]=["/images/stories/04.jpg", "<b>Tim Stubbs</b><br><b>Ceramic Department</b><p>Tim is our longest serving member of staff.  Tim is an experienced Ceramist and is responsible for pre-production Quality Control and supporting Customer Liaison. As an experienced Dental Technician, Tim uses his knowledge and experience to support a range of departments.</p>", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		tooltips[4]=["/images/stories/05.jpg", "<b>Mark Blackmon</b><br><b>Implant Department</b><p>Mark heads the Implant Department with over 10 years of experience in Implantology.  His knowledge and expertise in the implant field, working with all the leading implant systems, enables Mark to guide his customers through the most complex cases.</p> ", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		tooltips[5]=["/images/stories/06.jpg", "<b>Paul McCully</b><br><b>Office Manager</b><p>Paul has recently joined the Precision Dental Studio team as Office Manager.  Paul organises and manages all of the administrative activities that facilitate the smooth and efficient running of the Precision Dental Studio Office.</p>", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		tooltips[6]=["/images/stories/07.jpg", "<b>Richard Stock</b><br><b>Operations Director</b><p>Richard has been with Precision Dental Studio for 28 years. He is a Director of the Precision Dental Laboratory Group and Operations Director for Precision Dental Studio.With a background as a Dental Technician, his extensive hands on experience and knowledge enables him to advise and guide clients on all aspects of dental technology.Richard is responsible for the day-to-day running of the laboratory and ensuring that all clients receive the absolute highest standards and quality every time.</p>", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		tooltips[7]=["/images/stories/08.jpg", "<b>Nicky Cox</b><br><b>Precision Exclusive Department</b><p>Nicky heads up the 'Precision Exclusive' Department.  Recognised as one of the leading Ceramists in the UK, her superb work has been shown worldwide, with many articles being published in dental journals showcasing her results.As another veteran in the team, Nicky has been with Precision Dental Studio for 23 years.</p>", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		tooltips[8]=["/images/stories/09.jpg", "<b>David Gale</b><br><b>CAD/CAM Department / Client Liaison</b><p>With over 25 years experience in dentistry, David leads the CAD/CAM department, ensuring Precision Dental Studio keeps ahead on new technologies. David is the main interface between the company and its clients and can also provide general technical advice when needed.  David attends surgeries to advise on products and services that PDS can offer. </p>", {background:"#ffffff", border:"1px ridge #DDECFF"}] 
		 

		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; float:left;"><img src="' + tipinfo[0] + '" /></div>'
				+ ((tipinfo[1])? '<div style="text-align:left; margin-left:5px; float:right; width:350px; padding: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]")
 



 

