jQuery(document).ready(function() {

    // INITIALIZE CUFON FONT REPLACEMENT
    Cufon.replace('h1, h2, h3, h4, h5, h6, .button, .topper', { hover: 'true' });

    // APPEND SOME EXTRA SPANS TO STYLE FANCY FRAMES CORRECTLY
    jQuery('.frame').append('<span class="helper1"></span><span class="helper2"></span>');
    jQuery('.framet').append('<span class="helper1"></span><span class="helper2"></span>');
    jQuery.each(jQuery('.checkmark'), function() {
        jQuery(this).height(jQuery(this).parent().height());
    });


    // REPLACE SUBMIT BUTTONS WITH SOMETHING EASIER TO STYLE:)
    jQuery('input[type=submit]').each(function() {

        var val = jQuery(this).val();
        var a = jQuery('<a class="button primary small"><span>' + val + '</span></a>');
        var input = jQuery(this);

        input.after(a);
        input.hide();

        a.click(function() {
            input.trigger('click');
        });
    });

    // -----------------------------------------------------------------------------------------
    // Internet Explorer doesn't understand some CSS selectors, so we need some helpful classes
    // -----------------------------------------------------------------------------------------
    if (jQuery.browser.msie) {
        jQuery('input[type=text]').addClass('input-text');
        jQuery('select').addClass('input-text');
        jQuery('input[type=password]').addClass('input-password');
        jQuery('input[type=checkbox]').addClass('input-checkbox');
        jQuery('input[type=radio]').addClass('input-radio');
        jQuery('input[type=submit]').addClass('input-submit');
        jQuery('input[type=image]').addClass('input-image');
        jQuery('input[type=file]').addClass('input-file');

        // IE6 doesn't understand :first-child selector
        if (parseInt(jQuery.browser.version) == 6) {
            jQuery('.grid > div:first-child').addClass('grid-first');

            // PNG transparency fix for IE6
            var png_fix = '';
            png_fix += '.divider, ';
            png_fix += '#slider, #slider span.helper1, #slider span.helper2, ';
            png_fix += '#slider .navigation .coin, ';
            png_fix += '#content .hd, #content .bd, #content .ft .shadow, #content .ft .helper1, ';
            png_fix += '#subfooter';


            DD_belatedPNG.fix(png_fix);
        }
    }


});

