	$().ready(function(){
		$('.dropdown .dropdown_title a').click(function(){
			
			$('.dropdown .dropdown_title .pad').fadeOut(200);
			$('.dropdown .dropdown_list').fadeOut(200);
			$('.dropdown .wrp').removeClass('active');
			
			var $this = $(this);
			
			var $wrp = $this.parents('.wrp').eq(0);
			
			if ($wrp.hasClass('active')){
				return false;
			}
			
			var $list = $('.dropdown_list', $this.parents('.dropdown'));
			var $title = $('.pad', $this.parents('.dropdown_title'));
			var $width_title = $this.parents('.c').width();
			var $title_length = $this.parents('.c').eq(0).find('a').text().length;
			var $list_length = $('.m .c', $list).text().length;
			
			if ($list_length < $title_length){
				$list.css({width: $width_title + 34});
				//$('.m .c', $list).css({width: $width_title + 10});
				//$wrp.addClass('wide').css({width: $width_title + 24});
			} else if ($list_length - $title_length < 5){
				$list.css({width: $width_title + 34});
			}
			
			$('.pad', $this.parents('.c').eq(0)).css({width: $width_title + 1});
			$title.fadeIn(200);
			$list.fadeIn(200);
			
			$wrp.toggleClass('active');
			
			$('body').bind('click',function(){
				$title.fadeOut(200);
				$list.fadeOut(200);
				
				$wrp.removeClass('active');
				
				$(this).unbind('click');
			});
			
			return false;
		});
	
	})

