var url = '/';
var goall = 'pl/';
function rand(n) {
	return (Math.floor(Math.random() * n + 1));
}
/* ajax galleries */
var currentPage = 0;
function showchat(divid) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/gal.php?report=' + currentPage,
		async : false,
		success : function(xml) {
			$('#ajax_gal_' + divid + '').empty();
			$('#subtitle_gal_' + divid + '').empty();

			$("response", xml).each(
					function(id) {
						response = $("response", xml).get(id);
						$('#subtitle_gal_' + divid + '').prepend(
								'<a href="/' + $("href", response).text()
										+ '">' + $("title", response).text()
										+ '</a>');
						page = $("page", response).text();
						if (page > 9)
							$('#nextbutton_' + divid + '').hide();
						else
							$('#nextbutton_' + divid + '').show();
						if (page < 1)
							$('#prevbutton_' + divid + '').hide();
						else
							$('#prevbutton_' + divid + '').show();
					});
			$('#ajax_gal_' + divid + '').addClass('ajax_gal');
			$("message", xml).each(
					function(id) {
						message = $("message", xml).get(id);
						$('#ajax_gal_' + divid + '').prepend(
								'<a href="/' + $("href", response).text()
										+ '/?img=' + $("img", message).text()
										+ '"><img src="/p/gallery/'
										+ $("text", message).text()
										+ '/8"></a>');
					});

		}
	});
}

function changepage(p, divid) {

	currentPage += p;
	showchat(divid);
}

/* ajax cup */
function showcup(p) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/cup.php?cup_id=' + p,
		async : false,
		success : function(xml) {
			showcup1(xml);
		}
	});
}
function showcup1(xml) {
	$("#ajax_cup").empty();
	$("#subtitle_cup").empty();

	$("response", xml).each(
			function(id) {
				response = $("response", xml).get(id);
				$("#subtitle_cup").append(
						'<a href="/' + $("href", response).text() + 'cups/'
								+ $("id_game", response).text() + '">'
								+ $("title", response).text() + '</a>');

			});

	$("message", xml)
			.each(
					function(id) {
						message = $("message", xml).get(id);
						$("#ajax_cup")
								.append(
										'<li><a href="/'
												+ $("href", response).text()
												+ 'cup/'
												+ $("id", message).text()
												+ '"><img src="'
												+ url
												+ 'game/'
												+ $("img", message).text()
												+ '" alt="game" class="icons_game" /> <img src="'
												+ url
												+ 'flags/'
												+ $("country", message).text()
												+ '.gif" alt="flags" class="flags" /> '
												+ $("text", message).text()
												+ ' - '
												+ $("date", message).text()
												+ ' - '
												+ $("slot", message).text()
												+ '</a></li>');
					});
}

function changegameajax(p) {
	showcup(p);
}

/* ajax match */

var selectgame = 0;
var dateshowboxmatch = 0;
var currentpagem = 0;
function showmatch(currentpagem) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/match.php?match_id=' + selectgame
				+ '&date_show=' + dateshowboxmatch,
		async : false,
		success : function(xml) {
			$("#ajax_match").empty();
			$("#subtitle_match").empty();
			showmatchall(xml);
			$("#subtitle_match").prepend(
					'<a href="/' + $("href", response).text() + 'bets/'
							+ $("id_game", response).text() + '">'
							+ $("title", response).text() + '</a>');
			showmatch2(xml);
		}
	});

}
function showmatchd(p) {
	currentpagem = 0;
	dateshowboxmatch = p;
	$('#mytoolbar a').removeClass('selected_box_match');
	$('#choosematch_' + p + '').addClass('selected_box_match');
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/match.php?match_id=' + selectgame
				+ '&date_show=' + dateshowboxmatch,
		async : false,
		success : function(xml) {
			$("#ajax_match").empty();
			$("#subtitle_match").empty();
			showmatchall(xml);
			$("#subtitle_match").prepend(
					'<a href="/' + $("href", response).text() + 'bets/'
							+ $("id_game", response).text() + '">'
							+ $("title", response).text() + '</a>');
			showmatch2(xml);
		}
	});

}
function showmatchall(xml) {
	response = $("response", xml);
	total = $("total", response).text();
	if (currentpagem >= total)
		$("#nextbuttonm").hide();
	else
		$("#nextbuttonm").show();
	if (currentpagem < 1)
		$("#prevbuttonm").hide();
	else
		$("#prevbuttonm").show();
}

