var dirty = false;
var sysmenuVisible = false;

function frmGoto(e, v) {
	document.forms["frm"].elements["goto"].value = e;
	document.forms["frm"].navid.value = v;
	document.forms["frm"].submit();
}
function frmConfirmGoto(msg, e, v) {
	if (window.confirm(msg)) {
		document.forms["frm"].elements["goto"].value = e;
		document.forms["frm"].navid.value = v;
		document.forms["frm"].submit();
	}
}
function frmCmd(c, p, v) {
	document.forms["frm"].cmd.value = c;
	document.forms["frm"].param.value = p;
	document.forms["frm"].navid.value = v;
	document.forms["frm"].submit();
}
function frmConfirmCmd(msg, c, p, v) {
	if (window.confirm(msg)) {
		document.forms["frm"].cmd.value = c;
		document.forms["frm"].param.value = p;
		document.forms["frm"].navid.value = v;
		document.forms["frm"].submit();
	}
}
function frmSubmit(a) {
	document.forms["frm"].action = a;
	document.forms["frm"].submit();
}
function frmPwdSubmit(c) {
	if (document.forms["frm"].pwd1.value == document.forms["frm"].pwd2.value) {
		document.forms["frm"].cmd.value = c;
		document.forms["frm"].submit();
	} else {
		alert("Lösenorden är olika!");
	}
}
function help(context) {
	if (context.indexOf("#") > 0) {
		window.open(context);
	} else {
		window.open('detailed_instructions.htm#' + context);
	}
	//window.open('help.asp?context=' + context, 'popup', 'width=300,height=300');
}
function charcounter(n) {
	t = document.getElementById(n)
	s = document.getElementById("cnt"+n)
	s.innerText = t.value.length;
}
function change() {
	dirty=true;
}
function askchanges(msg, a) {
	if (dirty) {
		confirmNav(msg, a);
	} else {
		document.location=a;
	}
}
function sysmenuShow(state) {
	sysmenuVisible = state;
	m = document.getElementById('sysmenu');
	if (state) {
		m.style.visibility="visible";
	} else {
		m.style.visibility="hidden";
	}
}
function sysmenuClick(href) {
	top.location = href;
}
function bodyClick() {
	if (sysmenuVisible) {
		sysmenuShow(false);
	}
}
