function change_null(field_name) {
	var field = document.getElementById(field_name);
	var nullfield = document.getElementById('null_' + field_name);
	var nulllink = document.getElementById('nulllink_' + field_name);
	if (field.disabled == true) {
		field.disabled = false;
		nullfield.value = '0';
		nulllink.innerHTML = '&Oslash;';
	}
	else {
		field.disabled = true;
		nullfield.value = '1';
		nulllink.innerHTML = 'O';
	}
}

// For the bank transfer form.
function fmtae(o) {
	var val = o.value;
	val = val.replace(/[^0-9.]/g, '');
	val = val.replace(/^0/g, '');
	val = val.replace(/\./, '-');
	val = val.replace(/\./g, '');
	val = val.replace('-', '.');
	val = val.replace(/^(\d*\.\d\d)\d+/, '$1');
	if (!val.match(/\./)) val = val + '.00';
	else if (val.match(/\.$/)) val = val + '00';
	else if (val.match(/\.\d$/)) val = val + '0';
	if (val.match(/^\./)) val = '0' + val;
	o.value = val;
}

// Insert characters into a textbox.
function insertchar(str) {
	// Use the first textarea on the page.
	var textarea = document.getElementsByTagName('textarea')[0];
	if (document.selection) { // IE
		var theSelection = document.selection.createRange().text;
		if (!theSelection) theSelection = '';
		textarea.focus();
		document.selection.createRange().text = str + theSelection;
	}
	else if (textarea.selectionStart || textarea.selectionStart == '0') { // Mozilla
		var start = textarea.selectionStart;
		var end = textarea.selectionEnd;
		var scrollpos = textarea.scrollTop;
		textarea.value = textarea.value.substr(0, start) + str + textarea.value.substr(end, textarea.value.length);
		textarea.focus();
		textarea.selectionStart = textarea.selectionEnd = start + str.length;
		textarea.scrollTop = scrollpos;
	}
	else { // Other browsers: insert character at end of textarea.
		textarea.value += str;
	}
	// Reposition cursor if possible.
	if (textarea.createTextRange) textarea.caretPos = document.selection.createRange().duplicate();
}
