$(document).ready(function() {
	
	// получаем звезды
	star = $('img[src*=en_logo]:eq(0)').attr('src');
    star = star.match(/en_logo(\d+)/)[1];
	
	// выводим звезды
	$('#block-head .star div').animate({width: (star * 20) + 'px'}, 2500);

	// двигаем панораму мышкой =)
	$('#block-head').mousemove(function(e) {
		move = e.pageX * 100 / $('#block-head .back').width();
		$('#block-head .back').css({backgroundPosition: move + '% 0'});
	});

	// быстрый вход	
	if( $('#lnkUserName').length ) { 		
	} else {	
		var fast_form = $('#block-fastlogin');
		var fast_form_src = $('a[id$=lnkLogin]').attr('href');
		$('#block-fastlogin form').attr('action', fast_form_src);    	
		$('a[id$=lnkLogin]').before(fast_form);	
		$(fast_form).show();	
	}
	
	// баян всея руси	
	$('#menu-accordion .head').click(function(){			
		if ( $(this).is('.selected') ) { $(this).removeClass('selected').next('.item').slideUp(250); }
		else { 
			$(this).addClass('selected').siblings('.head').removeClass('selected');
			$('#menu-accordion .item:visible').slideUp(500);
			$(this).next('.item').slideDown(250);
		}	
	});
		
	// заголовки полей
	$('input.onfocus_pass').parent().prepend('<input class="label" type="text" value="Пароль" title="Пароль" />'); // пока так
	$('input.onfocus').focus(function(){ value = $(this).attr('title'); if($(this).val() == value) $(this).val(''); });		
	$('input.onfocus').blur(function(){ value = $(this).attr('title'); if($(this).val() == '') $(this).val(value); });					
	$('input.label').focus(function(){ $(this).hide().siblings('input').focus(); });		
	$('input.onfocus_pass').blur(function(){ if($(this).val() == '') $(this).siblings('input').show(); });
			
});
