$(document).ready(function(){

	$('.choice-group').hover( function() {
		$('.list-group').css( 'display', 'block' );
	}, function() {
		$('.list-group').css( 'display', 'none' );
	});

	$('<div class="about-work"></div>').prependTo($('.img-block li'));
	$('.about-work').css( 'opacity', '0.5' );

	$('.mauseover').mouseover( function() {
		$('.blank').css( 'display', 'none' )
	}).mouseout( function() {
		$('.blank').css( 'display', 'block' )
	});

	$('.sub-link, .navigation').hover( function() {
		var id = $('a', this).attr('href');
		var element = $(id);
		var now = $(this);

		$(this).addClass( 'sub-link-active' ).css( 'display', 'block' );
		$('.bottom-menu').css( 'visibility', 'hidden' );
		element.css( 'display', 'block' );

		element.mouseover( function() {
			now.addClass( 'sub-link-active' );
		}).mouseout( function() {
			now.removeClass( 'sub-link-active' );
		});
	},
		function() {
		var id = $('a', this).attr('href');
		var element = $(id);

		$(this).removeClass('sub-link-active');
		$('.bottom-menu').css( 'visibility', 'visible' );
		$('.sub-m').css( 'display', 'none' );
	}).click( function() { return false });
	
});
	
$(function () {
	$('.img-block li').each(function () {
		var hideDelayTimer = null;
		var beingShown = false;
		var shown = false;
		var trigger = $('.mauseover', this);
		var info = $('.about', this);
		var work = $('.about-work', this);

		$([trigger.get(0), info.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				return;
			} else {
				beingShown = true;
				info.css({ display: 'block' });
				work.css({ display: 'block' });
				beingShown = false;
				shown = true;
			}
			return false;
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				info.css({ display: 'none' });
				work.css({ display: 'none' });
				shown = false;

			});
			return false;
		});
	});
});

