﻿$().ready(function () {

    i = 0;
    $.each($('table.zebra tr'), function (index, item) {
        if ($(item).parents('thead').html() != null) {
            head = '<tr class="z_h">';
            $.each($(item).find('td'), function (index2, item2) {
                head += '<td';
                if (index2 == 0) {
                    head += ' class="l_t"';
                }
                if (index2 == $(item).find('td').length - 1) {
                    head += ' class="r_t"';
                }
                head += '>&nbsp;</td>';
            });
            head += '</tr>';
            $(item).parents('thead').prepend(head);
            if (!/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent)) {
                $(item).find('td:first').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_head_bottom_left.png) no-repeat left bottom #0F673B');

                $(item).find('td:last').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_head_bottom_right.png) no-repeat right bottom #0F673B');
            }

        }
        else if ($(item).parents('tfoot').html() != null) {
            if (!/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent)) {
                $(item).find('td:first').html('<div class="l_t"></div>' + $(item).find('td:first').html());
                $(item).find('td:last').html('<div class="r_t"></div>' + $(item).find('td:last').html());
            }
            $(item).find('td:first').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_foot_bottom_left.png) no-repeat left bottom #FDB817');
            $(item).find('td:last').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_foot_bottom_right.png) no-repeat right bottom #FDB817');


        }
        else {
            i++;
            if ((i % 2) == 1) {
                $(item).find('td').css('background', 'none');
            }
            else {
                if (!/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent)) {
                    $(item).find('td:first').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_bottom_left.png) no-repeat left bottom #E1E7E0');
                    $(item).find('td:first').html('<div class="l_t"></div>' + $(item).find('td:first').html());
                    $(item).find('td:last').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_bottom_right.png) no-repeat right bottom #E1E7E0');
                    $(item).find('td:last').html('<div class="r_t"></div>' + $(item).find('td:last').html());
                }
            }
        }
    });

    i = 0;
    $.each($('table.zebra_m tr'), function (index, item) {
        if ($(item).parents('thead').html() != null) {

            //$(item).find('td:first').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_head_bottom_left.png) no-repeat left bottom #0F673B');
            //$(item).find('td:first').html('<div class="l_t"></div>'+$(item).find('td:first').html());

            //$(item).find('td:last').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_head_bottom_right.png) no-repeat right bottom #0F673B');
            //$(item).find('td:last').html('<div class="r_t"></div>'+$(item).find('td:last').html());

        }
        else if ($(item).parents('tfoot').html() != null) {
            //$(item).find('td:first').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_foot_bottom_left.png) no-repeat left bottom #FDB817');
            //$(item).find('td:first').html('<div class="l_t"></div>'+$(item).find('td:first').html());
            //$(item).find('td:last').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_foot_bottom_right.png) no-repeat right bottom #FDB817');
            //$(item).find('td:last').html('<div class="r_t"></div>'+$(item).find('td:last').html());
        }
        else {
            i++;
            if ((i % 2) == 1) {
                $(item).find('td').css('background', 'none');
            }
            else {
                //$(item).find('td:first').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_bottom_left.png) no-repeat left bottom #E1E7E0');
                //$(item).find('td:first').html('<div class="l_t"></div>'+$(item).find('td:first').html());
                //$(item).find('td:last').css('background', 'url(/_layouts/images/adv.life/overlays/table_td_bottom_right.png) no-repeat right bottom #E1E7E0');
                //$(item).find('td:last').html('<div class="r_t"></div>'+$(item).find('td:last').html());
            }
        }
    });

    $('iframe').attr('allowtransparency', 'true');

    $("#cityOv, #cityOfficeOv, #phoneOrderOv, #feedbackOv").overlay({
        mask: { color: '#fff', opacity: 0.7 },
        close: '.closeOverlay',
        left: "center",
        top: "center",
        onClose: function () { $("#feedbackOkOv").click(); }
    });

    $("#feedbackOkOv").overlay({
        mask: { color: '#fff', opacity: 0.7 },
        close: '.closeOverlay',
        left: "center",
        top: "center"
    });

});
