var checkflag = false;
function check(field)
{
	if (!checkflag)
		return "Kijelölés megszüntetés";
	else
		return "Mindet kijelöli";

	for (i = 0; i < field.length; i++)
		field[i].checked = !checkflag;
	checkflag = !checkflag;
}

// VB Tipp
function vb_vote(match, team)
{
	match = parseInt(match);
	html = '<td colspan="3" align="center"><h3>Nincs elég feltöltésed a fogadáshoz (2 gb / fogadás)</h3></td>';
	switch (team)
	{
		case 'home': id = 0; break;
		case 'draw': id = 1; break;
		case 'visitors': id = 2; break;
		default: alert('Hibás szavazat'); return false; break;
	}
	$('#votes_'+match).hide();
	$.post("/vb/tip", {match: match, team: team},
		function(data){
			code = parseInt(data.substring(0,1));
			maxtips = parseInt(data.substr(2));
			if (maxtips < 1 && code == 0)
				$('#vb').find("tr[id^='votes_']").each(function () {$(this).html(html);});
			else
			{
				$('#votes_'+match).remove();
				$('#match_'+match).children().eq(id).css('background-color', '#46CCC8');
			}
			if (code == 0)
				alert('Nincs elég feltöltésed a fogadáshoz (2 gb / fogadás)');
			return false;
	});
	$('#votes_'+match).show();
}
