/* For additional information about this JavaScript
and how to use it, see the "Displaying Number of Words
Typed Into Form Fields" article, linked from the archives
at from http://willmaster.com/possibilities/archives/
The above note and the copyright line must remain with
this JavaScript source code. Comments below this point
in the code may be removed if desired. */

// Customizing this JavaScript code requires specifying eight values.

// Value One:
// Specify the maximum number of characters the form field
// may contain. If you have no maximum, specify 0 (zero).

var MaximumCharacters = "60";


// Value Three:
// Specify the form's name (provided by the name="_____"
// attribute in the FORM tag).

var FormName = "maczhor1";



// Value Four:
// Specify the name of the text field being monitored
// (provided by the name="_____" attribute in the
// INPUT or TEXTARE tag).

var TextFieldName = "os0";



// Value Six:
// Specify the field name where where is to be displayed
// the number of characters left that may be typed.
// Make it blank (nothing between the quotation marks)
// if you aren't displaying the number of characters
// left.

var CharactersLeftFieldName = "CharsLeft";


//////////////////////////////////////////////////////
//                                                  //
//  No modfications are required below this point.  //
//                                                  //
//////////////////////////////////////////////////////


var MaxChars = parseInt(MaximumCharacters);
var textfield = 'document.' + FormName + '.' + TextFieldName + '.value';

var MaxCharss = parseInt(MaximumCharacterss);
var textfieldd = 'document.' + FormName + '.' + TextFieldNamee + '.value';



function CharLengthCheck(s,l) {
if(s.length > l) { s = s.substring(0,l); }
return s;
} // function CharLengthCheck()

function InputCharacterLengthCheck() {
if(MaxChars <= 0) { return; }
var currentstring = new String();
eval('currentstring = ' + textfield);
var currentlength = currentstring.length;
eval('currentstring = CharLengthCheck(' + textfield + ',' + MaxChars + ')');
if(CharactersLeftFieldName.length > 0) {
	var left = 0;
	eval('left = ' + MaxChars + ' - ' + textfield + '.length');
	if(left < 0) { left = 0; }
	eval('document.' + FormName + '.' + CharactersLeftFieldName + '.value = ' + left);
	if(currentstring.length < currentlength) { eval(textfield + ' = currentstring.substring(0)'); }
	}
if(CharactersTypedFieldName.length > 0) {
	eval('document.' + FormName + '.' + CharactersTypedFieldName + '.value = ' + textfield + '.length');
	if(currentstring.length < currentlength) { eval(textfield + ' = currentstring.substring(0)'); }
	}
} // function InputCharacterLengthCheck()



function InputLengthCheck() {
InputCharacterLengthCheck();
} // function InputLengthCheck()



function CharLengthCheckk(s,l) {
if(s.length > l) { s = s.substring(0,l); }
return s;
} // function CharLengthCheck()

function InputCharacterLengthCheckk() {
if(MaxCharss <= 0) { return; }
var currentstringg = new String();
eval('currentstringg = ' + textfieldd);
var currentlengthh = currentstringg.length;
eval('currentstringg = CharLengthCheckk(' + textfieldd + ',' + MaxCharss + ')');
if(CharactersLeftFieldNamee.length > 0) {
	var leftt = 0;
	eval('leftt = ' + MaxCharss + ' - ' + textfieldd + '.length');
	if(leftt < 0) { leftt = 0; }
	eval('document.' + FormNamee + '.' + CharactersLeftFieldNamee + '.value = ' + leftt);
	if(currentstringg.length < currentlengthh) { eval(textfieldd + ' = currentstringg.substring(0)'); }
	}
if(CharactersTypedFieldNamee.length > 0) {
	eval('document.' + FormNamee + '.' + CharactersTypedFieldNamee + '.value = ' + textfieldd + '.length');
	if(currentstringg.length < currentlengthh) { eval(textfieldd + ' = currentstringg.substring(0)'); }
	}
} // function InputCharacterLengthCheck()



function InputLengthCheckk() {
InputCharacterLengthCheckk();
} // function InputLengthCheck()

