var insert_emoticon = function(s_emoticon, dest){

	gID(dest).value += s_emoticon + ' ';
	gID(dest).focus()

}

var text_counter = function(field, maxlimit, dv) {
	if (field.value.length > maxlimit) { 
		field.value = field.value.substring(0, maxlimit)
	} else {
		if (gID(dv)) {
			gID(dv).innerHTML = (maxlimit - field.value.length) + ' characters left.'
		}
	}
}


YAHOO.util.Event.onDOMReady(function(){
	var ems = YAHOO.util.Dom.getElementsByClassName('emoticon', 'a',  'td-emoticons');

	for (i = 0; i < ems.length; i++) {
		
		ems[i].onclick = function() {
			insert_emoticon(this.rel, 'txt_body');		
		}
	}
});					

