function countChars(el, counter){		
	if( el.value.length > el.getAttribute('maxLength')*1 ){ el.value = el.value.substring(0,el.getAttribute('maxLength')*1); }
	if(counter) document.getElementById(counter).innerHTML = el.value.length;
}

function init(){ document.body.onclick = enlargeImg; }

function enlargeImg(ev){
	ev = ev || window.event;
	var target = ev.target || ev.srcElement;
	
	if( target.tagName != 'img' && target.getAttribute('enlarge') != 'true' )  return;
	
	var imgLg  = target.src.replace('/entry', '/large/entry');
	//var imgLg  = target.src.replace(imgExt, '_th' + imgExt);

	tb_show(target.alt, imgLg);
}

window.onload = init;