Event.observe(window, 'load', function() {
    Cufon.replace('.cufon, .futura, #footer-content .right ul, #footer-content .right p, #header .nav', {
        fontFamily: 'Futura',
        hover: true
    });
    Cufon.replace('.gotham, .form-list label, button span span, a.button, .messages span, .fieldset .legend, #shopping-cart-totals-table td, .step-title span, .step-title h2, #opc-login h3, #opc-login h4, .box-head h2, .block .block-title, .addresses-list h2', {
        fontFamily: 'Gotham',
        hover: true
    });
    Cufon.replace('.gotham-shadow, .page-title h1', {
        fontFamily: 'Gotham',
        hover: true,
        textShadow: '#DEECF5 5px 5px',
        color: '-linear-gradient(#F7941F,#F26C0D)'
    });
});

jQuery.noConflict();
jQuery(document).ready(function() {
    jQuery('[data-href]').css({cursor: 'pointer'}).click(function(e) {
        e.preventDefault();
        window.location = jQuery(this).attr('data-href');
    });
});
jQuery(window).load(function() {
    var theSameHeight = function() {
        jQuery('ul.products-grid li.first').each(function() {
            var $first = jQuery(this);
            var $last = $first.next('li.last');
            var height = 0;
            var temp = 0;
            if (temp = parseInt($first.find('h2').outerHeight(), 10)) {
                height += temp;
            }
            if (temp = parseInt($first.find('h4').outerHeight(), 10)) {
                height += temp;
            }
            if (temp = parseInt($first.find('a.grouphref').outerHeight(), 10)) {
                height += temp;
            }
            if ($last.length) {
                var height2 = 0;
                if (temp = parseInt($last.find('h2').outerHeight(), 10)) {
                    height2 += temp;
                }
                if (temp = parseInt($last.find('h4').outerHeight(), 10)) {
                    height2 += temp;
                }
                if (temp = parseInt($last.find('a.grouphref').outerHeight(), 10)) {
                    height2 += temp;
                }
                if (height2 > height) {
                    height = height2;
                }
            }
            height += 261;
            $first.css({height: height + 'px'});
            if ($last.length) {
                $last.css({height: height + 'px'});
            }
            height -= 4;
            $first.children('div').css({height: height + 'px'});
            if ($last.length) {
                $last.children('div').css({height: height + 'px'});
            }
            height -= 305;
            $first.find('.price-box').css({bottom: height + 'px'});
            if ($last.length) {
                $last.find('.price-box').css({bottom: height + 'px'});
            }
        });
    };
    theSameHeight();
    setTimeout(theSameHeight, 1000);
    jQuery('a.grouphref').css({position: 'absolute', bottom: 10, left: 2});
    jQuery('ul.products-grid li > div').css({cursor: 'pointer'}).click(function() {
        window.location = jQuery(this).find('a:first-child').attr('href');
    });
});
