function em(name,domain) {
	return name + '@' + domain.replace(/\|/g,'.');
}
function emlink(name,domain,display) {
	var s;
	if (display && display.length>0) {
		s = '<a href="mailto:'+em(name,domain)+'">'+display+'</a>';
	}
	else {
		s = '<a href="mailto:'+em(name,domain)+'">'+em(name,domain)+'</a>';
	}
	return s;
}
function writeemlink(name,domain,display) {
	document.write(emlink(name,domain,display));
}
function findObj(theObj, theDoc) {
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}
function removeLeadingAndTrailingChar(inputString, removeChar) {
	var returnString = inputString;
	if (removeChar.length) {
		while(''+returnString.charAt(0)==removeChar) {
			returnString=returnString.substring(1,returnString.length);
		}
		while(''+returnString.charAt(returnString.length-1)==removeChar) {
	    	returnString=returnString.substring(0,returnString.length-1);
		}
	}
	return returnString;
}
function trim(s) {
	return removeLeadingAndTrailingChar(s,' ');
}
