var site = {
    init: function() {
        site.style_buttons();
        $('.item').filter(':not(.selected)').mouseenter(function () {
            $(this).addClass('hover');
        }).mouseleave(function () {
            $(this).removeClass('hover');
        }).click(function (ev) {
            var href = ev.target.href ||
                $(this).find('a').attr('href');
            window.location = href;
        });
    },
    style_buttons: function(target) {
        if (!$.browser.msie || parseInt($.browser.version) > 6) {
            /*borrowed from david's kitchen*/
            if (typeof target == "undefined") {
                target = $('.btn');
            } else {
                if ($(target).hasClass('btn')) {
                    target = $('.btn', target).andSelf();
                } else {
                    target = $('.btn', target);
                }
            }

            target.each(function(){
                var b = $(this);
                var tt = b.text() || b.val();
                if ($(':submit,:button',this).length > 0) {
                    console.debug($(':submit,:button',this));
                    b = $('<a>').insertAfter(this).addClass(this.className).attr('id',this.id);
                    $(this).remove();
                }
                b.text('').prepend('<i></i>').append($('<span>').
                text(tt).append('<i></i><span></span>'));
            });
        }
    }
};
$(document).ready(site.init);