function showmatch2(xml) {

	$("message", xml)
			.each(
					function(id) {
						message = $("message", xml).get(id);
						$("#ajax_match")
								.append(
										'<a href="/'
												+ $("href", response).text()
												+ 'match_bet/'
												+ $("id", message).text()
												+ '"><div class="list_obstaw"><p class="name_bet"><img src="'
												+ url
												+ 'game/'
												+ $("img", message).text()
												+ '" alt="game" class="icons_game" /> '
												+ $("league", message).text()
												+ '</p><div class="obstaw_team"><p><img src="/flags/'
												+ $("team_1c", message).text()
												+ '.gif" alt="'
												+ $("team_1", message).text()
												+ '" class="flags" /> '
												+ $("team_1", message).text()
												+ '</p><p><img src="/flags/'
												+ $("team_2c", message).text()
												+ '.gif" alt="'
												+ $("team_1", message).text()
												+ '" class="flags" /> '
												+ $("team_2", message).text()
												+ '</p></div><p class="obstaw_status">Status: <strong class="'
												+ $("color_status", message)
														.text() + '">'
												+ $("status", message).text()
												+ '</strong> / '
												+ $("time", message).text()
												+ '</p></div></a>');
					});

}

function changegameajax_m(p) {
	selectgame = p;
	currentpagem = 0;
	showmatch();
}
function changepageajax_m(p) {
	currentpagem += p;
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/match.php?match_id=' + selectgame
				+ '&date_show=' + dateshowboxmatch + '&match_page='
				+ currentpagem,
		async : false,
		success : function(xml) {
			$("#ajax_match").empty();
			showmatchall(xml);
			showmatch2(xml);
		}
	});
}

/* ajax bet */
function showbet(action, p) {
	$("#bet_ajax").load(
			'' + url + 'ajax/bet.php?obstaw=' + p + '&action=' + action);

}

function addbet(p, action) {
	showbet(action, p);
}
function delbet(p, action) {

	showbet(action, p);
}

function addbet1(p) {

	$('#bet_ajax').load(
			'' + url + 'ajax/bet.php?obstaw=' + p + '&howmoney='
					+ $('#moneyh').attr('value'));
	$('#bet_ajax').show();

}

function switch_adminbet(p) {

	$("#butttons_team1").each(
			function() {
				this.onclick = function() {
					MM_openBrWindow('/bet/bet.php?ms=' + p + '&whoteam=1',
							'Upload', 'scrollbars=yes,width=800,height=600');
				};
			});
	$("#butttons_team2").each(
			function() {
				this.onclick = function() {
					MM_openBrWindow('/bet/bet.php?ms=' + p + '&whoteam=2',
							'Upload', 'scrollbars=yes,width=800,height=600');
				};
			});

}

function topnews(whatadvice) {
	$("#loader").ajaxStart(function() {
		$(this).show();
	});
	$("#topnews_galleries .box_stories_a").attr("class", "box_stories_a");
	$("#top" + whatadvice + "").attr("class", "box_stories_a selected");

	$("#topnews_ajax").empty();
	$('#topnews_ajax').load('' + url + 'ajax/topnews.php?what=' + whatadvice);
	$("#loader").ajaxStop(function() {
		$(this).hide();
	});

}

function addtag() {
	$
			.ajax( {
				type : "GET",
				url : '' + url + 'ajax/addtag.php',
				data : "tag=" + $('#tagadd').val() + "&tagall="
						+ $('#tag_all').val() + "",
				success : function(xml) {
					response = $("response", xml);
					$("#tag_all").attr("value", $("tagall", response).text());
					var licz;
					$("message", xml)
							.each(
									function(id) {
										licz = rand(10000);
										message = $("message", xml).get(id);
										if ($("tag", message).text()) {
											var new_label = $("<label>");
											new_label.attr("id", licz);
											var new_link = $('<span>');
											new_link.attr("class", "admintag");
											new_link
													.html("<a href=\"javascript:;\" onclick=\"deltag('"
															+ licz
															+ "','"
															+ $("tag", message)
																	.text()
															+ "')\">(X)</a>"
															+ $("tag", message)
																	.text()
															+ "");

											new_label.append(new_link);
											$("#tagall").append(new_label);
											$("#tagadd").attr("value", "");

										}
									});

					return false;

				}
			});
}
function deltag(p, tag) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/deltag.php',
		data : "tag=" + tag + "&tagall=" + $('#tag_all').val() + "",
		success : function(xml) {
			response = $("response", xml);
			$("#tag_all").attr("value", $("tagall", response).text());
		}
	});

	$("#" + p + "").remove();
	$("#" + p + "").empty();
}

