String.prototype.trim = function() {
  return this.replace(/^\s*(\b.*\b|)\s*$/, "$1");
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = field.value.length;
}

function PostComment() {

var name = frmComment.txtname.value;
var comment = frmComment.txtcomment.value;
var upcomment = comment.toLowerCase();

frmComment.btnPostComment.disabled = true;

	if (name.trim().length < 3 || name.trim().length > 20) {
		alert("You name is too short or too long.");
		frmComment.txtname.focus();
		frmComment.btnPostComment.disabled = false;
		return;
	}

	if (comment.trim().length < 5) {
		alert("Your comment is too short.");
		frmComment.txtcomment.focus();
		frmComment.btnPostComment.disabled = false;
		return;
	}

frmComment.submit();
}

function win(fileName) {
 	
myFloater = window.open('','resWindow','scrollbars=no,status=no,width=440,height=250')
myFloater.location.href = fileName;
    
if (!myFloater.opener)
myFloater.opener = self;
myFloater.focus();

}
