/* 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]=["http://i581.photobucket.com/albums/ss255/FredPity/groningen4middelstum/groningen4middelstum1-1.png?t=1290005927", "Die winst werd met deze handdruk bezegeld.", {background:"#222222", color:"white"}]
		tooltips[1]=["http://2.bp.blogspot.com/_G0HsbRwHuXA/SdEUSpd8PaI/AAAAAAAAAdI/ZiVFT2EM7n8/s320/Roger_Kitter.jpg", "wadda mistaka to maka!", {background:"#222222", color:"white"}]
		tooltips[2]=["http://img703.imageshack.us/img703/7351/nrcherman.jpg", "NRC 7-12-2010", {background:"#222222", color:"white"}]
		tooltips[3]=["http://img808.imageshack.us/img808/8162/img0171k.jpg", "", {background:"#222222", color:"white"}]
		tooltips[4]=["http://img830.imageshack.us/img830/3442/img0174fe.jpg", "", {background:"#222222", color:"white"}]
		tooltips[5]=["http://img831.imageshack.us/img831/4503/img0173of.jpg", "", {background:"#222222", color:"white"}]
                tooltips[6]=["http://img228.imageshack.us/img228/9797/dsc00292si.jpg", "", {background:"#222222", color:"white"}]
		tooltips[7]=["http://img585.imageshack.us/img585/8767/img0159ej.jpg", "De glorieuze koploopstert aan het werk", {background:"#222222", color:"white"}]
		tooltips[8]=["http://img692.imageshack.us/img692/3999/buurhoes.jpg", "", {background:"#222222", color:"white"}]
		tooltips[9]=["http://img262.imageshack.us/img262/8383/img0177e.jpg", "Middelstum 2 - Staunton 3, de concentratie spat er vanaf!", {background:"#222222", color:"white"}]
	        tooltips[10]=["http://img10.imageshack.us/img10/6356/sunbathingman.jpg", "", {background:"#222222", color:"white"}]
		tooltips[11]=["http://img209.imageshack.us/img209/9449/jetlag.jpg", "", {background:"#222222", color:"white"}]
	        tooltips[12]=["http://img248.imageshack.us/img248/6339/uilq.jpg", "", {background:"#222222", color:"white"}]
		tooltips[13]=["http://img25.imageshack.us/img25/7387/borre.jpg", "http://nl.wikipedia.org/wiki/Fabeltjeskrant", {background:"#222222", color:"white"}]
                tooltips[14]=["http://img833.imageshack.us/img833/6633/denksc.png", "Het stijlvolle Jannes van der Wal Denksportcentrum", {background:"#222222", color:"white"}]
		tooltips[15]=["http://img101.imageshack.us/img101/3068/bendc.jpg", "Hoezo 1500 teveel?!", {background:"#222222", color:"white"}]
		tooltips[16]=["http://img14.imageshack.us/img14/7197/assen.gif", "Ja.... nu lachen we nog", {background:"#222222", color:"white"}]
		tooltips[17]=["http://img855.imageshack.us/img855/1750/tdej.jpg", "hmm,lastig......", {background:"#222222", color:"white"}]
		tooltips[18]=["http://img853.imageshack.us/img853/6859/oostermoer.png", "Cool and collected (foto Albert Prins)", {background:"#222222", color:"white"}]
		tooltips[19]=["http://img859.imageshack.us/img859/634/kroon.png", "De perfecte score", {background:"#222222", color:"white"}]
		tooltips[20]=["http://img585.imageshack.us/img585/9646/65269591.png", "Hier zien we Ti wel raak schieten", {background:"#222222", color:"white"}]
		tooltips[21]=["http://img194.imageshack.us/img194/9417/borg3.jpg", "", {background:"#222222", color:"white"}]
		tooltips[22]=["http://img848.imageshack.us/img848/674/borg11.jpg", "http://www.ewsum.info", {background:"#222222", color:"white"}]
		tooltips[23]=["http://img829.imageshack.us/img829/5238/borg7.jpg", "", {background:"#222222", color:"white"}]
		tooltips[24]=["http://img197.imageshack.us/img197/6051/uitnodigingsuyderoogh20.gif", "", {background:"#222222", color:"white"}]
		tooltips[25]=["http://img231.imageshack.us/img231/2742/38395326.jpg", "", {background:"#222222", color:"white"}]
		tooltips[26]=["http://img714.imageshack.us/img714/4226/voorkant1u.jpg", "", {background:"#222222", color:"white"}]
		tooltips[27]=["http://img820.imageshack.us/img820/2710/weers.png", "", {background:"#222222", color:"white"}]
		tooltips[28]=["http://img577.imageshack.us/img577/1130/img0245jn.jpg", "Elly in de haar op het lijf geschreven rol van perfecte gastvrouw.", {background:"#222222", color:"white"}]
		tooltips[29]=["http://img809.imageshack.us/img809/2355/img0235dl.jpg", "Joop krabbelt omhoog na zijn moment van onbezonnenheid.", {background:"#222222", color:"white"}]
		tooltips[30]=["http://img851.imageshack.us/img851/3016/img0237y.jpg", "", {background:"#222222", color:"white"}]
		tooltips[31]=["http://img856.imageshack.us/img856/5923/img0238b.jpg", "", {background:"#222222", color:"white"}]
		tooltips[32]=["http://img718.imageshack.us/img718/761/img0242cv.jpg", "", {background:"#222222", color:"white"}]
		tooltips[33]=["http://img854.imageshack.us/img854/354/scoresheet.jpg", "", {background:"#cccccc", color:"white"}]
		tooltips[34]=["http://img198.imageshack.us/img198/7360/parkerenw.jpg", "Aanvullende informatie: het laantje tussen de parkeerplaats en de borg (zo`n 250 meter)<br/>is goed begaanbaar, maar schaars verlicht.<br/> Wie slecht ter been is, mag de auto bij de borg parkeren.", {background:"#222222", color:"white"}]
		tooltips[35]=["http://img153.imageshack.us/img153/8859/foto0017kx.jpg", "", {background:"#000066", color:"white"}]
		tooltips[36]=["http://img41.imageshack.us/img41/9621/foto0019dn.jpg", "", {background:"#000066", color:"white"}]
		tooltips[37]=["http://img13.imageshack.us/img13/1955/foto0018yo.jpg", "", {background:"#000066", color:"white"}]
		tooltips[38]=["http://img257.imageshack.us/img257/6308/jvdb.gif", "What`s goin on?", {background:"#000066", color:"white"}]
		tooltips[39]=["http://img706.imageshack.us/img706/5760/bluesb.jpg", "", {background:"#000066", color:"white"}]
		tooltips[40]=["http://img440.imageshack.us/img440/5382/botwinnikpp02.jpg", "", {background:"#000066", color:"white"}]
		tooltips[41]=["http://img849.imageshack.us/img849/6766/echecsverrefumee.jpg", "", {background:"#000066", color:"white"}]
		tooltips[42]=["http://img805.imageshack.us/img805/4719/diagram02.jpg", "Maar wel een tikkie minder<br/> indrukwekkend als hier...(redactie)", {background:"#000066", color:"white"}]
		tooltips[43]=["http://img690.imageshack.us/img690/8118/meeuw.gif", "Kundige eindspelbehandeling<br/> van Michiel Meeuwsen  (red.)", {background:"#000066", color:"white"}]
		tooltips[44]=["http://img440.imageshack.us/img440/9431/knipselci.png", "De foto is ontleend aan een filmpje.<br/> Vaag, maar dat geldt niet de lach: <br/>Zó ziet glunderen er uit vlak na een<br/>  enerverende overwinning  (red.)", {background:"#000066", color:"white"}]
		tooltips[45]=["http://www.zernike.nl/site/web/uploads/6_zuidlaren4_klein.jpg", "", {background:"#000066", color:"white"}]
		tooltips[46]=["http://img18.imageshack.us/img18/4074/tijdnood.jpg", "", {background:"#cccccc", color:"white"}]
		tooltips[47]=["http://img716.imageshack.us/img716/9112/aaaqom.jpg", "", {background:"#cccccc", color:"white"}]
		tooltips[48]=["http://img534.imageshack.us/img534/849/stellingjoost.png", "Wit aan zet.", {background:"#cccccc", color:"black"}]
		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]")
