$(document).ready(function(){
	//
	$('#linkBlock').mouseover(function(){
		drawerCloseEngine();
	});
	$('ul#mainMenu > li h2').click(function(event){
		//
		event.preventDefault();
		$(this).parent('li').attr('class', 'current');
		var bg2Show = $(this).parent('li').attr('id');
		bg2Show = bg2Show.replace('mainMenuLink', '');
		$(this).next('.drawerRail').animate({
			height: '0px'
		}, 100, function(){
			$('#bgLayer > img').animate({
				//
				opacity: 0.0
			}, 450, function(){
				$('#bgLayer > img:eq('+eval(parseInt(bg2Show)-1)+')').animate({
					//
					opacity: 1.0
				}, 400);
			});
			//alert(eval(parseInt(bg2Show)-1));
			$(this).animate({
				height: '330px'
			}, 650, function(){
				$(this).animate({
					height: '300px'
				}, 200);
				$('#linkBlock').css({
					'display': 'block'
				});
			});
		});
	});
	$('ul#mainMenu > li .drawerRail div.drawer > .collant a').click(function(event){
		event.preventDefault();
		var link2Go = $(this).attr('href');
		drawerCloseEngine(link2Go);
	});
	staticElementSetUp();
});
$(window).resize(function(){
	staticElementSetUp();
});
