/* Javascript function to truncate long text in tables */
function ellipsis() {
	var w;
	if ($(this).parent(".ellipsis-container").length > 0) {
		w = $(this).parent(".ellipsis-container")[0].css("width").replace("px", "");
	} else {
		w = $(this).css("width").replace("px", "");
	}
	var t = this.innerHTML;
	this.innerHTML = "<span>" + t + "</span>";
	var e = this.firstChild;
	while (t.length > 0 && e.offsetWidth >= w) {
		t = t.substr(0, t.length - 1);
		e.innerHTML = t + "...";
	}
}

function updateEllipsis() {
	var s = document.documentElement.style;
	// do not execute ellipsis when in ie or opera
	if (!('textOverflow' in s || 'OTextOverflow' in s)) {
		$('.ellipsis').each(ellipsis);
	}
}