$(function() {
	var $tabs = $('#tabs').tabs();
	$(".ui-tabs-panel").each(function(i){
		var totalSize = $(".ui-tabs-panel").size() - 1;
		if (i != totalSize) {
			next = i + 1;
			$(this).append("<a href='#' id='next' class='next-tab0 mover0' rel='" + next + "'>Next Page &#187;</a>");
		}
		if (i != 0) {
			prev = i - 1;
			$(this).append("<a href='#' id='prev' class='prev-tab0 mover0' rel='" + prev + "'>&#171; Prev Page</a>");
		}
	});

	$('.next-tab0, .prev-tab0').click(function() {
		var temp = $(this).attr("rel") * 1;
		$tabs.tabs('select', temp);
		window.scrollTo(0,0);
		return false;
	});

	$('.next-tab').click(function() {
		var temp = $(this).attr("rel") * 1;
		$tabs.tabs('select', temp);
		window.scrollTo(0,0);
		return false;
	});

	var $tabs1 = $('#tabs1').tabs();
	$(".ui-tabs-panel1").each(function(i){
		var totalSize2 = $(".ui-tabs-panel1").size() - 1;
		if (i != totalSize2) {
			next = i + 1;
			$(this).append("<a href='#' id='next' class='next-tab1 mover1' rel='" + next + "'>Next Page &#187;</a>");
		}
		if (i != 0) {
			prev = i - 1;
			$(this).append("<a href='#' id='prev' class='prev-tab1 mover1' rel='" + prev + "'>&#171; Prev Page</a>");
		}
	});

	$('.next-tab1, .prev-tab1').click(function() {
		var temp2 = $(this).attr("rel") * 1;
		$tabs1.tabs('select', temp2);
		return false;
	});
});
