/**
 * @author Michael.Howlett
 */


function stripHTML(string) { 
    return string.replace(/<(.|\n)*?>/g, ''); 
}


function trunctate(x, maxlen){
	
	/* given a string and a maximum length for the string, this routine
	 returns the same string truncated to the maximum length. In addition,
	 if the string was truncated, "..." is added to the end, again not to
	 exceed the maximum length.
	 E.g. ellipsis("abcdef", 4) = "a..."
	 ellipsis("abcdef", 6) = "abcdef"
	 */
	if (x.length <= maxlen) {
		return x
	}
	else {
		if (maxlen < 4) {
			return x.substring(0, maxlen) // no room for ellipsis
		}
		else {
			return x.substring(0, maxlen - 3) + "...";
		}
	}
}
