var CharacterCounter = 
{
	getNode: function( id )
	{
		return document.getElementById( id );
	},
	newCounter: function( formID, taName, identifier, maxLength )
	{
		var ta		= document.forms[formID].elements[taName];
		var counter	= document.forms[formID].elements[identifier];
		var cont	= this.getNode( identifier );

		function update()
		{
			counter.value = maxLength - ta.value.length;
			if ( ta.value.length > maxLength )
			{
				ta.value = ta.value.substring( 0, maxLength );
				counter.value = 0;
			}
		}

		ta.onkeydown =
		ta.onkeyup = 
		ta.onchange = update;
		
		update();
		cont.style.display = 'block';
	}
}



function wopen(url, w, h)
{
        // Fudge factors for window decoration space.
	// In my tests these work well on all platforms & browsers.
        w += 32;
        h += 96;
	var win = window.open(url,
		'popup', 
		'width=' + w + ', height=' + h + ', ' +
		'location=no, menubar=no, ' +
		'status=no, toolbar=no, scrollbars=no, resizable=no');
	win.resizeTo(w, h);
	win.focus();
}
















