/* 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]=["images/no_photo.jpg", "Фото недоступна. Временно.", {background:"#FFFFFF", color:"black", border:"5px ridge darkblue"}]
		tooltips[1]=["images/no_photo.jpg", "Фото недоступна. Временно.", {background:"#DDECFF", width:"200px"}]
		tooltips[2]=["images/no_photo.jpg"]
		tooltips[3]=["images/no_photo.jpg", "Фото недоступна. Временно.", {background:"white", font:"bold 12px Arial"}]
		
		//Уздечки		
		tooltips[1001]=["images/bridles/1001/bridle_1001_b1.jpg", "Уздечка кожаная, с восьмеркой и подложкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1002]=["images/bridles/1002/bridle_1002_b1.jpg", "Уздечка кожаная, с подложкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1003]=["images/bridles/1003/bridle_1003_b1.jpg", "Уздечка косичка, с подложкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1004]=["images/bridles/1004/bridle_1004_b1.jpg", "Уздечка простая, без подложки.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1005]=["images/bridles/1005/bridle_1005_b1.jpg", "Уздечка с капсюлем, мартинаглом, поводом.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1006]=["images/bridles/1006/bridle_1006_b1.jpg", "Оголовье выездковое с поводом.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1007]=["images/bridles/1007/bridle_1007_b1.jpg", "Уздечка дутая с тесьмяным поводом.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1008]=["images/bridles/1008/bridle_1008_b1.jpg", "Уздечка Кука, безтрензельная.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1009]=["images/bridles/1009/bridle_1009_b1.jpg", "Уздечка с ганноверским капсюлем.", {background:"white", font:"bold 12px Arial"}]
		
		//Трензеля
		tooltips[1020]=["images/snaffles/1020/snaffle_1020_b1.jpg", "Трензель дутый. Империал D-образный.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1021]=["images/snaffles/1021/snaffle_1021_b1.jpg", "Трензель дутый. Империал D-образный.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1022]=["images/snaffles/1022/snaffle_1022_b1.jpg", "Трензель дутый. С сочленением.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1023]=["images/snaffles/1023/snaffle_1023_b1.jpg", "Трензель цельный. Полированный.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1024]=["images/snaffles/1024/snaffle_1024_b1.jpg", "Трензель цельный. Стандартный.", {background:"white", font:"bold 12px Arial"}]
		
		
		tooltips[1060]=["images/bridles/1060/bridle_1060_b1.jpg", "Недоуздок кожаный.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1061]=["images/bridles/1061/bridle_1061_b1.jpg", "Недоуздок синтетический.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1062]=["images/bridles/1062/bridle_1062_b1.jpg", "Недоуздок плетеный, веревочный.", {background:"white", font:"bold 12px Arial"}]
		
		//Поводья
		tooltips[1101]=["images/reins/1101/reins_1101_b1.jpg", "Повод кожаный, проплетеный. Толщина 12-20мм/", {background:"white", font:"bold 12px Arial"}]
		tooltips[1102]=["images/reins/1102/reins_1102_b1.jpg", "Повод тесмяный. С нашивками.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1103]=["images/reins/1103/reins_1103_b1.jpg", "Повод кожаный. С нашивками.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1104]=["images/reins/1104/reins_1104_b1.jpg", "Повод прорезиненный.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1105]=["images/reins/1105/reins_1105_b1.jpg", "Повод резиновый. Шланг.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1120]=["images/reins/1120/reins_1120_b1.jpg", "Шпрунт кожаный.", {background:"white", font:"bold 12px Arial"}]

		//Налобники
		tooltips[1201]=["images/bridles/1201/nalobnik_1201_b1.jpg", "Налобник дутый, змейка, цветной, с подложкой", {background:"white", font:"bold 12px Arial"}]
		
		//Капсюль
		tooltips[1301]=["images/nosebands/1301/noseband_1301_b1.jpg", "Капсюль чешский, без подложки.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1302]=["images/nosebands/1302/noseband_1302_b1.jpg", "Капсюль ганноверский, с подложкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1303]=["images/nosebands/1303/noseband_1303_b1.jpg", "Капсюль немецкий самозатягивающийся, с подложкой и восьмеркой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1304]=["images/nosebands/1304/noseband_1304_b1.jpg", "Капсюль немецкий самозатягивающийся, с подложкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[1305]=["images/nosebands/1305/noseband_1305_b1.jpg", "Капсюль мексиканский без налобника.", {background:"white", font:"bold 12px Arial"}]
		
		//Подпруги
		tooltips[2001]=["images/girths/2001/girth_2001_b1.jpg", "Подпруга для выездкового седла, неопреновая, короткая", {background:"white", font:"bold 12px Arial"}]
		tooltips[2002]=["images/girths/2002/girth_2002_b1.jpg", "Подпруга симпатекс, с резинкой", {background:"white", font:"bold 12px Arial"}]
		tooltips[2003]=["images/girths/2003/girth_2003_b1.jpg", "Подпруга тесьмяная, с резинкой", {background:"white", font:"bold 12px Arial"}]
		tooltips[2004]=["images/girths/2004/girth_2004_b1.jpg", "Подпруга кожанная, с резинкой. 110-150см", {background:"white", font:"bold 12px Arial"}]
		tooltips[2005]=["images/girths/2005/girth_2005_b1.jpg", "Подпруга кожанная, с нагрудником. 110-160см", {background:"white", font:"bold 12px Arial"}]
		tooltips[2006]=["images/girths/2006/girth_2006_b1.jpg", "Подпруга для выездкового седла, симпатекс, короткая", {background:"white", font:"bold 12px Arial"}]
		
		//Мартингалы и подперсья		
		tooltips[2101]=["images/martingales/2101/martingale_2101_b1.jpg", "Развязки на кольце. Кожаные.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2102]=["images/martingales/2102/martingale_2102_b1.jpg", "Подперсье резиновое.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2103]=["images/martingales/2103/martingale_2103_b1.jpg", "Мартингал охотничий.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2104]=["images/martingales/2104/martingale_2104_b1.jpg", "Мартингал короткий.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2105]=["images/martingales/2105/martingale_2105_b1.jpg", "Шамбон кожаный.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2106]=["images/martingales/2106/martingale_2106_b1.jpg", "Подперсье вестерн. Кожанное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2107]=["images/martingales/2107/martingale_2107_b1.jpg", "Подперсье нагрудное. С подложкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2108]=["images/martingales/2108/martingale_2108_b1.jpg", "Комплект Thiedemann с поводом.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2109]=["images/martingales/2109/martingale_2109_b1.jpg", "Подперсье спортивное. Кожанное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2110]=["images/martingales/2110/martingale_2110_b1.jpg", "Пахва (подхвостник). Кожаный.", {background:"white", font:"bold 12px Arial"}]
		
		//Путлище
		tooltips[2401]=["images/stirrup/2401/stirrup_2401_b1.jpg", "Путлище. Стандарт, 150 см.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2402]=["images/stirrup/2402/stirrup_2402_b1.jpg", "Путлище. Выездка, 100 см.", {background:"white", font:"bold 12px Arial"}]
		
		//Стремена
		tooltips[2430]=["images/stirrup/2430/stirrup_2430_b1.jpg", "Стремена. Стандарт, 12 см.", {background:"white", font:"bold 12px Arial"}]
		tooltips[2431]=["images/stirrup/2431/stirrup_2431_b1.jpg", "Стремена безопасные, 12 см.", {background:"white", font:"bold 12px Arial"}]
		
		//Подушки под седло
		tooltips[2501]=["images/pads/2501/furpad_2501_b8.jpg", "Подушка меховушка под седло.", {background:"white", font:"bold 12px Arial"}]

		//Краги из кожи
		tooltips[3001]=["images/chaps/3001/chaps_3001_b1.jpg", "р-р 38-43, краги на пряжках.;", {background:"white", font:"bold 12px Arial"}]
		tooltips[3002]=["images/chaps/3002/chaps_3002_b1.jpg", "р-р 38-43, краги с молнией и резинкой.", {background:"white", font:"bold 12px Arial"}]
		tooltips[3003]=["images/chaps/3003/chaps_3003_b1.jpg", "р-р 38-45, краги на заказ.", {background:"white", font:"bold 12px Arial"}]
		
		//Ногавки
		tooltips[3101]=["images/shoes/3101/shoes_3101_b1.jpg", "Ногавки передние, кожаные.", {background:"white", font:"bold 12px Arial"}]
		tooltips[3102]=["images/shoes/3102/shoes_3102_b1.jpg", "Ногавки задние, кожаные.", {background:"white", font:"bold 12px Arial"}]
		tooltips[3103]=["images/nophoto_b.gif", "Ногавки передние, поло.", {background:"white", font:"bold 12px Arial"}]
		tooltips[3104]=["images/nophoto_b.gif", "Ногавки задние, поло.", {background:"white", font:"bold 12px Arial"}]
		tooltips[3105]=["images/shoes/3105/shoes_3105_b1.jpg", "Колокольчики кожаные. Пара.", {background:"white", font:"bold 12px Arial"}]
		
		//Ногавки PFIFF
		tooltips[3120]=["images/shoes/3120/shoes_3120_b1.jpg", "Транспортировочные ногавки. Передние и задние.", {background:"white", font:"bold 12px Arial"}]
		tooltips[3121]=["images/shoes/3121/shoes_3121_b1.jpg", "Ногавки. Передние и задние.", {background:"white", font:"bold 12px Arial"}]
		
		//Седла конкур
		tooltips[4001]=["images/saddles/4001/saddle_4001_b1.jpg", "17&quot; конкурное. Классическое", {background:"white", font:"bold 12px Arial"}]
		tooltips[4002]=["images/saddles/4002/saddle_4002_b1.jpg", "17&quot; конкурное. Стандартное", {background:"white", font:"bold 12px Arial"}]
		tooltips[4003]=["images/saddles/4003/saddle_4003_b1.jpg", "17&quot; конкурное. Стандартное", {background:"white", font:"bold 12px Arial"}]
		tooltips[4004]=["images/saddles/4004/saddle_4004_b1.jpg", "17&quot; конкурное. Стандартное, без выноса", {background:"white", font:"bold 12px Arial"}]
		tooltips[4005]=["images/saddles/granpri/saddle_granpri_b1.jpg", "17&quot; Конкурное, Гран-При.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4006]=["images/saddles/saddle_4006_b.jpg", "17&quot; троеборное. С вырезом или без выреза.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4007]=["images/saddles/saddle_4007_b.jpg", "17&quot; Офицерское. Элитное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4008]=["images/saddles/saddle_4008_b.jpg", "16&quot; Скаковое.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4009]=["images/saddles/saddle_4009_b.jpg", "17&quot; Конкурное, классика.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4010]=["images/saddles/saddle_4010_b.jpg", "17&quot; Выездковое. Престиж.", {background:"white", font:"bold 12px Arial"}]		
		
		//Седла выездка		
		tooltips[4030]=["images/saddles/4030/saddle_4030_b1.jpg", "17&quot; Выездковое. Стандарт.", {background:"white", font:"bold 12px Arial"}]	
		tooltips[4031]=["images/saddles/4031/saddle_4031_b1.jpg", "17&quot; Выездковое. Стандарт.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4032]=["images/saddles/diamand/saddle_4033_b1.jpg", "17&quot; Выездковое. Диамант.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4033]=["images/saddles/4033/saddle_4033_b1.jpg", "17&quot; Выездковое. Диамант-Харди.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4034]=["images/saddles/4034/saddle_4034_b1.jpg", "17&quot; Выездковое. Диамант Эластик.", {background:"white", font:"bold 12px Arial"}]
		
		//Седла троеборье		
		tooltips[4060]=["images/saddles/4060/saddle_4060_b1.jpg", "17&quot; Троеборное. Стандартное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4061]=["images/saddles/4061/saddle_4061_b1.jpg", "17&quot; Троеборное. Стандартное.", {background:"white", font:"bold 12px Arial"}]
		
		//Седла разные		
		tooltips[4080]=["images/saddles/4080/saddle_4080_b1.jpg", "17&quot; Учебное. Стандартное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4081]=["images/saddles/4081/saddle_4081_b1.jpg", "16&quot; Скаковое. Стандартное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4082]=["images/saddles/4082/saddle_4082_b1.jpg", "18&quot; Универсальное. XXXL.", {background:"white", font:"bold 12px Arial"}]
		
		//Седла новые, хобби, престиж		
		tooltips[4090]=["images/saddles/4090/saddle_4090_b1.jpg", "17&quot; easy ride. Prestige, прогулочное.", {background:"white", font:"bold 12px Arial"}]
		tooltips[4091]=["images/saddles/4091/saddle_4091_b1.jpg", "17&quot; варшавское (офицерское).", {background:"white", font:"bold 12px Arial"}]
		
		//Разное всякое		
		tooltips[8000]=["images/other/8000/other_8000_b1.jpg", "Инструмент для расчистки и ковки лошадей.", {background:"white", font:"bold 12px Arial"}]
		tooltips[8001]=["images/other/8001/other_8001_b1.jpg", "Нож для гривы.", {background:"white", font:"bold 12px Arial"}]
		tooltips[8020]=["images/other/8020/other_8020_b1.jpg", "Защитная резинка для шпор.", {background:"white", font:"bold 12px Arial"}]
		
		//Чистка
		tooltips[8100]=["images/other/8100/other_8100_b1.jpg", "Массажка резиновая.", {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]")
