function  LimitTextArea(id,limit)
{
	var e=$(id);
	if(e && e.hasAttribute('cols'))
	{
		var div =document.createElement('div');
		div.id=id+'_charsrem';
		div.className='charsrem';
		e.parentNode.appendChild(div);
		div.style.width=(e.clientWidth-5)+'px';
		e.onchange=function() {
			if(e.value.length>limit)
			{
				var sub=e.value;
				sub=sub.substring(0,limit);
				e.value=sub;
			}
			div.innerHTML='You may enter a further '+(limit-e.value.length)+' characters.';
		}
		e.onkeyup=e.onchange;
		e.onchange();
	}
}

function SetTextAreaBGText(id,text)
{
	var e=$(id);
	if(e)
	{
		var oldbackground=e.style.background;
		var oldcolor=e.style.color;
		var oldfontstyle=e.style.fontStyle;
		var oldcontent=e.value;
		e.style.background='#eee';
		e.style.color='#333';
		e.style.fontStyle='italic';
		e.value=text;
		e.onsubmit=function() {
			if(e.value==text)
			{
				e.value=oldcontent;
				e.style.background=oldbackground;
				e.style.color=oldcolor;
				e.style.fontStyle=oldfontstyle;
			}
		}
		e.onfocus=e.onsubmit;
	}
}
