// JavaScript Document

function initEl() {
	var ellipsisSeq = 0;
	var ellipsisEls = document.getElementsByTagName('span');
	for (var i = 0; i < ellipsisEls.length; i++) {
	  var el = ellipsisEls[i];
	  if (el.className.match(/ellipsis/)) {
	    var maxLength = el.getAttribute("maxLength");
	    if (!maxLength) maxLength = 10;

	    var longText = el.innerHTML;
	    var shortText = trim(stripTags(el.innerHTML));
	    if (shortText.length < maxLength) continue;
	    shortText = shortText.substring(0, maxLength);

	    el.id = "ellipsis" + ellipsisSeq++;
	    el.innerHTML = 
		'<span id="' + el.id + 'short">' + shortText +
		<!--'<a href="javascript:ellipsisLong(\'' + el.id + '\')">...</a>' +-->
		'...' +
		'</span>' +
		'<span style="display:none" id="' + el.id + 'long">' +
		longText +
		<!-- '<a href="javascript:ellipsisShort(\'' + el.id + '\')">...</a> ' + -->
		'... ' +
		'</span>';
	  }
	}
      }

      function stripTags (t) {
	while (t.match(/<.*>/)) t = t.replace(/<[^>]*>/, "");
	return t;
      }

      function trim (t) {
	return t.replace(/^[ \r\n\t]*/, "").replace(/[ \r\n\t]*$/, "");
      }

      function ellipsisShort (id) {
	document.getElementById(id + "short").style.display = "inline";
	document.getElementById(id + "long").style.display = "none";
      }

      function ellipsisLong (id) {
	document.getElementById(id + "short").style.display = "none";
	document.getElementById(id + "long").style.display = "inline";
      }
