function zobrazSkryj(idecko){
el=document.getElementById(idecko).style;
el.display=(el.display == 'none')?'block':'none';
}

function skryj(idecko){
el=document.getElementById(idecko).style;
el.display=(el.display == 'none')?'none':'none';
}

function zobraz(idecko){
el=document.getElementById(idecko).style;
el.display=(el.display == 'none')?'block':'block';
}

function zobrazlogin(idecko){
el=document.getElementById(idecko).style;
el.display=(el.display == 'none')?'inline':'inline';
}

var ciselna_rada = '0123456789';

function isValid(parm,val)
{
	if (parm == "") return true;
	for (i=0; i<parm.length; i++)
	{
		if (val.indexOf(parm.charAt(i),0) == -1) return false;
	}
	return true;
}

function isNum(parm)
{
	return isValid(parm,ciselna_rada);
}

function input_ini(id)
{
	if(isNum(document.getElementById(id).value)==1)
	{
		if(document.getElementById(id).value>80)
		{ document.getElementById(id).value=80; }
		if(document.getElementById(id).value<10)
		{ document.getElementById(id).value=10; }
		return false;
	}
	else
	{
		document.getElementById(id).value = 0;
		return false;
	}
}

function input_up(id)
{
	input_ini(id);
	if(document.getElementById(id).value<80){
	document.getElementById(id).value++; }
	return false;
}

function input_down(id)
{
	input_ini(id);
	if(document.getElementById(id).value>10){
	document.getElementById(id).value--; }
	return false;
}

function input_up_b(id)
{
	input_ini(id);
	if(document.getElementById(id).value<80){
	for(i=0;i<10;i++)
	{
		document.getElementById(id).value++;
	} }
	return false;
}

function input_down_b(id)
{
	input_ini(id);
	if(document.getElementById(id).value>19){
	for(i=0;i<10;i++)
	{
		document.getElementById(id).value--;
	} }
	return false;
}

/**
* marks all rows and selects its first checkbox inside the given element
* the given element is usaly a table or a div containing the table or tables
*
* @param    container    DOM element
*/
var marked_row = new Array;

function markAllRows(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('cite');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			if ( checkbox.disabled == false ) {
				checkbox.checked = true;
				if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
					rows[i].className += ' marked';
					marked_row[unique_id] = true;
				}
			}
		}
	}

	return true;
}


function unMarkAllRows(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('cite');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			checkbox.checked = false;
			rows[i].className = rows[i].className.replace(' marked', '');
			marked_row[unique_id] = false;
		}
	}

	return true;
}




















/**
* marks all rows and selects its first checkbox inside the given element
* the given element is usaly a table or a div containing the table or tables
*
* @param    container    DOM element
*/
var marked_row = new Array;

function markAllRowsen(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('en');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			if ( checkbox.disabled == false ) {
				checkbox.checked = true;
				if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
					rows[i].className += ' marked';
					marked_row[unique_id] = true;
				}
			}
		}
	}

	return true;
}


function unMarkAllRowsen(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('en');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			checkbox.checked = false;
			rows[i].className = rows[i].className.replace(' marked', '');
			marked_row[unique_id] = false;
		}
	}

	return true;
}







/**
* marks all rows and selects its first checkbox inside the given element
* the given element is usaly a table or a div containing the table or tables
*
* @param    container    DOM element
*/
var marked_row = new Array;

function markAllRowscz(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('cz');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			if ( checkbox.disabled == false ) {
				checkbox.checked = true;
				if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
					rows[i].className += ' marked';
					marked_row[unique_id] = true;
				}
			}
		}
	}

	return true;
}


function unMarkAllRowscz(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('cz');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			checkbox.checked = false;
			rows[i].className = rows[i].className.replace(' marked', '');
			marked_row[unique_id] = false;
		}
	}

	return true;
}







/**
* marks all rows and selects its first checkbox inside the given element
* the given element is usaly a table or a div containing the table or tables
*
* @param    container    DOM element
*/
var marked_row = new Array;

function markAllRowssk(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('sk');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			if ( checkbox.disabled == false ) {
				checkbox.checked = true;
				if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
					rows[i].className += ' marked';
					marked_row[unique_id] = true;
				}
			}
		}
	}

	return true;
}


function unMarkAllRowssk(rubrika) {
	var rows = document.getElementById(rubrika).getElementsByTagName('sk');
	var unique_id;
	var checkbox;

	for ( var i = 0; i < rows.length; i++ ) {

		checkbox = rows[i].getElementsByTagName( 'input' )[0];

		if ( checkbox && checkbox.type == 'checkbox' ) {
			unique_id = checkbox.name + checkbox.value;
			checkbox.checked = false;
			rows[i].className = rows[i].className.replace(' marked', '');
			marked_row[unique_id] = false;
		}
	}

	return true;
}


function ajax(url,metoda,id,vrat,loading,text)
	{
		var httpRequest;
		if (window.XMLHttpRequest) { httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {} } }
		if (!httpRequest) { alert('Chyba, nemohu vytvořit spojení.'); return false; }
		httpRequest.onreadystatechange = function() { ajaxVysledek(httpRequest,id,vrat,loading); };
		httpRequest.open(metoda, url, true);
		if (metoda=='POST' || metoda=='post') { httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); if(text!='') { url=url.replace("zmena.php?", ""); httpRequest.send(url+'&text='+text); } else {url=url.replace("zmena.php?", ""); httpRequest.send(url);} } else { httpRequest.send(''); }
		// alert('URL: '+url);
		// alert('Posílaný text: '+text);
	}
function ajaxVysledek(httpRequest,id,vrat,loading)
	{
		if (httpRequest.readyState == 1 || httpRequest.readyState == 2 || httpRequest.readyState == 3) {
			if(id!='' && loading!='')
			{
				document.getElementById(id).src = '<strong>'+loading+'</strong>';
			}
		}
		if (httpRequest.readyState == 4) {
			if (httpRequest.status == 200) {
				// httpRequest.responseText;
				if(id!='' && vrat!='')
				{
					if(vrat!=1)
					{
						// alert('Vrácený text skriptem: '+vrat);
						document.getElementById(id).src = ajaxNahradZnaky(vrat);
					}
					else {
						// alert('Vrácený (posílaný) text: '+httpRequest.responseText);
						document.getElementById(id).src = ajaxNahradZnaky(httpRequest.responseText);
					}
					document.getElementById(id).style.cursor='auto';
				}
			} else {
				alert('['+httpRequest.status+'] Chyba serveru - zkuste to, prosím, později.');
				if(vrat==1){
					document.getElementById(id).src = '';
				}
			}
		}
	}

	function ajax_pozadi(url,metoda)
	{
		var httpRequest;
		if (window.XMLHttpRequest) { httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {} } }
		if (!httpRequest) { alert('Chyba, nemohu vytvořit spojení.'); return false; }
		httpRequest.onreadystatechange = function() { return false; };
		httpRequest.open(metoda, url, true);
		if (metoda=='POST' || metoda=='post') { httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); url=url.replace("zmena.php?", ""); httpRequest.send(url); } else { httpRequest.send(''); }
		// alert('URL: '+url);
		// alert('Posílaný text: '+text);
	}

	function ajaxNahradZnaky(str)
	{
		str=str.replace(/\\'/g,'\'');
		str=str.replace(/\\"/g,'"');
		str=str.replace(/\\\\/g,'\\');
		str=str.replace(/\\0/g,'\0');
		return str;
	}
