function wo_napoveda(pAdresa) {
	window.open(pAdresa).focus();
}

function otevriOkno(lURL, x, y) {
	var okno = window.open(lURL,'_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+ x +', height='+ y);
	okno.focus();
}

function rozbalit(pObject, pRozbalit, pZabalit) {
	var loTabulka = document.getElementById("polozka"+ pObject);
	var loRidici = document.getElementById("ridici"+ pObject);
//	alert(loTabulka);
	if (loTabulka.style.display != "block" && loTabulka.style.display != 'table-row') {
		try {	// hack na MSIE
			loTabulka.style.display = "table-row";
		} catch(e) {
			loTabulka.style.display = "block";
		}
		//loRidici.innerHTML = "skrýt obsah &laquo;";
		loRidici.src = pRozbalit;
	} else {
		loTabulka.style.display = "none";
//		loRidici.innerHTML = "zobrazit obsah &raquo;";
		loRidici.src = pZabalit;
	}
}

function rozbalitDiv(pObject) {
	var loTabulka = document.getElementById(pObject);
	if (loTabulka.style.display != "block") {
		loTabulka.style.display = "block";
	} else {
		loTabulka.style.display = "none";
	}
}

function pracuji() {
	var x = screen.availWidth;
	var y = screen.availHeight;
	var w = document.getElementById("working");
	if (w != null)
	{
		w.style.display = "block";
		w.style.left = ((x-200)/2);
		w.style.top = ((y-250)/2);
	}
	
	var sbm = document.getElementById("IDSubmit");
	if (sbm != null)
	{
//		alert(sbm.disabled);
		sbm.disabled = true;
	}

}


//zakaze vkladani a kopirovani pomoci klavesovych zkratek a klavesy pro kontextove menu
function zakazatKopirovaniAVkladani(pEvent, pID) {
	var zakazaneKlavesyCtrl = new Array("c", "v"); //zakaz ctr+c a ctr+v
	var zakazaneKlavesyShift = new Array("45"); //zakaz shift+ins
	var stisknutaKlavesa;
	var jeCtrl, jeShift;

	if(window.event) {
		stisknutaKlavesa = window.event.keyCode;     //IE
		if (!window.event.altKey) {
			(window.event.ctrlKey ? jeCtrl = true : jeCtrl = false);
			(window.event.shiftKey ? jeShift = true : jeShift = false);
		}
	} else {
		stisknutaKlavesa = pEvent.which;     //firefox
		if (!pEvent.altKey) {
			(pEvent.ctrlKey ? jeCtrl = true : jeCtrl = false);
			(pEvent.shiftKey ? jeShift = true : jeShift = false);
		}
	}

	if (jeCtrl) {
		for(i=0; i<zakazaneKlavesyCtrl.length; i++) { //case-insensitive comparation
			if(zakazaneKlavesyCtrl[i].toLowerCase() == String.fromCharCode(stisknutaKlavesa).toLowerCase()) return false;
		}
	}

	if (jeShift) {
		for(i=0; i<zakazaneKlavesyShift.length; i++) {
			if(zakazaneKlavesyShift[i] == String(stisknutaKlavesa)) return false;
		}
	}

	//zakaz klavesy pro spusteni kontextoveho menu
	if (stisknutaKlavesa == 93) document.getElementById(pID).oncontextmenu=new Function("return false;");
	return true;
}

//pretypuje funkci na otevreni kontextoveho menu po kliknuti pravym tlacitkem na prvek pID
function zakazatKliknutiPravym(pEvent, pID) {
	if (window.event) {
		if (window.event.button == 2) {
			document.getElementById(pID).oncontextmenu=new Function("return false");
			return false;
		}
	} else {
		if (pEvent.which == 3 || pEvent.which == 2) {
			document.getElementById(pID).oncontextmenu=new Function("return false");
			return false;
		}
	}
}

//pripocitava zadanou hodnotu k hodnote v textovem poli - vse jen ciselne, hlida minimalni hodnotu
function addValueInt(pTextBox, pValue, pMinHodnota) {
	if(isNaN(parseInt(pTextBox.value))) {
		pTextBox.value = pMinHodnota;
		return;
	}

	if ((parseInt(pTextBox.value) + pValue) < pMinHodnota) {
		pTextBox.value = pMinHodnota;
	} else {
		pTextBox.value = parseInt(pTextBox.value) + pValue;
	}

	return;
}

function zmenitDisplay(pID, pVisible) {
	pObj = document.getElementById(pID);
	if (pObj && pObj.style) pObj.style.display = (pVisible ? "block" : "none");
}

window.onerror = function (message, url, line) {
	if (top.frames && top.refresh && top.refresh.document) {
		var lFrm = top.refresh.document.getElementById('frmErrorDetect');
		var lInfo = top.refresh.document.getElementById('hidErrInfo');
		var lURL = top.refresh.document.getElementById('hidURL');
		if (lFrm != null && lInfo != null) {
			lInfo.value = 'Zpráva:' + message + '\nurl: ' + url + '\nřádek:' + line;

			if (this.getDebugInfo) {
				lInfo.value += '\n' + this.getDebugInfo();
			}
			if (lURL) {
				lURL.value = url;
			}
			lFrm.submit();
		}
	}
	return false;
}

