$.fn.accordionShow = function($t,$dds,$target) {
		
		$dds.each(function(){
			var $t = $(this);
			if($t.width() > 0){
				$t.animate({
					width:0
				},'slow',function(){$(this).hide();});
			}
		});
		$target.animate({
			width: '80%'
		},'slow');
}

$(function(){
	
	var $acc = $('dl.accordion');
	var $dts = $acc.children('dt');
	var $dds = $acc.children('dd');
	var $nexts = $('dl.accordion dd .next_link');
	var $prevs = $('dl.accordion dd .prev_link');
	var $target = $acc.children('dd:last');
	
	$dds.animate({
			width:0
		},'fast',function(){$(this).hide();});
	$target.animate({
			width: '80%'
		},'slow');
		
	$dts.hover(function(){
		var $t = $(this);
		$t.animate({
			paddingTop:'30px',
			paddingBottom:'0px'
		},'fast');
	},function(){
		var $t = $(this);
		$t.animate({
			paddingTop:'10px',
			paddingBottom:'20px'
		},'fast');
	});
	
	$dts.click(function(){
		var $t = $(this);
		var $target = $t.next('dd');
		$t.accordionShow($t,$dds,$target);
	});
	
	$prevs.click(function(){
		var $t = $(this).parent().parent().next('dt');
		var $target = $t.next('dd');

		$t.accordionShow($t,$dds,$target);
	});
	
	$nexts.click(function(){
		var $t = $(this).parent().parent().prev('dt');
		var $target = $t.prev('dd');
		$t.accordionShow($t,$dds,$target);
	});
	
	$prevs.slice(-1).hide();
	$nexts.slice(0,1).hide();

});