function opinion(page, id, option) {
	$.ajax( {
		type : "GET",
		url : '/ajax/opinion.php',
		data : "action=" + page + "&opinion=" + option + "&zmienn=" + id,
		success : function(xml) {
			response = $("response", xml);
			$(
					"#opinionlang_" + $("showlang", response).text() + "_" + id
							+ "_" + page + "").show();
			if ($("countvote", response).text()) {
				$("#donevote_" + id + "_" + page + "").show();
				$("#donevote_" + id + "_" + page + "").append(
						$("countvote", response).text());
			}
		}
	});
	$("#opinionajax_" + id + "_" + page + "").remove();

}

function votepoll(idpoll) {
	if ($("form[@name=pollget_" + idpoll + "] input[@name='poll']:checked")
			.val() > 0
			&& $(
					"form[@name=pollget_" + idpoll
							+ "] input[@name='poll']:checked").val() < 11) {

		$('#show_pollr_' + idpoll + '').load(
				'/ajax/polls.php?idpoll='
						+ idpoll
						+ '&show_result=2&vote='
						+ $(
								"form[@name=pollget_" + idpoll
										+ "] input[@name='poll']:checked")
								.val());
		$('#showresult_' + idpoll + '').hide();
		$('#show_pollv_' + idpoll + '').hide();
		$('#show_pollr_' + idpoll + '').show();

	}
}
function poll_result(idpoll, show) {
	if (show == 1) {
		$('#showresult_' + idpoll + '').show();
		$('#showvote_' + idpoll + '').hide();
		$('#show_pollv_' + idpoll + '').show();
		$('#show_pollr_' + idpoll + '').hide();

	} else {
		$('#showvote_' + idpoll + '').show();
		$('#showresult_' + idpoll + '').hide();
		$('#show_pollv_' + idpoll + '').hide();
		$('#show_pollr_' + idpoll + '').show();
		$('#show_pollr_' + idpoll + '').load(
				'/ajax/polls.php?idpoll=' + idpoll + '&show_result=' + show);

	}
}

function replay_post(p) {
	$('#post_replay').attr("value", '' + p + '');

}
function show_region() {
	if ($("#change_country option:selected").val() == 'pl') {
		$("#option_region").show();
		$("#shownoplco").hide();
	} else {
		$('#option_region').attr("value", '');
		$("#option_region").hide();
		$("#shownoplco").show();
	}

}

