function convert(text) {
    var newText = "";
	var i;

    for (i=0; i<text.length; i++)
	{
        newText += "&#" + text.charCodeAt(i) + ";";
	}

    return newText;
}

function mail2(twot,iurl,alttext,onet) {
	var alt;
	var one;
	var two;
	one = convert(onet);
	two = convert(twot);
	alt = convert(alttext);	
	var mailto = convert('mailto:');
   
	if (iurl !== '')
	{
		document.write('<a href="' + mailto + one + '@' + two + '">' + '<img src="' + iurl + '/email.gif" class="border" width="16" height="12" alt="' + one + '@' + two + '" title="' + one + '@' + two + '" />' + '</a>');
	} else {

		if (alttext == 'whole')
		{
			document.write('<a href="' + mailto + one + '@' + two + '">' + one + '@' + two + '</a>');
        } else if (alttext !== '') {
            document.write('<a href="' + mailto + one + '@' + two + '">' + alt + '</a>');
		} else {

            document.write('<a href="' + mailto + one + '@' + two + '">' + '@' + '</a>');

		}
   }
}