﻿// IE6 only - adjust the position of bottom and right corners if the
// height / width of the div so it is an odd number
// This solves the problem with incorrectly positioned corners at the
// bottom of divs with height:auto

$(document).ready(function() {
    if (IE6){
        $('.corners').each(function() {
            fixCorners($(this));
        });
    }
});

function fixCorners(box){
    if (box.innerHeight() % 2 != 0 ) {
        // Get the bottom coordinate of the bottom corners and subtract 1px
        var currentBtm = box.find('div.bl').css('bottom');
        box.children('div.bl').css('bottom', parseInt(currentBtm)-1+"px"); 
        box.children('div.br').css('bottom', parseInt(currentBtm)-1+"px");
    }
    if (box.innerWidth() % 2 != 0 ) {
        // Get the bottom coordinate of the bottom corners and subtract 1px
        var currentRight = box.find('div.tr').css('right');
        box.children('div.tr').css('right', parseInt(currentRight)-1+"px");
        box.children('div.br').css('right', parseInt(currentRight)-1+"px");
    }
}