/*
 * File Name: mto.js
 * 	Secure email addresses
 */
function mto (eml,text,strong)
{       var Me,To,eml;
		eml = mto_decrypt(eml);
        Me = 'm'+'a'+'i';
        To = 'l'+'to:';
        if ( typeof text == 'undefined' || text == '' )
        {       text = eml;
        }
		if ( typeof strong == 'string' )
		{	text = '<strong>'+text+'</strong>';
		}
		document.write('<a href="' + Me + To + eml + '">' + text + '</a>');
}
function mto_href (eml)
{       var Me,To,eml;
		eml = mto_decrypt(eml);
        Me = 'm'+'a'+'i';
        To = 'l'+'to:';
        document.write(Me + To + eml);
}
function mto_img (eml,img,alt)
{		var Me,To,eml;
		eml = mto_decrypt(eml);
        Me = 'm'+'a'+'i';
        To = 'l'+'to:';
        if ( typeof alt == 'undefined' || alt == '' )
        {       alt = 'e-mail';
        }
        document.write('<a href="' + Me + To + eml + '" title="' + alt + '">' + '<img src="/images/' + img + '" border="0" alt="' + alt + '">' + '</a>');
}
function mto_decrypt(s)
{       var n=0;
        var r="";
        for(var i=0; i < s.length; i++) {
                n=s.charCodeAt(i);
                if (n>=8364) {n = 128;}
                r += String.fromCharCode(n-(3));
        }
        return r;
}
function mto_link (user,domain,suffix)
{	// < a href="<script language="javascript">mto('R.P.B.v.Gelder','tue','nl')</script>"><img src=""></a>
	var Me,To,dc;
	Me = 'm'+'a'+'i';
	To = 'l'+'to:';
	Ad = user + '\@' + domain + '.' + suffix
	return (Me + To + Ad);
}