function change_order(p) {
	if (p == 0) {
		$("#order_2_1").hide();
		$("#order_2_2").show();
		if ($("#time_order1").val() == 1)
			$('#price_order').attr("value", '3.00');
		else
			$('#price_order').attr("value", '7.50');
	} else if (p == 1) {
		$("#order_2_1").show();
		$("#order_2_2").hide();
		if ($("#time_order1").val() == 1)
			$('#price_order').attr("value", '4.00');
		else
			$('#price_order').attr("value", '9.00');
	}
}
function change_order_1(p, v) {
	if ($("#change_order1").val() == 1) {
		if (p == 0) {
			$('#price_order').attr("value", '3.00');
		} else if (p == 1) {
			$('#price_order').attr("value", '7.50');
		} else {
			$('#price_order').attr("value", '3.00');
		}
	} else if ($("#change_order1").val() == 2) {
		if (p == 0) {
			$('#price_order').attr("value", '4.00');
		} else if (p == 1) {
			$('#price_order').attr("value", '9.00');
		} else {
			$('#price_order').attr("value", '4.00');
		}
	}
}
function change_order_server(p, v) {
	if (v == 1) {
		p1 = $("#slot_server").val();
		if (p == 0) {
			if (p1 <= 3)
				mon = 1.50;
			else if (p1 <= 6)
				mon = 2;
			else if (p1 <= 11)
				mon = 3;
			else if (p1 <= 16)
				mon = 4;
		} else
			mon = p1 * 5;

	} else if (v == 2) {
		p = p + 1;
		if ($("#long_server").val() == 1) {
			if (p <= 3)
				mon = 1.50;
			else if (p <= 6)
				mon = 2;
			else if (p <= 11)
				mon = 3;
			else if (p <= 16)
				mon = 4;
		} else
			mon = p * 5;
	}
	$('#price_order').attr("value", mon);
	check_money(mon);
}
function check_money(mon) {
	if (mon > $("#my_money").text())
		$("#no_money").show();
	else
		$("#no_money").hide();

}
function show_scoreboard(p) {

	$('#scoreboard').load('/ajax/scoreboard.php?action=' + p);

}
function change_scorebot(id_map, p, what) {
	$('#scores_' + id_map + '_' + p + '').load(
			'/ajax/scoreboard.php?id_map=' + id_map + '&what=' + p + '&what1='
					+ what);

}
function change_month(m, y, go, id) {
	$('#calendar_month span').hide();
	if (go == 0) {
		if (m == 1) {
			m = 12;
			y--;
		} else {
			m--;
		}
		$('#month_' + m + '').show();

	} else if (go == 1) {
		if (m == 12) {
			m = 1;
			y++;
		} else {
			m++;
		}
		$('#month_' + m + '').show();

	}

	$('#year_s').show();
	$('#year_s1').remove();
	$('#year_s').html(y);

	$('#calendar_prev').each(function() {
		this.onclick = function() {
			change_month(m, y, 0, id);
		};
	});

	$('#calendar_next').each(function() {
		this.onclick = function() {
			change_month(m, y, 1, id);
		};
	});

	$('#show_namev').hide();
	$('#show_event').empty();

	$('#show_calendar').load(
			'/ajax/calendar.php?month=' + m + '&year=' + y + '&id=' + id);

}

function show_event(dateeve, id) {

	$('#show_namev').show();
	$('#show_event').load(
			'/ajax/calendar_match.php?date=' + dateeve + '&id=' + id);

}

/* ajax events */
function showevent(p) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/event.php?game_id=' + p,
		async : false,
		success : function(xml) {
			showevent1(xml);
		}
	});
}
function showevent1(xml) {
	$("#subtitle_event1").empty();
	$("#subtitle_event").hide();

	$("response", xml).each(
			function(id) {
				response = $("response", xml).get(id);
				if ($("game_id", response).text() != 0) {
					$("#subtitle_event1").prepend(
							'' + $("game", response).text() + '');
					$("#event_clanch").attr(
							'href',
							'/' + goall + 'clans/search/?gamess='
									+ $("game_id", response).text() + '');
					$("#event_playersh").attr(
							'href',
							'/' + goall + 'players/search/?gamess='
									+ $("game_id", response).text() + '');
					$("#event_betsh").attr(
							'href',
							'/' + goall + 'bets/search/?gamess='
									+ $("game_id", response).text() + '');
				} else {
					$("#subtitle_event").show();
					$("#event_clanch").attr('href', '/' + goall + 'clans');
					$("#event_playersh").attr('href', '/' + goall + 'players');
					$("#event_betsh").attr('href', '/' + goall + 'bets');

				}

			});
}

/* ajax news */

function shownews(p, typ, howpage, tag) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/news.php?game_id=' + p + '&typ=' + typ
				+ '&howpage=' + howpage + '&tag=' + tag,
		async : false,
		success : function(xml) {
			shownews1(xml, typ);
		}
	});
}
function shownews1(xml, typ) {
	if (typ == 1) {
		typ = 'service';
	} else if (typ == 2) {
		typ = 'league';
	} else if (typ == 3) {
		typ = 'art';
	} else if (typ == 4) {
		response = $("response", xml);
		typ = 'tag';
		$("#tag_subtitle").html(
				'<a href="/' + goall + 'news/?tag='
						+ $("tagslug", response).text() + '">'
						+ $("tag", response).text() + '</a>');

	}
	$("#news_" + typ + "").empty();
	liczil = 0;
	$("message", xml)
			.each(
					function(id) {
						message = $("message", xml).get(id);
						if (liczil == 0) {
							$("#news_" + typ + "")
									.append(
											'<a href="/'
													+ goall
													+ 'news/'
													+ $("id", message).text()
													+ '"><img src="'
													+ $("img", message).text()
													+ '/6" alt="image" class="box_img"></a><li class="first"><a href="/'
													+ goall
													+ 'news/'
													+ $("id", message).text()
													+ '">'
													+ $("title", message)
															.text()
													+ '</a></li>');

							liczil = 1;
						} else {
							$("#news_" + typ + "").append(
									'<li><a href="/' + goall + 'news/'
											+ $("id", message).text() + '">'
											+ $("title", message).text()
											+ '</a></li>');
						}
					});
}
function box_show(showname) {
	$("#" + showname + "").toggle();
}

