function addmap()
{
	var table = document.getElementById('maps');
	var rows = table.rows.length;
	var inkrement = rows;
	var row = table.insertRow(rows);
	// cislo mapy
	var cell0 = row.insertCell(0);
	var text = document.createTextNode(inkrement + '. mapa:');
	cell0.appendChild(text);
	// jmeno mapy
	var cell1 = row.insertCell(1);
	var ele1 = document.createElement('input');
		ele1.setAttribute('name', 'map' + inkrement);
		ele1.setAttribute('size', '20');
	cell1.appendChild(ele1);
	// skore domaci
	var cell2 = row.insertCell(2);
	var ele2 = document.createElement('input');
		ele2.setAttribute('name', 'scorehome' + inkrement);
		ele2.setAttribute('size', '10');
	cell2.appendChild(ele2);
	// skore protivnik
	var cell3 = row.insertCell(3);
	var ele3 = document.createElement('input');
		ele3.setAttribute('name', 'scoreopponent' + inkrement);
		ele3.setAttribute('size', '10');
	cell3.appendChild(ele3);
}

function removemap()
{
  var table = document.getElementById('maps');
  var rows = table.rows.length;
  if (rows != 2) table.deleteRow(rows - 1);
}

// test js, uzivatelsky zadavana pole

function js_test()
{
	document.getElementById('js_test').value = '1';
}

// admin - settings

function updatehelp(e)
{
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (help != null)
	{
		help.style.left = (x + 20) + "px";
		help.style.top  = (y + 20) + "px";
	}
}

function showhelp(id)
{
	help = document.getElementById(id);
	help.style.display = "block"
}

function hidehelp()
{
	help.style.display = "none";
}

function process_request_captcha()
{
	if (httpRequest.readyState == 4)
	{
		if(httpRequest.status == 200)
		{
			document.getElementById('last_ref_content').innerHTML = httpRequest.responseText;
		}
	}
}
		
function reload_captcha()
{
	if (window.ActiveXObject) httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	else httpRequest = new XMLHttpRequest();
	
	httpRequest.open("GET", 'func/captcha_reload.php?inc=1', true);
	httpRequest.onreadystatechange = function () {process_request_captcha();};
	httpRequest.send(null);
}

function gallery_views(pid)
{
	if (window.ActiveXObject) httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	else httpRequest = new XMLHttpRequest();
	
	httpRequest.open("GET", 'func/gallery_views.php?pid='+pid, true);
	httpRequest.send(null);
}

function awards_show(aid)
{
	var box = document.getElementById('award_'+aid);
	
	if ( box.style.display == 'none' ) box.style.display = 'block';
	else box.style.display = 'none';
}

var last_section = 0;

function process_match_filter(section)
{
	if (httpRequest.readyState == 4)
		if(httpRequest.status == 200)
		{
			document.getElementById('last_wars_content').innerHTML = httpRequest.responseText;
			document.getElementById('f_'+last_section).className = 'filter_item';
			document.getElementById('f_'+section).className = 'filter_item_active';
			last_section = section;
		}
}

function match_filter(section)
{
	if (window.ActiveXObject) httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	else httpRequest = new XMLHttpRequest();
	
	httpRequest.open("GET", 'func/match_filter.php?tid='+section, true);
	httpRequest.onreadystatechange = function () {process_match_filter(section);};
	httpRequest.send(null);
}


