﻿var winOnLoad = function() {
    var emails = getElementsByClassName("encodedAddress");
    for (var i = 0, j = emails.length; i < j; i++) {
        var anchor = document.createElement("a");
        var textField = emails[i].innerHTML.replace("[at]", "@");
        var text = emails[i].title;
        if (text == null || text.length == 0) {
            text = textField;
        }

        anchor.appendChild(document.createTextNode(text));
        anchor.setAttribute("href", "mailto:" + textField);
        emails[i].parentNode.replaceChild(anchor, emails[i]);
    }

}

if (typeof window.addEventListener != "undefined") {
    window.addEventListener("load", winOnLoad, false);
} else if (typeof window.attachEvent != "undefined") {
    window.attachEvent("onload", winOnLoad);
}

function getElementsByClassName(classname, node) {
    if (!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for (var i = 0, j = els.length; i < j; i++)
        if (re.test(els[i].className)) a.push(els[i]);
    return a;
}


////kampan - random pravy roh dole

// $(document).ready(function() {
//        $(document).ready(function() {
//              randNum = Math.floor(Math.random() * 2);
//              // show image that is nth child of image array
//              $('#kampanFooter_1').removeClass();
//              $('#kampanFooter_2').removeClass();
//              $('#kampanFooter_1').addClass("k" + randNum);
//              $('#kampanFooter_2').addClass("k" + randNum);
//              if (randNum == 0) {}
//              else $('#kampanRightBox').removeClass();
//        })
// })


