	$(document).ready(function() {
	
		$('.ntip').tipsy({gravity: 's', fade:true});
		$('.stip').tipsy({gravity: 'n', fade:true});
		$('.etip').tipsy({gravity: 'w', fade:true});
		$('.wtip').tipsy({gravity: 'e', fade:true});
	
		$('#slider').coinslider({ width: 940, height: 330, navigation: true, delay: 5000 });
		
		$('span.close').click(function() { $(this).parent().fadeOut(400); });
		$('#content img').hide();
		
		$('ul.sf-menu').before('<div id="nav-finish"></div>');
		
		var i = 0;
		var int=0;
		$(window).bind("load", function() { var int = setInterval("preload(i)",300); });	

		function preload() {
			var images = $('#content img').length;
			if (i >= images) { clearInterval(int); }
			$('#content img:hidden').eq(0).fadeIn(500);
			i++;
		}
		
		
		  $(" .navigation ul ").css({display: "none"}); // Opera Fix
			$(" .navigation li").hover(function(){ 
				$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(400);
				},function(){ $(this).find('ul:first').css({visibility: "hidden"}); });   
		
		
		
		
			$("a[rel=group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Изображение ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
	});
	
	$("a[rel=group2]").fancybox({
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	
	});


