$(function(){
	//разворачивающиеся списки
	$('.text_switcher, .text_switcher2, .text_switcher3').hide();
	$('.link_switcher').click(function(event) {
		event.preventDefault();
		$('.text_switcher', $(this).parent()).slideToggle("slow");
		if ($(this).text() == 'подробнее') $(this).text('свернуть');
		else $(this).text('подробнее'); 
	});
	$('.link_switcher2').click(function(event) {
		event.preventDefault();
		$('.text_switcher2', $(this).parent().parent()).slideToggle("slow");
	});
	$('.link_switcher3').click(function(event) {
		event.preventDefault();
		
		$('.text_switcher3', $(this).parent().parent()).slideToggle("slow");
		
		if ($(this).css('background-position') == '100% 0%') {
			$(this).css('background-position', '100% 100%');
			$(this).text('свернуть');
		} else {
			$(this).css('background-position', '100% 0%');						
			$(this).text('развернуть');
		}
	});
	
	//форма авторизации
	var auth_form_h = $('#auth_form').height();
	var wr_form = false;//флаг - заполняется ли форма авторизации
	$('#auth, .auth').hover(//, .auth
		function (){ 
			$('#auth_form').stop().slideDown('slow', function() {$(this).css('height', auth_form_h)}); 
		},
		function (){ 
			if (!wr_form) 
				$('#auth_form').stop().slideUp('slow', function() {$(this).css('height', auth_form_h)}); 
		}
	);
	$('#auth input, .auth input').focus(function () {wr_form = true});
	$('#auth input, .auth input').blur(function () {wr_form = false});

	/*$('select.select_width').each(function() {
		if (width = $(this).css("width")) {
			$(this).click(function() {
				$(this).css("width", "auto");
			});
			$(this).blur(function() {
				$(this).css("width", width);
			});
		}
	});*/
});
