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[1]=["../images/18wheeler.jpg", "18 Wheeler", {background:"white", font:"bold 12px Arial"}]
		tooltips[2]=["../racing_games/images/2_fast_2_furious.jpg", "2 Fast 2 Furious", {background:"white", font:"bold 12px Arial"}]
		tooltips[3]=["../racing_games/images/200mph_night_show.jpg", "200 MPH Night Show", {background:"white", font:"bold 12px Arial"}]
		tooltips[4]=["../racing_games/images/300mph.jpg", "300 MPH", {background:"white", font:"bold 12px Arial"}]
		tooltips[5]=["../racing_games/images/3D_Car_Racing.jpg", "3D Car Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[6]=["../racing_games/images/3D_Death_Race.jpg", "3D Deathrace", {background:"white", font:"bold 12px Arial"}]
		tooltips[7]=["../racing_games/images/3D-JetSki-Racing.jpg", "3D Jetski Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[8]=["../racing_games/images/3d_motor_bike_racing.jpg", "3D Motorbike Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[9]=["../racing_games/images/3D_Motorcycle_Racing.jpg", "3D Motorcycle Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[10]=["../racing_games/images/3D_Racing_Craze.jpg", "3D Racing Craze", {background:"white", font:"bold 12px Arial"}]
		tooltips[11]=["../racing_games/images/3D_Rally_Racing.jpg", "3D Rally Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[12]=["../racing_games/images/4wheelfury2.jpg", "4 Wheel Fury", {background:"white", font:"bold 12px Arial"}]
		tooltips[13]=["../racing_games/images/4wheelfury2.jpg", "4 Wheel Fury 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[14]=["../racing_games/images/4wheelmadness2.jpg", "4 Wheel Madness 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[15]=["../racing_games/images/4wheelmadness2.jpg", "4 Wheel Madness 3", {background:"white", font:"bold 12px Arial"}]
		tooltips[16]=["../racing_games/images/4x4_Rally.jpg", "4X4 Rally", {background:"white", font:"bold 12px Arial"}]
		tooltips[17]=["../racing_games/images/50S_Sports_Car.jpg", "50S Sports Car", {background:"white", font:"bold 12px Arial"}]
		tooltips[18]=["../racing_games/images/700_BHP.jpg", "700 BHP", {background:"white", font:"bold 12px Arial"}]
		tooltips[19]=["../racing_games/images/American_Racer.jpg", "American Racer", {background:"white", font:"bold 12px Arial"}]
		tooltips[20]=["../racing_games/images/AMG_Drift_Revolution.jpg", "AMG Drift Revolution", {background:"white", font:"bold 12px Arial"}]
		tooltips[21]=["../racing_games/images/Atomic_Racer.jpg", "Atomic Racer", {background:"white", font:"bold 12px Arial"}]
		tooltips[22]=["../racing_games/images/ATV_Extreme.jpg", "ATV Extreme", {background:"white", font:"bold 12px Arial"}]
		tooltips[23]=["../racing_games/images/Bahrain_Racer.jpg", "Bahrain Racer", {background:"white", font:"bold 12px Arial"}]
		tooltips[24]=["../racing_games/images/Banger_Racing.jpg", "Banger Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[25]=["../racing_games/images/Beach_Racer_3D.jpg", "Beach Racer 3D", {background:"white", font:"bold 12px Arial"}]
		tooltips[26]=["../racing_games/images/Big_Truck_Adventure.gif", "Big Truck Adventure", {background:"white", font:"bold 12px Arial"}]
		tooltips[27]=["../racing_games/images/Big-Truck-Adventures2.gif", "Big Truck Adventures 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[28]=["../racing_games/images/Bike_Mania_4.jpg", "Bike Mania 4", {background:"white", font:"bold 12px Arial"}]
		tooltips[29]=["../racing_games/images/Bike_Mania_on_Ice.jpg", "Bike Mania on Ice", {background:"white", font:"bold 12px Arial"}]
		tooltips[30]=["../racing_games/images/Bike_Racer.jpg", "Bike Racer", {background:"white", font:"bold 12px Arial"}]
		tooltips[31]=["../racing_games/images/Blade_Racing.jpg", "Blade Racing", {background:"white", font:"bold 12px Arial"}]
		tooltips[32]=["../racing_games/images/Box-10-Rally.jpg", "Box 10 Rally", {background:"white", font:"bold 12px Arial"}]
		tooltips[33]=["../racing_games/images/Box_Racers.jpg", "Box Racers", {background:"white", font:"bold 12px Arial"}]
		tooltips[34]=["../racing_games/images/Braap-Braap.jpg", "Braap Braap", {background:"white", font:"bold 12px Arial"}]
		tooltips[35]=["../racing_games/images/Brakeless.jpg", "Brakeless", {background:"white", font:"bold 12px Arial"}]
		tooltips[36]=["../racing_games/images/Buggy_Run.jpg", "Buggy Run", {background:"white", font:"bold 12px Arial"}]
		tooltips[37]=["../racing_games/images/Buggy_Run_2.jpg", "Buggy Run 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[38]=["../racing_games/images/Burning_Rubber_2.jpg", "Burning Rubber 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[39]=["../racing_games/images/Cab_Driver.jpg", "Cab Driver", {background:"white", font:"bold 12px Arial"}]
		tooltips[40]=["../racing_games/images/Car_Destruction_Race.jpg", "Car Destruction Race", {background:"white", font:"bold 12px Arial"}]
		tooltips[41]=["../racing_games/images/Caravan_Parking_2.jpg", "Caravan Parking 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[42]=["../racing_games/images/City_Racers.jpg", "City Racers", {background:"white", font:"bold 12px Arial"}]
		tooltips[43]=["../racing_games/images/Cornfield_5000.jpg", "Cornfield 5000", {background:"white", font:"bold 12px Arial"}]
		tooltips[44]=["../racing_games/images/Crazy_Jeep.jpg", "Crazy Jeep", {background:"white", font:"bold 12px Arial"}]
		tooltips[45]=["../racing_games/images/Crazy_Mustang.jpg", "Crazy Mustang", {background:"white", font:"bold 12px Arial"}]
		tooltips[46]=["../racing_games/images/Danger_Wheels.jpg", "Danger Wheels", {background:"white", font:"bold 12px Arial"}]
		tooltips[47]=["../racing_games/images/Dare_Devil_2.jpg", "Dare Devil", {background:"white", font:"bold 12px Arial"}]
		tooltips[48]=["../racing_games/images/Dare_Devil_2.jpg", "Dare Devil 2", {background:"white", font:"bold 12px Arial"}]
		tooltips[49]=["../racing_games/images/DeadlyDrive.jpg", "Deadly Drive", {background:"white", font:"bold 12px Arial"}]
		tooltips[50]=["../racing_games/images/Deadly_Race.jpg", "Deadly Race", {background:"white", font:"bold 12px Arial"}]
		tooltips[51]=["../racing_games/images/Demolish_Truck.jpg", "Demolish Truck", {background:"white", font:"bold 12px Arial"}]
		tooltips[52]=["../racing_games/images/DeserRacer.jpg", "DeserRacer", {background:"white", font:"bold 12px Arial"}]
		tooltips[53]=["../racing_games/images/DeserRacer.jpg", "Desert Racer", {background:"white", font:"bold 12px Arial"}]
		tooltips[54]=["../racing_games/images/Dirt_Bike.jpg", "Dirt Bike", {background:"white", font:"bold 12px Arial"}]
		tooltips[55]=["../racing_games/images/Dirt_Bike_2.jpg", "Dirt Bike 2", {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" class="bg1"><img src="' + tipinfo[0] + '" width="114" height="79" style="margin-top:5px" /></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]")
