function onTextChange(textID, countID) {
	var textField = document.getElementById(textID);
	var countField = document.getElementById(countID);

	var count = textField.value.length;
	var limit = 1000;
	var rest = 1000 - count;

	if (count > limit) {
		textField.value = textField.value.substring(0, limit);
		count = textField.value.length;
	}

	if (rest < 0) rest = 0;
	countField.innerHTML = rest;
}

function onChangeImage(id, value) {
	var image = document.getElementById(id);
	image.src = value;
	image.style.display = "block";	
}

function popupImage(src, message, width, height) {
  //alert("Width=" + width + ", height=" + height);
  var wnd = window.open("popup.php?img=" + src, "wnd", "width=" + width + ",height=" + height + ",status=0,scrollbars=1,resizable=0,location=0,menubar=0,toolbar=0");
}
