$(document).ready
(
	function()
	{
		$('div#rubr > a').each
		(
			function(lnkInd, lnk)
			{
				$(lnk).hover
				(
					function()
					{
						$(this).css('border-color', '#949494');
						$('div#rubr > div').each
						(
							function(divInd, div)
							{
								if ( lnkInd == divInd)
								{
									$(div).stopTime(divInd);
									var lnkPos = $(lnk).offset();
									$(div).css({'left':lnkPos.left, 'top':lnkPos.top+$(lnk).outerHeight(), 'z-index':10, 'background':'url(/images/ddMenuTop.gif) '+($(lnk).outerWidth()-2)+'px top no-repeat #FFF'});
									$(div).slideDown('fast', function(){$(this).show();});
								}
							}
						);
					},
					function()
					{
						var lnk = this;
						$('div#rubr > div').each
						(
							function(divInd, div)
							{
								if ( lnkInd == divInd )
								{
									$(div).css({'z-index':5});
									$(div).oneTime
									(
										400,
										divInd,
										function()
										{
											$(this).slideUp('fast', function(){$(this).hide(); $(lnk).css('border-color', '#ffffff');});
										}
									);
								}
							}
						);
					}
				);
			}
		);
		
		$('div#rubr > div').each
		(
			function(divInd, div)
			{
				$(div).hover
				(
					function()
					{
						$(this).stopTime(divInd);
						$('div#rubr > a').each
						(
							function(linkInd, link)
							{
								if ( linkInd == divInd)
								{
									$(link).css('border-color', '#949494');
								}
							}
						);
						$(this).css({'z-index':10});
						$(this).slideDown('fast', function(){$(this).show()});
					},
					function()
					{
						$(this).css({'z-index':5});
						$(this).oneTime
						(
							400,
							divInd,
							function()
							{
								$(this).slideUp
								(
									'fast',
									function()
									{
										$(this).hide();
										$('div#rubr > a').each
										(
											function(linkInd, link)
											{
												if ( linkInd == divInd)
												{
													$(link).css('border-color', '#ffffff');
												}
											}
										);
									}
								);
							}
						)
					}
				);
			}
		);
		$('a.gallery').lightBox
		(
			{
				overlayBgColor:'#666',
				overlayOpacity:0.6,
				txtImage:'Изображение',
				txtOf:'из'
			}
		);


	}
);
