function ReplaceString(ABuf, AOldStr, ANewStr) {
	var tmp = "";
	if (ABuf == null) return tmp;
	var last_index = -1;
	var idx = ABuf.indexOf(AOldStr);
	while(idx >= 0) {
		var start = (last_index >= 0) ? last_index + AOldStr.length  : 0;
		tmp += ABuf.substring(start, idx) + ANewStr;
		last_index = idx;
		idx = ABuf.indexOf(AOldStr, idx + 1);
	}
	if (last_index >= 0) tmp += ABuf.substring(last_index + AOldStr.length);
	else tmp += ABuf;
	return tmp;
}

function GetTag(AName) {
	var temp = document.getElementsByName(AName);
	var tempID = document.getElementById(AName);
	if (tempID != null) return tempID;
	else if (temp != null && temp.length > 0) return temp[0];
	else return null;
}

function CheckNumber(e) {
	if (!e) e = window.event;
	if (e.charCode != null) return (e.charCode == 0 || /\d{1,1}/.test(String.fromCharCode(e.charCode)));
	else return /\d{1,1}/.test(String.fromCharCode(e.keyCode));
}

function CheckASCII(e) {
	if (!e) e = window.event;
	if (e.charCode != null) return (e.charCode == 0 || e.charCode == 43 || /\w|\-{1,1}/.test(String.fromCharCode(e.charCode)));
	else return /\w|\-{1,1}/.test(String.fromCharCode(e.keyCode));
}

function CheckPhone(e) {
	if (!e) e = window.event;
	if (e.charCode != null) return (e.charCode == 0 || e.charCode == 43 || /\d{1,1}/.test(String.fromCharCode(e.charCode)));
	else return /\d{1,1}/.test(String.fromCharCode(e.keyCode));
}

var kontakty_start = 0;
var kontakty_stop = 300; 

function Kontakty() {
	window.setInterval("VysunutiKontaktu()", 10);
}

function VysunutiKontaktu() {
	if (kontakty_start <= kontakty_stop) {
		GetTag('dKontakty').style.height = kontakty_start + "px";
		kontakty_start += 3;
	}
}

var justnow, cas = "", hodiny = "", minuty = "", vteriny = "";
function putTheWatchesIn() {
	cas = "";
	justnow = new Date();
	hodiny = justnow.getHours().toString();
	minuty = justnow.getMinutes().toString();
	vteriny = justnow.getSeconds().toString();
	if (hodiny.length == 1) cas += " ";
	cas += hodiny + ":";
	if (minuty.length == 1) cas += "0";
	cas += minuty + ":";
	if (vteriny.length == 1) cas += "0";
	cas += vteriny;
	GetTag('txtHodiny').value = cas;
	setTimeout ("putTheWatchesIn()",500);
}

