

var validateError = 0;

function ValidationError(ctrl, msg){
	if(!validateError) {
		if(ctrl){
			document.getElementById(ctrl).focus();
		}
		if(msg) if(msg.length > 0) alert(msg);
		validateError = 1;
	}
}


function ControlVisibility(c, n)
{
	for (var i=0; i<n.length; i++) {
		p=n[i].split("|");
		document.getElementById(p[0]).style.display = c ? p[1] : p[2];
	}
}

function ParseFloat(str)
{
	if (parseFloat("0.1")==0) {
		return parseFloat(str.replace(".",","));
	} else {
		return parseFloat(str.replace(",","."));
	}
}


function isSelectedValue(sel, opt){
	var opts = sel.options;
	for (i = 0; i < opts.length; i++) {
		if (opts.item(i).value == opt) return opts.item(i).selected;
	}
	return false;
}


function SubmitForwarder(e, c)
{
	var kod;
	if (!e) var e = window.event;
	if (e.keyCode) kod = e.keyCode;
	if (kod == 13)
	{
		var s = document.getElementById(c);
		if (s)
		{
			var f = s.form;
			var h = document.createElement("INPUT");
			h.type = "hidden";
			h.name = s.name;
			h.value = s.value;
			f.appendChild(h);
			f.submit();
		}
		else
		{
			alert("Submit element not found");
		}
	}
}


function SubmitByHyperlink(n)
{
	var f = document.forms[0];
	var e = document.createElement("INPUT");
	e.type = "hidden";
	e.name = n;
	e.value = "1";
	f.appendChild(e);
	f.submit();
	return false;
}



