$(document).ready(function(){
	$(".left_match_arr > a").click(function(){
		$.ajax({
			type: "POST",
			url: "/js/ajax.php",
			cache: false,
			data: "ACTION=PREV&PREV=" + prev,
			success: function(html){
				var tmp = new Array();
				tmp =  html.split("{}");
				prev = tmp[0];
				$("#prevBlock").html(tmp[1]);
				count_left++;
				if (count_left > 0)
					$(".right_match_arr_left > a").css('visibility', 'visible');
	   		}
 		});
	});
	$(".right_match_arr_left > a").click(function(){
		$.ajax({
			type: "POST",
			url: "/js/ajax.php",
			cache: false,
			data: "ACTION=PREV_NEXT&PREV=" + prev,
			success: function(html){
				var tmp = new Array();
				tmp =  html.split("{}");
				prev = tmp[0];
				$("#prevBlock").html(tmp[1]);
				count_left--;
				if (count_left == 0)
					$(".right_match_arr_left > a").css('visibility', 'hidden');
	   		}
 		});
	});
	$(".right_match_arr > a").click(function(){
		$.ajax({
			type: "POST",
			url: "/js/ajax.php",
			cache: false,
			data: "ACTION=NEXT&NEXT=" + next,
			success: function(html){
				var tmp = new Array();
				tmp =  html.split("{}");
				next = tmp[0];
				$("#nextBlock").html(tmp[1]);
				count_right++;
				if (count_right > 0)
					$(".left_match_arr_right > a").css('visibility', 'visible');
			}
 		});
	});
	$(".left_match_arr_right > a").click(function(){
		$.ajax({
			type: "POST",
			url: "/js/ajax.php",
			cache: false,
			data: "ACTION=NEXT_PREV&NEXT=" + next,
			success: function(html){
				var tmp = new Array();
				tmp =  html.split("{}");
				next = tmp[0];
				$("#nextBlock").html(tmp[1]);
				count_right--;
				if (count_right == 0)
					$(".left_match_arr_right > a").css('visibility', 'hidden');
			}
 		});
	});
});
