$(function() {
	if($('.authBlock').length>0) {
		if(($('.authBlock .login input').attr('value')=='') && ($('.authBlock .password input').attr('value')=='')) {
			$('.authBlock .login label, .authBlock .password label')
				.css({display: 'block'})
				.click(function() {
					$(this).css({display: 'none'}).next().focus();
				});
			$('.authBlock .login input, .authBlock .password input')
				.focus(function() {
					$(this).prev().css({display: 'none'});
				})
				.blur(function() {
					if($(this).attr('value')=='') {
						$(this).prev().css({display: 'block'});
					}
				});
		}
	}

	$('#menu ul li span, #menu ul li a.active').each(function() {
		$('#menu .'+$(this).parent().attr('class')+'Hover').css({display: 'block'});
	});
	$('#menu ul li a:not(.active)').hover(
		function() {
			$('#menu .'+$(this).parent().attr('class')+'Hover').css({display: 'block'});
		},
		function() {
			$('#menu .'+$(this).parent().attr('class')+'Hover').css({display: 'none'});
		}
	)

	$('.photoScroll').each(function() {
		var scrolParent = $(this),
			itemWidth = 130,
			itemCount = 5;
		if($(this).hasClass('shortScroll')) itemCount = 3;
		$('ul', this).css({width: $('li', this).length*itemWidth});
		$('.arrowLeft', this).click(function() {
			if(scrolParent.data('animated') || ($('ul', scrolParent).position().left==0)) return false;
			scrolParent.data('animated', true);
			$('ul', scrolParent).animate({left: '+=130px'}, 250, function() {
				scrolParent.removeData('animated');
			});
		})
		$('.arrowRight', this).click(function() {
			if(scrolParent.data('animated') || ($('li', scrolParent).length*itemWidth+$('ul', scrolParent).position().left==itemWidth*itemCount)) return false;
			scrolParent.data('animated', true);
			$('ul', scrolParent).animate({left: '-=130px'}, 250, function() {
				scrolParent.removeData('animated');
			});
		})
	});
	
	$('#about .subMenu li').click(function() {
		$('#about .subMenu li').removeClass();
		$(this).addClass('current');
		$('#about .aboutText').css({display: 'none'});
		$('#about .aboutText:eq('+$(this).index()+')').css({display: 'block'});
	});
})
