/**
 * Browser fixes for generic.css. This file depends on jQuery.
 */

jQuery(document).ready(function($){
    var majorVersion = parseInt($.browser.version, 10);

/* @group Links
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group Text
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group Segment
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group Button
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group Image
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group Section
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

 /* @group Table
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

if ($.browser.msie && majorVersion < 9) {
    /* tables with pagination buttons for the data in the footer */
    $("table.cw-table-pagination > tfoot > tr > th:last-child,\
       table.cw-table-pagination > tfoot > tr > td:last-child").css({
        "padding-right": "0", "text-align": "right"});

    /* header rows */
    $("table.cw-table-striped > thead > tr:nth-child(odd),\
       table.cw-table-striped > thead > tr.cw-table-striped-odd,\
       table.cw-table-striped > thead > tr.cw-table-striped-odd.cw-table-striped-force").css({
        "background-color": "#BABACF"});

    $("table.cw-table-striped > thead > tr:nth-child(even),\
       table.cw-table-striped > thead > tr.cw-table-striped-even,\
       table.cw-table-striped > thead > tr.cw-table-striped-even.cw-table-striped-force").css({
        "background-color": "#CFCFDD"});

    /* body rows */
    $("table.cw-table-striped > tbody > tr:nth-child(odd),\
       table.cw-table-striped > tbody > tr.cw-table-striped-odd,\
       table.cw-table-striped > tbody > tr.cw-table-striped-odd.cw-table-striped-force").css({
        "background-color": "#EAF1F3"});

    $("table.cw-table-striped > tbody > tr:nth-child(even),\
       table.cw-table-striped > tbody > tr.cw-table-striped-even,\
       table.cw-table-striped > tbody > tr.cw-table-striped-even.cw-table-striped-force").css({
        "background-color": "#F4F9FA"});

    /* last row of the table */
    $("table.cw-table-boxed > thead > tr:last-child > th,\
       table.cw-table-boxed > thead > tr:last-child > td,\
       table.cw-table-boxed > tbody > tr:last-child > th,\
       table.cw-table-boxed > tbody > tr:last-child > td,\
       table.cw-table-boxed > tfoot > tr:last-child > th,\
       table.cw-table-boxed > tfoot > tr:last-child > td").css({
        "border-bottom-width": "0"});

    /** last cell of a row **/
    $("table.cw-table-boxed > thead > tr > th:last-child,\
       table.cw-table-boxed > thead > tr > td:last-child,\
       table.cw-table-boxed > tbody > tr > th:last-child,\
       table.cw-table-boxed > tbody > tr > td:last-child,\
       table.cw-table-boxed > tfoot > tr > th:last-child,\
       table.cw-table-boxed > tfoot > tr > td:last-child").css({
        "border-right-width": "0"});
}

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group Form
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

if ($.browser.msie && majorVersion < 9) {
    $("ul.cw-form-error > li:last-child").css({
        "padding-bottom": "0"});

    $("ul.cw-form-modified > li:last-child").css({
        "padding-bottom": "0"});
}

if ($.browser.msie && majorVersion < 8) {
    $("ul.cw-form-error").each(function(){
        var $this = $(this),
            marginLeft = $this.css("margin-left");

        // 40px is the default left margin value, so if it appears to not be
        // modified, remove the margin to display the list properly
        if (marginLeft == "40px") {
            $this.css("margin-left", "0px");
        }
    });

    $("ul.cw-form-modified").each(function(){
        var $this = $(this),
            marginLeft = $this.css("margin-left");

        // 40px is the default left margin value, so if it appears to not be
        // modified, remove the margin to display the list properly
        if (marginLeft == "40px") {
            $this.css("margin-left", "0px");
        }
    });
}

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/* @group List
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

if ($.browser.msie && majorVersion < 8) {
  // add separators to list items
  $("ol.cw-list-horizontal.cw-list-separated > li:not(:last-child),\
     ul.cw-list-horizontal.cw-list-separated > li:not(:last-child)").after(",");
  $("ol.cw-list-horizontal.cw-list-separated > li:last-child,\
     ul.cw-list-horizontal.cw-list-separated > li:last-child").before("and ");
  $("ol.cw-list-horizontal.cw-list-separated > li:last-child,\
     ul.cw-list-horizontal.cw-list-separated > li:last-child").after(".");
}

/* @end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

});
