/* 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]=["red_balloon.gif", "Here is a red balloon<br /> on a white background", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue"}]
		tooltips[1]=["duck2.gif", "Here is a duck on a light blue background.", {background:"#DDECFF", width:"200px"}]
		tooltips[2]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/berecki_laszlo.jpg"]
		tooltips[3]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/ferenczi_zita.jpg"]
		tooltips[4]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/janosi_attila.jpg"]
		tooltips[5]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/laza_bori.jpg"]
		tooltips[6]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/slimbarszki_reka.jpg"]
		tooltips[7]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/varga_erna.jpg"]
		tooltips[8]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/varga_sandor.jpg"]
		tooltips[9]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/vary_zsolt.jpg"]
		tooltips[10]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/baksai_misi.jpg"]
		tooltips[11]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/horvath_dora.jpg"]
		tooltips[12]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/hummel_krisztian.jpg"]
		tooltips[13]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/labancz_domonkos.jpg"]
		tooltips[14]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/molnar_zsolt.jpg"]
		tooltips[15]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/sapi_zoltan.jpg"]
		tooltips[16]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/tabajdi_peter.jpg"]
		tooltips[17]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/toth_virag.jpg"]
		tooltips[18]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/varga_erna.jpg"]
		tooltips[19]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/vary_zsolt.jpg"]
		tooltips[20]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/bartakovics_edina.jpg"]
		tooltips[21]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/hajdu_vivien.jpg"]
		tooltips[22]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/kard_anna.jpg"]
		tooltips[23]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/kiraly_betti.jpg"]
		tooltips[24]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/koma_zsofia.jpg"]
		tooltips[25]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/ladanyi_betti.jpg"]
		tooltips[26]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/meszaros_csaba.jpg"]
		tooltips[27]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/safran_evelin.jpg"]
		tooltips[28]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/szili_renata.jpg"]
		tooltips[29]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/bajzak_kriszti.jpg"]
		tooltips[30]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/besenyi_anna.jpg"]
		tooltips[31]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/bogsch_ildi.jpg"]
		tooltips[32]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/boldizsar_marton.jpg"]
		tooltips[33]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/bulyovszki_adam.jpg"]
		tooltips[34]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/csorgics_matyas.jpg"]
		tooltips[35]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/eisam_eldeen_fatima.jpg"]
		tooltips[36]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/farkas_bertalan.jpg"]
		tooltips[37]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/finder_balazs.jpg"]
		tooltips[38]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/futo_peter.jpg"]
		tooltips[39]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/gyorkos_dorka.jpg"]
		tooltips[40]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/hulej_vanda.jpg"]
		tooltips[41]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/ignacz_dori.jpg"]
		tooltips[42]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/jancso_tamas.jpg"]
		tooltips[43]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/kasa_gabriella.jpg"]
		tooltips[44]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/kurtan_gabor.jpg"]
		tooltips[45]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/kurthy_dori.jpg"]
		tooltips[46]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/lellei_nori.jpg"]
		tooltips[47]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/mazsas_istvan_sandor.jpg"]
		tooltips[48]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/morandini_viktor.jpg"]
		tooltips[49]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/neumann_viktor.jpg"]
		tooltips[50]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/olli_adam.jpg"]
		tooltips[51]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/orgel_csilla.jpg"]
		tooltips[52]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/pacza_tamas.jpg"]
		tooltips[53]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/persa_virag.jpg"]
		tooltips[54]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/polai_dori.jpg"]
		tooltips[55]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/safian_fanni.jpg"]
		tooltips[56]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/szabo_judit.jpg"]
		tooltips[57]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/takacs_peter.jpg"]
		tooltips[58]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/toplak_jozsef.jpg"]
		tooltips[59]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/vajas_akos.jpg"]
		tooltips[60]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/varga_viktoria.jpg"]
		tooltips[61]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/viszlai_timea.jpg"]
		tooltips[62]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/kollar_gabor.jpg"]
		tooltips[63]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/anderle_endre.jpg"]
		tooltips[64]=["http://foldtud.elte.hu/wp-content/uploads/2010/11/csapat/szabo_peter.jpg"]
		//tooltips[3]=["../dynamicindex17/bridge.gif", "Bridge to somewhere.", {background:"white", font:"bold 12px Arial"}]

		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]")
