Menu = new ( Class.create({
    
    initialize : function() {},
    
    SetEvents : function()
    {
        this.SetLoginText();
        Event.observe( "logoutButton", "click", this.LogoutButtonClicked.bindAsEventListener(this) );
        Event.observe( "profileButton", "click", this.ProfileButtonClicked.bindAsEventListener(this) );
        Event.observe( "passwordButton", "click", this.PasswordButtonClicked.bindAsEventListener(this) );
        Event.observe( "invitationButton", "click", this.InvitationButtonClicked.bindAsEventListener(this) );
        Event.observe( "iconViewButton", "click", this.IconViewButtonClick.bindAsEventListener(this) );
        Event.observe( "relationViewButton", "click", this.RelationViewButtonClick.bindAsEventListener(this) );
        //Event.observe( "partyCalendarButton", "click", PartyCalendar.PartyCalendarButtonClicked.bindAsEventListener(PartyCalendar) );
        Event.observe( "newsButton", "click", this.NewsButtonClick.bindAsEventListener(this) );
    },
    
    SetLoginText: function() { if(IsRoleSuccess()) { $("logoutButton").update("Kilépés"); } else { $("logoutButton").update("Belépés"); } },
    
    LogoutButtonClicked: function(event)
    {
        Event.stop(event);
        if(IsRoleSuccess())
        {
            Login.LogoutButtonClick(event);
            AccountRole = "viewer";
            this.SetLoginText();
        }
        else
        {
            NoRightWindow.Show(event);
        }
    },
    
    PasswordButtonClicked: function(event) { if(IsRoleSuccess()) { Password.ModifyPasswordClicked(event); } else { NoRightWindow.Show(event); } },
    
    InvitationButtonClicked: function(event) { if(IsRoleSuccess()) { Invitation.InvitationClicked(event); } else { NoRightWindow.Show(event); } },
    
    NewsButtonClick: function(event) { Event.stop(event); var news = new News({container: 'content'}); news.Show(); },
    
    ProfileButtonClicked: function(event) { if(IsRoleSuccess()) { Event.stop(event); Profile.LoadTo("content"); } else { NoRightWindow.Show(event); } },
    
    IconViewButtonClick: function(event) { Event.stop(event); IconView.LoadTo("content"); },
    
    RelationViewButtonClick: function(event) { Event.stop(event); RelationView.LoadTo("content", null); }

}))();

