function show_comments (id, offset) {
	$.post("ajax.php", {fid: id, offset: offset, show: 'show_comments'},
	function (data) {
		//alert (data);
		document.getElementById('show_ajax').innerHTML = data;
	},
	"html");
}

function show_add_comment (id) {
	$.post("ajax.php", {fid: id, show: 'show_add_comment'},
	function (data) {
		//alert (data);
		document.getElementById('show_ajax').innerHTML = data;
	},
	"html");
}

function add_comment (fid) {
	$.post("ajax.php", {fid: $('[name="fid"]').val(), avtor: $('[name="avtor"]').val(), mail: $('[name="mail"]').val(), comment: $('[name="comment"]').val(), anti: $('[name="anti"]').val(), show: 'add_comment'},
	function (data) {
		if (data != '') window.alert(data);
		else show_comments(fid, 0);
	},
	"html");
	
	show_comments_menu(fid);
}

function show_comments_menu(id) {
	$.post("ajax.php", {fid: id, show: 'show_comments_menu'},
	function (data) {
		document.getElementById('comments_menu').innerHTML = data;
	},
	"html");
}

function show_pic (id) {
	$.post("ajax.php", {id: id, show: 'show_pic'},
	function (data) {
		//alert (data);
		document.getElementById('sport_pic').innerHTML = data;
	},
	"html");
}

function show_index_pic(id, cat_id) {
	$.post("ajax.php", {id: id, show: 'show_index_pic'},
	function (data) {
		document.getElementById('index_pics_'+cat_id).innerHTML = data;
	},
	"html");
}

function vote () {
	$.post("ajax.php", {answer1: $('[name="answer"]:checked').val(), show: 'vote'},
	function (data) {
		show_vote_results();
	},
	"html");
	
	//show_vote_results(fid);
}

function show_vote_results(id) {
	$.post("ajax.php", {show: 'show_vote_results'},
	function (data) {
		document.getElementById('vote_results').innerHTML = data;
	},
	"html");
}


function show_top_sport(id) {
	var a;
	clearTimeout();
	$.post("ajax.php", {show: 'show_top_news', id: id},
	function (data) {
		//alert (next_id);
		document.getElementById('top_news').innerHTML = data;
	},
	"html");
	var next_id = id + 1;
	if (next_id > 5) next_id = 1;
	setTimeout("show_top_sport("+next_id+")", 16000);
}