﻿function webDesign_webDesignMenu_onMouseOverMenuButton(button) {
    // Special case for history button
    if ($(button).parent().hasClass('history')) {
        if ($(button).siblings('.historyPopup').css('display') == 'block') {
            // Leave highlighted while history popup is open
            return;
        }
    }
    // Show the title popup and highlight when the user hovers over the button
    $(button).parent().addClass('hover');
    $(button).siblings('.menuButtonTitle').css('display', 'inline');
}

function webDesign_webDesignMenu_onMouseOutMenuButton(button) {
    // Special case for history button
    if ($(button).parent().hasClass('history')) {
        if ($(button).siblings('.historyPopup').css('display') == 'block') {
            // Leave highlighted while history popup is open
            return;
        }
    }
    // Hide the title popup and remove the highlight when the user finishes hovering over the button
    $(button).parent().removeClass('hover');
    $(button).siblings('.menuButtonTitle').css('display', 'none');
}

function webDesign_webDesignMenu_onClickButton(button) {
    // Don't respond to click if disabled
    if ($(button).parent().hasClass('disabled'))
        return false;
}

function webDesign_webDesignMenu_onClickHistory(button) {
    // Don't respond to click if disabled
    if ($(button).parent().hasClass('disabled'))
        return false;

    // Clicked on the history button
    if ($(button).siblings('.historyPopup').css('display') == 'none') {
        // Show history popup and highlight the button
        $(button).parent().addClass('hover');
        $(button).siblings('.menuButtonTitle').css('display', 'none');
        $(button).siblings('.historyPopup').css('display', 'block');
        $(button).siblings('.historyPopup').resizable({ handles:'sw', alsoResize:'.historyPopup .history', minWidth:250, minHeight:290, autoHide:false });
    }
    else {
        // Hide history popup and remove button highlight
        $(button).parent().removeClass('hover');
        $(button).siblings('.menuButtonTitle').css('display', 'none');
        $(button).siblings('.historyPopup').css('display', 'none');
    }
    // Prevent callback to server
    return false;
}

function webDesign_webDesignMenu_onMouseOverHistoryRevision(button) {
    $(button).css('background-color', '#ff8800');
}

function webDesign_webDesignMenu_onMouseOutHistoryRevision(button) {
    $(button).css('background-color', '');
}
