function set_marker_position(context, new_pos) {
	if (new_pos!=$j(context).next().find('.fragment').length-1) {
		$j(context).find('a.button-next').attr({
			href: $j(context).find('a.button-next').attr('href').replace(/\d+$/, parseInt(new_pos) + parseInt(1))
		});	
	}
	if(new_pos!=0) {
		$j(context).find('a.button-prev').attr({
			href: $j(context).find('a.button-prev').attr('href').replace(/\d+$/, parseInt(new_pos) - parseInt(1))
		});
	}
}
$j(function(){
	$j('.slider .buttons a').click(function() {
		var idx = this.href.replace(/^.*#/, '');
		set_marker_position($j(this).parent('.slider .buttons'), idx);
		var fragment_width = $j(this).parent('.slider .buttons').next().children('div:eq(0)').children('div:eq(0)').width();
		$j(this).parent('.slider .buttons').next().children('div:eq(0)').animate({
			'left': parseInt(idx * -fragment_width) + 'px'
		}, 1300);
		return false;
	});
})
