var config; // a global set on each page
var restoreImageInterval;

function swapImage(imgName, imgSrc)
{
	if (document.images) {
		document.images[imgName].src = imgSrc;
		if (document.restoreImageInterval) {
			clearInterval(document.restoreImageInterval);
		}
	}
}

function restoreImage(imgName, imgSrc)
{
	document.restoreImageInterval = setInterval("swapImage(\"" + imgName + "\", \"" + imgSrc + "\")", 100)
}

function openWindow(winHref, winName, winWidth, winHeight)
{
	winSettings = 'width=' + winWidth + ',';
	winSettings += 'height=' + winHeight + ',';
	winSettings += 'menubar=yes,';
	winSettings += 'status=yes,';
	winSettings += 'scrollbars=yes,';
	winSettings += 'resizable=yes';
	win = window.open(winHref, winName, winSettings);
	win.focus();
}

function textCounter(field, countdownId, maxlimit)
{
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}
	countdownElement = document.getElementById(countdownId);
	report = (maxlimit - field.value.length) + " characters left.";
	countdownElement.innerHTML = report;
}
