// begin common.js


function addLoadEvent(func) {
  //alert("addLoadEvent " + func);
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    //alert("addLoadEvent single");
    window.onload = func;
  } else {
    //alert("addLoadEvent multiple");
    window.onload = function() {
      //alert("addLoadEvent recurse");
      if (oldonload) {
	oldonload();
      }
	func();
    }
  }
}


function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

function MailAddresses () {
  if (document.getElementsByName) {
    var list = getElementsByClass('mailaddress', document, '*');
    for (var i = 0; i < list.length; i++) {
	var node = list[i];
	var t = node.innerHTML;
	var n = t.replace(/[\s]+AT[\s]+/, '@');
	var tag = '<a href="mailto:' + n + '">' + t + '</a>';
	node.innerHTML = tag;
    }
  }
}


addLoadEvent(MailAddresses);


//alert("common.js");


// end common.js