function make_ajax(webgo, dividch, langshow) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/' + webgo,
		async : false
	});
	$("#" + dividch + "").html(langshow);
}

function showleague(p) {
	$("#league_boxc").load('' + url + 'ajax/league.php?id=' + p);
}

function ajax_toggle1(showname, ajaxname) {
	$("#" + showname + "").toggle();
	if (currentPcount == 0) {
		$("#" + showname + "").load('' + url + 'ajax/' + ajaxname + '.php');
	}
	currentPcount = 1;
}

function ajax_toggle(showname, ajaxname, change_ajax) {

	$("#" + change_ajax + "").attr("href",
			'javascript:box_show("' + showname + '");');
	$("#" + showname + "").toggle();
	$("#" + showname + "").load('' + url + 'ajax/' + ajaxname + '.php');
}

function addmedia(p) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/media.php?media=1&match_id=' + p + '&name='
				+ $('#media_name').attr('value') + '&url='
				+ $('#media_url').attr('value'),
		async : false,
		success : function(xml) {
			addmedia1(xml);
		}
	});
	if (status == 1) {
		$('#donemediabad').show();
		$('#donemedia').hide();
	} else {
		$('#donemedia').show();
		$('#donemediabad').hide();
		$('#media_name').attr('value', '');
		$('#media_url').attr('value', '');
	}
}

function reqdemo(p) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/media.php?media=3&match_id=' + p + '&name='
				+ $('#demo_name').attr('value') + '&accmymat='
				+ $('#accmymat').attr('value') + '&demo_user='
				+ $('#demo_user').attr('value'),
		async : false,
		success : function(xml) {
			addmedia1(xml);
		}
	});
	if (status == 1) {
		$('#donereqdemobad').show();
		$('#donereqdemo').hide();
	} else {
		$('#donereqdemo').show();
		$('#donereqdemobad').hide();
		$('#demo_name').attr('value', '');
	}
}
function addazer(p) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/media.php?media=2&match_id=' + p + '&url='
				+ $('#azer_url').attr('value'),
		async : false,
		success : function(xml) {
			addmedia1(xml);
		}
	});
	if (status == 1) {
		$('#doneazerbad').show();
		$('#doneazer').hide();
	} else {
		$('#doneazer').show();
		$('#doneazerbad').hide();
		$('#azer_url').attr('value', '');
	}
}

function adddemo(p) {
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/media.php?media=4&match_id=' + p + '&name='
				+ $('#demo_nameadd').attr('value') + '&url='
				+ $('#demo_url').attr('value'),
		async : false,
		success : function(xml) {
			addmedia1(xml);
		}
	});
	if (status == 1) {
		$('#doneadddemobad').show();
		$('#doneadddemo').hide();
	} else {
		$('#doneadddemo').show();
		$('#doneadddemobad').hide();
		$('#demo_nameadd').attr('value', '');
		$('#demo_url').attr('value', '');
	}
}

function addmedia1(xml) {
	response = $("response", xml);
	status = $("status", response).text();
}

function rate_showstar(number) {
	for ( var i = 0; i <= number; i++) {
		$('#star_' + i + '').addClass('hover').end();
	}
}
function rate_clearstar() {
	$('#tv_rate div').removeClass('hover').end();
}
function rate_setstar(number) {
	$('#tv_rate').remove('');
	$('#rate_done').show('');
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/rate_tv.php?number=' + number + '&id='
				+ $('#tv_id').attr('value'),
		async : false
	});
}

