

var Misc = {
    start: function(){
        tables = $$('td.content_sec table');
        if (tables) {
            tables.each(function(el, i){
                Misc.stripe(el, '#D7E8F0', '#A4D2E2');
            }, this);
        }
    },
    hasClass: function(obj){
        var result = false;
        if (obj.getAttributeNode("class") != null) {
            result = obj.getAttributeNode("class").value;
        }
        return result;
    },

    stripe: function(el){

        var even = false;

        var evenColor = arguments[1] ? arguments[1] : "#fff";
        var oddColor = arguments[2] ? arguments[2] : "#eee";

        var table = el;
        if (!table) {
            return;
        }

        var tbodies = table.getElementsByTagName("tbody");

        for (var h = 0; h < tbodies.length; h++) {

            var trs = tbodies[h].getElementsByTagName("tr");

            for (var i = 0; i < trs.length; i++) {

                if (!Misc.hasClass(trs[i]) &&
                !trs[i].style.backgroundColor) {

                    var tds = trs[i].getElementsByTagName("td");

                    for (var j = 0; j < tds.length; j++) {

                        var mytd = tds[j];

                        if (!Misc.hasClass(mytd) &&
                        !mytd.style.backgroundColor) {

                            mytd.style.backgroundColor = even ? evenColor : oddColor;

                        }
                    }
                }
                even = !even;
            }
        }
    }
}
window.addEvent('load', Misc.start);
