/* 
 * Main javascript file
 */

$(document).ready(function() {
    $('#menu-column ul.admin-menu li').mouseover(function() {
        $(this).addClass('selected-menu');
    });

    $('#menu-column ul.admin-menu li').mouseout(function() {
        $(this).removeClass('selected-menu');
    });

    $('#recently_updated li a').corner('10px');
    $('.admin-menu-block').corner('10px');

    $('#horses-top-menu-categories').corner('10px top');
    $('#horses-top-menu-categories').corner('10px bottom cc:#F3F0E5');
});

$(window).load(function() {
    $('#wysiwyg-editor-contents img').wrap('<a class="wysiwyg-image-round" />');

    /*$('#wysiwyg-editor-contents .wysiwyg-image-round img').each(function() {
        $(this).wrap('<a href="'+$(this).attr('src')+'">');
    });*/

    if($.browser.msie) {
        $('#wysiwyg-editor-contents .wysiwyg-image-round').css('display', 'block').corner('10px');
    } else {
        $('#wysiwyg-editor-contents .wysiwyg-image-round').css('display', 'block').cornerz({radius: 10, background: '#F3F0E5'});
    }
    
    $('#wysiwyg-editor-contents .wysiwyg-image-round').each(function(index) {
        $(this).css('height', $("img", $(this)).height()+'px');
        $(this).attr('href', $("img", $(this)).attr('src'));
        if ($("img", $(this)).css('float') == 'none') {
            $(this).css('display', 'inline-block');
        } else {
            $(this).css('float', $("img", $(this)).css('float'));
        }
        
        $(this).css('margin-top', $("img", $(this)).css('margin-top'));
        $(this).css('margin-bottom', $("img", $(this)).css('margin-bottom'));
        $(this).css('margin-left', $("img", $(this)).css('margin-left'));
        $(this).css('margin-right', $("img", $(this)).css('margin-right'));
        $("img", $(this)).css('margin', '0');
    });

    $('#wysiwyg-editor-contents a.wysiwyg-image-round').lightBox();
});
