function textCounter(theField, charsLeft, maxChars) {
	if (theField.value.length > maxChars) {
		theField.value = theField.value.substring(0, maxChars);
	} else {
		charsLeft.value = maxChars - theField.value.length;
	}
}

function extensibleTextCounter(theField, charsLeft, maxChars) {
	if (theField.value.length > maxChars) {
		charsLeft.value = 0;
	} else {
		charsLeft.value = maxChars - theField.value.length;
	}
}

function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function selectRadioButton(radioButton, value) {
    for (var i = 0; i < radioButton.length; i++) {
        if (radioButton[i].value == value) {
            radioButton[i].checked = true;
            if (radioButton[i].onclick) {
                radioButton[i].onclick();
            }
            break;
        }
    }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
