
var ddimgtooltip={

	tiparray:function(){
		var tooltips=[]
	
		tooltips[0]=["nationwide.jpg", "A deposition is the testimony of a witness that is reduced to written form for later use in court or for discovery purposes. Accurate Court Reporting, Inc. prides itself on using only the best Court Reporters and Videographers to handle your depositions. We work hard to provide the best locations, quality of service, and to prepare everything for your trial.", {background:"#ffffff", width:"300px"}]
		tooltips[1]=["camera.jpg", "Videography is continuing to have an impressive impact on the legal community. Innovations in technology have made videography an important and effective litigation tool. While there is no substitution for the court reporter's official transcript, videography can effectively portray facts and emotion to the Court and Jury.",{background:"#ffffff", width:"300px"}]
		tooltips[2]=["scanner.jpg","Accurate Court Reporting, Inc. can scan all exhibits and transcripts and transfer them to CD-ROM or any other format as may be required. RealLegal Publisher then bundles the E-Transcript and exhibits together for easy insertion into RealLegal Binder.", {background:"#ffffff", width:"300px"}]
		tooltips[3]=["conference-room.gif","Accurate Court Reporting, Inc. has professional, state-of-the-art conference facilities. Just tell us where and we'll find a room that matches your needs.", {background:"#ffffff", width:"314px"}]
		tooltips[4]=["vc.jpg", "Videoconferencing is the ability to connect two or more sites digitally through cameras and computer equipment or telephone lines; it is the next best thing to actually being there. Accurate Court Reporting, Inc along with VCROOMS.com pride themselves in having mastered the modern methodologies of videoconferencing – offering cutting edge intuitive equipment to deliver the best possible videoconferencing experience.", {background:"#ffffff", width:"275px"}]
		tooltips[5]=["ww.jpg", "State of the Art Fully Secured 24/7/365 Online Repository.", {background:"#ffffff", width:"200px"}]
		tooltips[6]=["syncweb.jpg", "Transcript/Video Synchronization.", {background:"#ffffff", width:"300px"}]
		tooltips[7]=["serving.jpg", "We have process servers standing by across the country!&nbsp; Rush or routine service is available, we can  issue out of state subpoenas, and everything is handled efficiently and  professionally by our courteous staff.", {background:"#ffffff", width:"300px"}]
		
		return tooltips 
	}(),

	tooltipoffsets: [20, -30], 

	

	tipprefix: 'imgtip', 

	createtip:function($, tipid, tipinfo){
		if ($('#'+tipid).length==0){ 
			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+)\]/) 
				var tipsuffix=parseInt(RegExp.$1) 
				var tipid=this._tipid=ddimgtooltip.tipprefix+tipsuffix 
				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){ 
					$tooltip.mouseenter(function(){
						ddimgtooltip.hidebox($, $(this))
					})
				}
			})

		}) 
	}
}


ddimgtooltip.init("*[rel^=imgtip]")
