version = navigator.appVersion.toLowerCase();
agent = navigator.userAgent.toLowerCase();
ie = (version.indexOf('msie')>-1);
win = (version.indexOf('windows')>-1);
opera = (agent.indexOf('opera')>-1);
ie50 = (version.indexOf('msie 5.0')>-1);

function my_popup(cesta, titulek, sirka, vyska) {
window.open(cesta, titulek, 'width=' + sirka +',height=' + vyska + ',left=100,top=100');
}
function prn(string) {
document.write(' \&\#8226\; \074a href=\"javascript:goprn();\"\076' + string + '\074/a\076');
}
function goprn() {
window.print();
}
function fav(string) {
if ((opera) && (win)) return false;
else if ((ie) && (win)) document.write(' \&\#8226\; \074a href=\"javascript:gofav();\"\076' + string + '\074/a\076');
}
function gofav() {
window.external.addFavorite('http://www.farnost-vlachovo-brezi.cz','Farnost Vlachovo Březí');
}

function insertAtCursor(myField, myValue) {
	myField = document.getElementById(myField);
	if (document.selection) {
		var temp;
		myField.focus();
		sel = document.selection.createRange();
		temp = sel.text.length;
		sel.text = myValue;
		if (myValue.length == 0) {
			sel.moveStart('character', myValue.length);
			sel.moveEnd('character', myValue.length);
		} else {
			sel.moveStart('character', -myValue.length + temp);
		}
		sel.select();
	}
	else if (myField.selectionStart || myField.selectionStart == '0') {
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
		myField.selectionStart = startPos + myValue.length;
		myField.selectionEnd = startPos + myValue.length;
	} else {
		myField.value += myValue;
	}
}