function box_showdel(showname, divname) {
	$("#showevent div").hide();
	$("#showevent div div").show();
	$("#" + divname + "").show();
}
function show_boxstyle(divshow, divhide, idtopmenu, styleclass) {
	$('#' + divhide + ' div').hide();
	$("#" + divshow + "").show();
	$('.' + styleclass + ' li').removeClass('selected');
	$('.basictab li#' + idtopmenu + '').addClass('selected');
}

function tv_showautor(p, langhits) {
	$("#loader").ajaxStart(function() {
		$(this).show();
	});
	$("#tv_autor_toggle").load(
			'' + url + 'ajax/tv_showautor.php?action=' + p + '&langhits='
					+ langhits + '');
	$("#tv_autor_toggle").toggle();
	$("#loader").ajaxStop(function() {
		$(this).hide();
	});
}

function my_matches(p) {
	if (p != 'all') {
		$('#mymatches .h').hide();
		$('#team_' + p + '').show();
	} else {
		$('#mymatches .h').show();
	}
	$('.basictab li').removeClass('selected');
	$('.basictab li#teamtop_' + p + '').addClass('selected');
}

function show_chat(idmatch) {
	$('#chat_show').show();
	$('#show_chat').hide();
	timestamp = 0;
	updateMsg(idmatch);
	$("form#chatform").submit(function() {
		$.post('' + url + 'ajax/backend.php', {
			message : $("#msg").val(),
			action : "postmsg",
			idmatch : idmatch,
			time : timestamp
		}, function(xml) {
			$("#msg").attr('value', '');
			addMessages(xml);
		});
		return false;
	});
}
function addMessages(xml) {
	if ($("status", xml).text() == "2")
		return;
	timestamp = $("time", xml).text();
	$("message", xml).each(
			function(id) {
				message = $("message", xml).get(id);
				$("#messagewindow").append(
						"<b><a href=\"/" + goall + "user/"
								+ $("iduser", message).text() + "\">"
								+ $("author", message).text() + "</a></b>: "
								+ $("text", message).text() + "<br />");
			});
	$("#messagewindow").scrollTop(400);
}
function updateMsg(idmatch) {
	$.post('' + url + 'ajax/backend.php', {
		time : timestamp,
		idmatch : idmatch
	}, function(xml) {
		$("#loading").remove();
		addMessages(xml);
	});
	setTimeout('updateMsg(' + idmatch + ')', 4000);
}

var tmp_hash = document.location.href.split('#');
tmp_hash = (tmp_hash.length) ? tmp_hash[1] : 'wartosc_domyslna';

if (tmp_hash == 'chat') {
	$(document).ready(function() {
		timestamp = 0;
		updateMsg1();
		$("form#chatform").submit(function() {
			$.post('' + url + 'ajax/backend.php', {
				message : $("#msg").val(),
				name : $("#author").val(),
				action : "postmsg",
				time : timestamp,
				idmatch : 1
			}, function(xml) {
				$("#msg").attr('value', '');
				addMessages1(xml);
			});
			return false;
		});
	});
	function addMessages1(xml) {
		if ($("status", xml).text() == "2")
			return;
		timestamp = $("time", xml).text();
		$("message", xml).each(
				function(id) {
					message = $("message", xml).get(id);
					$("#messagewindow").prepend(
							"<b>" + $("author", message).text() + "</b>: "
									+ $("text", message).text() + "<br />");
				});
	}
	function updateMsg1() {
		$.post('' + url + 'ajax/backend.php', {
			time : timestamp,
			idmatch : 1
		}, function(xml) {
			$("#loading").remove();
			addMessages1(xml);
		});
		setTimeout('updateMsg1()', 4000);
	}
}
function box_show_del(box_s, box_d) {
	if (box_s)
		$('#' + box_s + '').show();
	if (box_d)
		$('#' + box_d + '').hide();
}

function change_game(p) {
	$('#change_league select option').remove();
	$.ajax( {
		type : "GET",
		url : '' + url + 'ajax/change_game.php?id=' + p,
		async : false,
		success : function(xml) {
			$("message", xml).each(
					function(id) {
						message = $("message", xml).get(id);
						$('#change_league select').append(
								'<option value="' + $("id", message).text()
										+ '">' + $("name", message).text()
										+ '</option>');

					});

		}
	});

}
function file_show(webgo, dividch) {
	$("#"+dividch+"").load('' + url + ''+webgo+'');
}

