﻿function email() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
		    anchor.getAttribute("rel") == "email_m") 
		    {
			anchor.href = "mail" + "to:" + 
				      "%6d%61%74%74" + "%40" + 
				      "%61%69%74%6b%65%6e%68%61%75%6c%61%67%65%2e%63%6f%2e%75%6b";
			}
		else if (anchor.getAttribute("href") &&
		    anchor.getAttribute("rel") == "email_d") 
		    {
			anchor.href = "mail" + "to:" + 
				      "%64%6f%75%67%6c%61%73" + "%40" + 
				      "%61%69%74%6b%65%6e%68%61%75%6c%61%67%65%2e%63%6f%2e%75%6b";
			}
		else if (anchor.getAttribute("href") &&
		    anchor.getAttribute("rel") == "email_i") 
		    {
			anchor.href = "mail" + "to:" + 
				      "%69%6e%66%6f" + "%40" + 
				      "%61%69%74%6b%65%6e%68%61%75%6c%61%67%65%2e%63%6f%2e%75%6b";
			}
	}
}
// Piggy-back fucntion onto onLoad event ............................................
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(email);


