
/*
 * Main credits for this script goes to
 * http://simonwillison.net/2004/May/26/addLoadEvent/
 * and Jan "Yenya" Kasprzak, http://www.fi.muni.cz/~kas/index.html.en
 * from the core development team of the IS MU http://is.muni.cz/
 *
 * Minor changes by Jan Holeček, http://www.fi.muni.cz/~xholecek/.
 *
 * P.S. If you do not understand the identifiers, you do not speak Czech :).
 *
 */

/*
 * opravi emailove adresy na strance.
 */
function oprav_postovni_adresu()
{
    adresy = document.getElementsByTagName("span");
    for (var i=0; i < adresy.length; i++) {
        var adresa = adresy[i];
        if (adresa.className != "eml")
            continue;

        var skutecna = adresa.innerHTML;
        skutecna = skutecna.replace(/<!--[^-]*?-->/g, '');
        skutecna = skutecna.replace(/<img[^>]*?atsign.gif[^>]*?>/gi, '@'); 
        skutecna = skutecna.replace(/<img[^>]*?dot.gif[^>]*?>/gi, '.');

        var text = skutecna.match(/[^:]*/);
        if (text == "") text = skutecna;
        skutecna = skutecna.replace(/[^:]*: /,'');
        adresa.innerHTML = '<a href="mailto:'
            + skutecna + '">' + text + '</a>';
        adresa.normalize();
    }
}

