-------------------------------------------------------------------------------------------------------------
--
-- AzerothAdmin Version 3.x
-- AzerothAdmin is a derivative of TrinityAdmin/MangAdmin.
--
-- Copyright (C) 2007 Free Software Foundation, Inc.
-- License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl-3.0.en.html>
-- This is free software: you are free to change and redistribute it.
-- There is NO WARRANTY, to the extent permitted by law.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
--
-- Repository: https://github.com/superstyro/AzerothAdmin
--
-------------------------------------------------------------------------------------------------------------

--Convention:
-- AzerothAdmin:PrepareScript(*nameofbutton*                    , Locale["*tooltiplocalisation*"]         , function() *functionnameandparameters()* end)

function InitControls()
--[[GM Tab]]
  AzerothAdmin:PrepareScript(ma_displaylevelbutton              , Locale["tt_DisplayAccountLvl"]          , function() AzerothAdminCommands.DisplayAccountLevel() end)
  AzerothAdmin:PrepareScript(ma_gmonbutton                      , Locale["tt_GMOnButton"]                 , function() AzerothAdminCommands.ToggleGMMode("on") end)
  AzerothAdmin:PrepareScript(ma_gmoffbutton                     , Locale["tt_GMOffButton"]                , function() AzerothAdminCommands.ToggleGMMode("off") end)
  AzerothAdmin:PrepareScript(ma_flyonbutton                     , Locale["tt_FlyOnButton"]                , function() AzerothAdminCommands.ToggleFlyMode("on") end)
  AzerothAdmin:PrepareScript(ma_flyoffbutton                    , Locale["tt_FlyOffButton"]               , function() AzerothAdminCommands.ToggleFlyMode("off") end)
  AzerothAdmin:PrepareScript(ma_hoveronbutton                   , Locale["tt_SpectatorOnButton"]           , function() AzerothAdminCommands.ToggleSpectatorMode("on") end)
  AzerothAdmin:PrepareScript(ma_hoveroffbutton                  , Locale["tt_SpectatorOffButton"]          , function() AzerothAdminCommands.ToggleSpectatorMode("off") end)
  AzerothAdmin:PrepareScript(ma_whisperonbutton                 , Locale["tt_WhispOnButton"]              , function() AzerothAdminCommands.ToggleWhisper("on") end)
  AzerothAdmin:PrepareScript(ma_whisperoffbutton                , Locale["tt_WhispOffButton"]             , function() AzerothAdminCommands.ToggleWhisper("off") end)
  AzerothAdmin:PrepareScript(ma_invisibleonbutton               , Locale["tt_InvisOnButton"]              , function() AzerothAdminCommands.ToggleVisible("off") end)
  AzerothAdmin:PrepareScript(ma_invisibleoffbutton              , Locale["tt_InvisOffButton"]             , function() AzerothAdminCommands.ToggleVisible("on") end)
  AzerothAdmin:PrepareScript(ma_cheattaxionbutton               , Locale["tt_TaxiOnButton"]               , function() AzerothAdminCommands.ToggleCheatTaxi("on") end)
  AzerothAdmin:PrepareScript(ma_cheattaxioffbutton              , Locale["tt_TaxiOffButton"]              , function() AzerothAdminCommands.ToggleCheatTaxi("off") end)
  AzerothAdmin:PrepareScript(ma_instantkillbutton               , Locale["tt_instakill"]                  , function() AzerothAdminCommands.InstantKill() end)
  AzerothAdmin:PrepareScript(ma_speedslider                     , Locale["tt_SpeedSlider"]                , {{"OnMouseUp", function() AzerothAdminCommands.SetSpeed() end},{"OnValueChanged", function() ma_speedsliderText:SetText("Speed: "..string.format("%.1f", ma_speedslider:GetValue())) end}})
  AzerothAdmin:PrepareScript(ma_scaleslider                     , Locale["tt_ScaleSlider"]                , {{"OnMouseUp", function() AzerothAdminCommands.SetScale() end},{"OnValueChanged", function() ma_scalesliderText:SetText("Scale: "..string.format("%.1f", ma_scaleslider:GetValue())) end}})
  AzerothAdmin:PrepareScript(ma_screenshotbutton                , Locale["tt_ScreenButton"]               , function() AzerothAdminCommands.Screenie() end)
  AzerothAdmin:PrepareScript(ma_setjail_a_button                , Locale["tt_SetJail_A_Button"]           , function() AzerothAdminCommands.SetJail_A() end)
  AzerothAdmin:PrepareScript(ma_setjail_h_button                , Locale["tt_SetJail_H_Button"]           , function() AzerothAdminCommands.SetJail_H() end)
  AzerothAdmin:PrepareScript(ma_gridnaviaheadbutton             , Locale["tt_N"]                          , function() AzerothAdminCommands.GridNavigate(nil, nil); AzerothAdmin.db.char.nextGridWay = "north" end)
  AzerothAdmin:PrepareScript(ma_gridnavibackbutton              , Locale["tt_S"]                          , function() AzerothAdminCommands.GridNavigate(nil, nil); AzerothAdmin.db.char.nextGridWay = "south" end)
  AzerothAdmin:PrepareScript(ma_gridnavirightbutton             , Locale["tt_E"]                          , function() AzerothAdminCommands.GridNavigate(nil, nil); AzerothAdmin.db.char.nextGridWay = "east" end)
  AzerothAdmin:PrepareScript(ma_gridnavileftbutton              , Locale["tt_W"]                          , function() AzerothAdminCommands.GridNavigate(nil, nil); AzerothAdmin.db.char.nextGridWay = "west" end)
  --AzerothAdmin:PrepareScript(ma_chatonbutton                    , Locale["tt_chatonbutton"]               , function() AzerothAdminCommands.ToggleChat("on") end)
  --AzerothAdmin:PrepareScript(ma_chatoffbutton                   , Locale["tt_chatoffbutton"]              , function() AzerothAdminCommands.ToggleChat("off") end)
  AzerothAdmin:PrepareScript(ma_waterwalkonbutton               , Locale["tt_waterwalkonbutton"]          , function() AzerothAdminCommands.ToggleWaterwalk("on") end)
  AzerothAdmin:PrepareScript(ma_waterwalkoffbutton              , Locale["tt_watewrwalkoffbutton"]        , function() AzerothAdminCommands.ToggleWaterwalk("off") end)
  AzerothAdmin:PrepareScript(ma_cheatcasttimeonbutton           , Locale["tt_cheatcasttimeonbutton"]      , function() AzerothAdminCommands.ToggleCheatCastTime("on") end)
  AzerothAdmin:PrepareScript(ma_cheatcasttimeoffbutton          , Locale["tt_cheatcasttimeoffbutton"]     , function() AzerothAdminCommands.ToggleCheatCastTime("off") end)
  AzerothAdmin:PrepareScript(ma_cheatcooldownonbutton           , Locale["tt_cheatcooldownonbutton"]      , function() AzerothAdminCommands.ToggleCheatCooldown("on") end)
  AzerothAdmin:PrepareScript(ma_cheatcooldownoffbutton          , Locale["tt_cheatcooldownoffbutton"]     , function() AzerothAdminCommands.ToggleCheatCooldown("off") end)
  AzerothAdmin:PrepareScript(ma_cheatgodonbutton                , Locale["tt_cheatgodonbutton"]           , function() AzerothAdminCommands.ToggleCheatGod("on") end)
  AzerothAdmin:PrepareScript(ma_cheatgodoffbutton               , Locale["tt_cheatgodoffbutton"]          , function() AzerothAdminCommands.ToggleCheatGod("off") end)
  AzerothAdmin:PrepareScript(ma_cheatpoweronbutton              , Locale["tt_cheatpoweronbutton"]         , function() AzerothAdminCommands.ToggleCheatPower("on") end)
  AzerothAdmin:PrepareScript(ma_cheatpoweroffbutton             , Locale["tt_cheatpoweroffbutton"]        , function() AzerothAdminCommands.ToggleCheatPower("off") end)
  AzerothAdmin:PrepareScript(ma_cheatstatusbutton               , Locale["tt_cheatstatusbutton"]          , function() AzerothAdminCommands.CheatStatus() end)
  AzerothAdmin:PrepareScript(ma_gmingamebutton                  , Locale["tt_gmingamebutton"]             , function() AzerothAdminCommands.GMInGame() end)
  AzerothAdmin:PrepareScript(ma_gmlistbutton                    , Locale["tt_gmlistbutton"]               , function() AzerothAdminCommands.GMList() end)
  AzerothAdmin:PrepareScript(ma_petcreatebutton                 , Locale["tt_petcreatebutton"]            , function() AzerothAdminCommands.PetCreate() end)
  AzerothAdmin:PrepareScript(ma_petlearnbutton                  , Locale["tt_petlearnbutton"]             , function() AzerothAdminCommands.PetLearn() end)
  AzerothAdmin:PrepareScript(ma_petunlearnbutton                , Locale["tt_petunlearnbutton"]           , function() AzerothAdminCommands.PetUnLearn() end)
  AzerothAdmin:PrepareScript(ma_pettpbutton                     , Locale["tt_pettpbutton"]                , function() AzerothAdminCommands.PetTP() end)
  AzerothAdmin:PrepareScript(ma_lookuptaxibutton                , Locale["tt_lookuptaxibutton"]           , function() AzerothAdminCommands.LookupTaxi() end)
  AzerothAdmin:PrepareScript(ma_gotaxinodebutton                , Locale["tt_gotaxinodebutton"]           , function() AzerothAdminCommands.GoTaxiNode() end)
  AzerothAdmin:PrepareScript(ma_gotriggerbutton                 , Locale["tt_gotriggerbutton"]            , function() AzerothAdminCommands.GoTrigger() end)
  AzerothAdmin:PrepareScript(ma_goxybutton                      , Locale["tt_goxybutton"]                 , function() AzerothAdminCommands.GoXY() end)
  AzerothAdmin:PrepareScript(ma_goxyzbutton                     , Locale["tt_goxyzbutton"]                , function() AzerothAdminCommands.GoXYZ() end)
  AzerothAdmin:PrepareScript(ma_gozonexybutton                  , Locale["tt_gozonexybutton"]             , function() AzerothAdminCommands.GoZoneXY() end)
  AzerothAdmin:PrepareScript(ma_lookupzonebutton                , Locale["tt_lookupzonebutton"]           , function() AzerothAdminCommands.LookupZone() end)
  AzerothAdmin:PrepareScript(ma_castbutton                      , Locale["tt_castbutton"]                 , function() AzerothAdminCommands.Cast() end)
  AzerothAdmin:PrepareScript(ma_castbackbutton                  , Locale["tt_castbackbutton"]             , function() AzerothAdminCommands.CastBack() end)
  AzerothAdmin:PrepareScript(ma_castdistbutton                  , Locale["tt_castdistbutton"]             , function() AzerothAdminCommands.CastDist() end)
  AzerothAdmin:PrepareScript(ma_castselfbutton                  , Locale["tt_castselfbutton"]             , function() AzerothAdminCommands.CastSelf() end)
  AzerothAdmin:PrepareScript(ma_casttargetbutton                , Locale["tt_casttargetbutton"]           , function() AzerothAdminCommands.CastTarget() end)
  AzerothAdmin:PrepareScript(ma_listitembutton                  , Locale["tt_listitembutton"]             , function() AzerothAdminCommands.ListItem() end)
  AzerothAdmin:PrepareScript(ma_charlistdeletedbutton           , Locale["tt_charlistdeleted"]            , function() AzerothAdminCommands.CharListDeleted() end)
  AzerothAdmin:PrepareScript(ma_chardeletedrestorebutton        , Locale["tt_chardeletedrestore"]         , function() AzerothAdminCommands.CharDeletedRestore() end)
  AzerothAdmin:PrepareScript(ma_gmclearbutton                   , Locale["tt_gmclearbutton"]              , function() AzerothAdminCommands.GmClear() end)
  AzerothAdmin:PrepareScript(ma_acctaddonbutton                 , Locale["tt_acctaddonbutton"]            , function() AzerothAdminCommands.AcctAddon() end)
  AzerothAdmin:PrepareScript(ma_acctgmlvlbutton                 , Locale["tt_acctgmlvlbutton"]            , function() AzerothAdminCommands.AcctGMLvl() end)
  AzerothAdmin:PrepareScript(ma_gmnotifybutton                  , Locale["tt_gmnotifybutton"]             , function() AzerothAdminCommands.GMNotify() end)
  AzerothAdmin:PrepareScript(ma_acctchangebutton                , Locale["tt_acctchangebutton"]           , function() AzerothAdminCommands.AcctChange() end)
  AzerothAdmin:PrepareScript(ma_teleaddbutton                   , Locale["tt_teleaddbutton"]              , function() AzerothAdminCommands.TeleAddButton() end)
  AzerothAdmin:PrepareScript(ma_teledelbutton                   , Locale["tt_teledelbutton"]              , function() AzerothAdminCommands.TeleDelButton() end)
  AzerothAdmin:PrepareScript(ma_speedsliderreset_button         , Locale["tt_SpeedSliderReset"]           , function() AzerothAdminCommands.ResetSpeed() end)
  AzerothAdmin:PrepareScript(ma_scalesliderreset_button         , Locale["tt_ScaleSliderReset"]           , function() AzerothAdminCommands.ResetScale() end)

  -- Speed Slider
  ma_speedslider:SetOrientation("HORIZONTAL")
  ma_speedslider:SetMinMaxValues(.5, 30)
  ma_speedslider:SetValueStep(0.5)
  ma_speedslider:SetValue(1)
  ma_speedsliderText:SetText("Speed: 1.0")
  ma_speedslider:EnableMouseWheel(true)
  ma_speedslider:SetScript("OnMouseWheel", function(self, delta)
    local min, max = self:GetMinMaxValues()
    local newVal = self:GetValue() + (delta * 0.5)
    if newVal < min then newVal = min end
    if newVal > max then newVal = max end
    self:SetValue(newVal)
    AzerothAdminCommands.SetSpeed()
  end)
  -- Scale Slider
  ma_scaleslider:SetOrientation("HORIZONTAL")
  ma_scaleslider:SetMinMaxValues(0.1 , 10)
  ma_scaleslider:SetValueStep(0.1)
  ma_scaleslider:SetValue(1)
  ma_scalesliderText:SetText("Scale: 1.0")
  ma_scaleslider:EnableMouseWheel(true)
  ma_scaleslider:SetScript("OnMouseWheel", function(self, delta)
    local min, max = self:GetMinMaxValues()
    local newVal = self:GetValue() + (delta * 0.5)
    if newVal < min then newVal = min end
    if newVal > max then newVal = max end
    self:SetValue(newVal)
    AzerothAdminCommands.SetScale()
  end)

--[[Char Tab]]
  AzerothAdminCommands.InitModelFrame()
  AzerothAdmin:PrepareScript(ma_modelrotatelbutton              , Locale["tt_RotateLeft"]                 , function() AzerothAdminCommands.ModelRotateLeft() end)
  AzerothAdmin:PrepareScript(ma_modelrotaterbutton              , Locale["tt_RotateRight"]                , function() AzerothAdminCommands.ModelRotateRight() end)
  AzerothAdmin:PrepareScript(ma_killbutton                      , Locale["tt_killbutton"]                 , function() AzerothAdminCommands.KillSomething() end)
  AzerothAdmin:PrepareScript(ma_revivebutton                    , Locale["tt_reviveplayer"]               , function() AzerothAdminCommands.RevivePlayer() end)
  AzerothAdmin:PrepareScript(ma_savebutton                      , Locale["tt_saveplayer"]                 , function() AzerothAdminCommands.SavePlayer() end)
  AzerothAdmin:PrepareScript(ma_kickbutton                      , Locale["tt_KickButton"]                 , function() AzerothAdminCommands.KickPlayer() end)
  AzerothAdmin:PrepareScript(ma_cooldownbutton                  , Locale["tt_CooldownButton"]             , function() AzerothAdminCommands.Cooldown() end)
  AzerothAdmin:PrepareScript(ma_guidbutton                      , Locale["tt_GUIDButton"]                 , function() AzerothAdminCommands.ShowGUID() end)
  AzerothAdmin:PrepareScript(ma_pinfobutton                     , Locale["tt_PinfoButton"]                , function() AzerothAdminCommands.Pinfo() end)
  AzerothAdmin:PrepareScript(ma_distancebutton                  , Locale["tt_DistanceButton"]             , function() AzerothAdminCommands.Distance() end)
  AzerothAdmin:PrepareScript(ma_recallbutton                    , Locale["tt_RecallButton"]               , function() AzerothAdminCommands.Recall() end)
  AzerothAdmin:PrepareScript(ma_demorphbutton                   , Locale["tt_DemorphButton"]              , function() AzerothAdminCommands.Demorph() end)
  AzerothAdmin:PrepareScript(ma_gpsbutton                       , Locale["tt_GPSButton"]                  , function() AzerothAdminCommands.GPS() end)
  AzerothAdmin:PrepareScript(ma_learnlangbutton                 , Locale["tt_learnlangbutton"]            , function() AzerothAdminCommands.LearnSpell(UIDropDownMenu_GetSelectedValue(ma_learnlangdropdown)) end)
  AzerothAdmin:PrepareScript(ma_modifybutton                    , Locale["tt_modifybutton"]               , function() AzerothAdminCommands.Modify(UIDropDownMenu_GetSelectedValue(ma_modifydropdown),ma_modifyeditbox:GetText()) end)
  AzerothAdmin:PrepareScript(ma_resetbutton                     , Locale["tt_resetbutton"]                , function() AzerothAdminCommands.Reset(UIDropDownMenu_GetSelectedValue(ma_resetdropdown)) end)
  AzerothAdmin:PrepareScript(ma_modelzoominbutton               , Locale["tt_modelzoominbutton"]          , function() AzerothAdminCommands.CharModelZoomIn() end)
  AzerothAdmin:PrepareScript(ma_modelzoomoutbutton              , Locale["tt_modelzoomoutbutton"]         , function() AzerothAdminCommands.CharModelZoomOut() end)
  AzerothAdmin:PrepareScript(ma_charbindsight                   , Locale["tt_charbindsight"]              , function() AzerothAdminCommands.CharBindSight() end)
  AzerothAdmin:PrepareScript(ma_charunbindsight                 , Locale["tt_charunbindsight"]            , function() AzerothAdminCommands.CharUnBindSight() end)
  AzerothAdmin:PrepareScript(ma_charrenamebutton                , Locale["tt_charrename"]                 , function() AzerothAdminCommands.CharRename() end)
  AzerothAdmin:PrepareScript(ma_charcustomizebutton             , Locale["tt_charcustomize"]              , function() AzerothAdminCommands.CharCustomize() end)
  AzerothAdmin:PrepareScript(ma_charchangeracebutton            , Locale["tt_charchangerace"]             , function() AzerothAdminCommands.CharChangeRace() end)
  AzerothAdmin:PrepareScript(ma_charchangefactionbutton         , Locale["tt_charchnagefaction"]          , function() AzerothAdminCommands.CharChangeFaction() end)
  AzerothAdmin:PrepareScript(ma_charcombatstopbutton            , Locale["tt_charcombatstop"]             , function() AzerothAdminCommands.CharCombatStop() end)
  AzerothAdmin:PrepareScript(ma_charmaxskillbutton              , Locale["tt_charmaxskill"]               , function() AzerothAdminCommands.CharMaxSkill() end)
  AzerothAdmin:PrepareScript(ma_charfreezebutton                , Locale["tt_charfreeze"]                 , function() AzerothAdminCommands.CharFreeze() end)
  AzerothAdmin:PrepareScript(ma_charunfreezebutton              , Locale["tt_charunfreeze"]               , function() AzerothAdminCommands.CharUnFreeze() end)
  AzerothAdmin:PrepareScript(ma_charpossessbutton               , Locale["tt_charpossess"]                , function() AzerothAdminCommands.CharPossess() end)
  AzerothAdmin:PrepareScript(ma_charunpossessbutton             , Locale["tt_charunpossess"]              , function() AzerothAdminCommands.CharUnPossess() end)
  AzerothAdmin:PrepareScript(ma_charrepairitemsbutton           , Locale["tt_charrepair"]                 , function() AzerothAdminCommands.CharRepair() end)
  AzerothAdmin:PrepareScript(ma_bankbutton                      , Locale["tt_BankButton"]                 , function() AzerothAdminCommands.ShowBank() end)
  AzerothAdmin:PrepareScript(ma_checkbagbutton                  , Locale["tt_CheckBagButton"]             , function() AzerothAdminCommands.CheckBagButton() end)
  AzerothAdmin:PrepareScript(ma_checkprofessionbutton            , Locale["tt_CheckProfessionButton"]      , function() AzerothAdminCommands.CheckProfessionButton() end)
  AzerothAdmin:PrepareScript(ma_dismountbutton                  , Locale["tt_Dismount"]                   , function() AzerothAdminCommands.DismountPlayer() end)

  AzerothAdminCommands.LearnDropDownInitialize()
  UIDropDownMenu_Initialize(ma_learnlangdropdown , AzerothAdminCommands.LearnDropDownInitialize)
  UIDropDownMenu_SetWidth(ma_learnlangdropdown          , 80)
  UIDropDownMenu_SetButtonWidth(ma_learnlangdropdown    , 20)
  UIDropDownMenu_SetSelectedValue(ma_learnlangdropdown, "all_crafts")
  AzerothAdminCommands.ModifyDropDownInitialize()
  UIDropDownMenu_Initialize(ma_modifydropdown , AzerothAdminCommands.ModifyDropDownInitialize)
  UIDropDownMenu_SetWidth(ma_modifydropdown             , 80)
  UIDropDownMenu_SetButtonWidth(ma_modifydropdown       , 20)
  UIDropDownMenu_SetSelectedValue(ma_modifydropdown, "aspeed")
  AzerothAdminCommands.ResetDropDownInitialize()
  UIDropDownMenu_Initialize(ma_resetdropdown , AzerothAdminCommands.ResetDropDownInitialize)
  UIDropDownMenu_SetWidth(ma_resetdropdown              , 80)
  UIDropDownMenu_SetButtonWidth(ma_resetdropdown        , 20)
  UIDropDownMenu_SetSelectedValue(ma_resetdropdown, "honor")

  UIDropDownMenu_Initialize(ma_bandropdown , AzerothAdminCommands.BanDropDownInitialize)
  UIDropDownMenu_SetWidth(ma_bandropdown               , 80)
  UIDropDownMenu_SetButtonWidth(ma_bandropdown         , 20)
  UIDropDownMenu_SetSelectedValue(ma_bandropdown, "character")

  AzerothAdmin:PrepareScript(ma_banbutton                       , Locale["tt_banbutton"]                  , function() AzerothAdminCommands.BanButton(UIDropDownMenu_GetSelectedValue(ma_bandropdown)) end)
  AzerothAdmin:PrepareScript(ma_gonamebutton                    , Locale["tt_gonamebutton"]               , function() AzerothAdminCommands.GoNameButton() end)
  AzerothAdmin:PrepareScript(ma_createguildbutton               , Locale["tt_createguildbutton"]          , function() AzerothAdminCommands.CreateGuildButton() end)
  AzerothAdmin:PrepareScript(ma_baninfobutton                   , Locale["tt_baninfobutton"]              , function() AzerothAdminCommands.BanInfoButton(UIDropDownMenu_GetSelectedValue(ma_bandropdown)) end)
  AzerothAdmin:PrepareScript(ma_groupgobutton                   , Locale["tt_groupgobutton"]              , function() AzerothAdminCommands.GroupGoButton() end)
  AzerothAdmin:PrepareScript(ma_guildinvitebutton               , Locale["tt_guildinvitebutton"]          , function() AzerothAdminCommands.GuildInviteButton() end)
  AzerothAdmin:PrepareScript(ma_banlistbutton                   , Locale["tt_banlistbutton"]              , function() AzerothAdminCommands.BanlistButton(UIDropDownMenu_GetSelectedValue(ma_bandropdown)) end)
  AzerothAdmin:PrepareScript(ma_namegobutton                    , Locale["tt_namegobutton"]               , function() AzerothAdminCommands.NameGoButton() end)
  AzerothAdmin:PrepareScript(ma_guildrankbutton                 , Locale["tt_guildrankbutton"]            , function() AzerothAdminCommands.GuildRankButton() end)
  AzerothAdmin:PrepareScript(ma_telegroupbutton                 , Locale["tt_telegroupbutton"]            , function() AzerothAdminCommands.TeleGroupButton() end)
  AzerothAdmin:PrepareScript(ma_unbanbutton                     , Locale["tt_unbanbutton"]                , function() AzerothAdminCommands.UnBanButton(UIDropDownMenu_GetSelectedValue(ma_bandropdown)) end)
  AzerothAdmin:PrepareScript(ma_guilddeletebutton               , Locale["tt_guilddeletebutton"]          , function() AzerothAdminCommands.GuildDeleteButton() end)
  AzerothAdmin:PrepareScript(ma_guilduninvitebutton             , Locale["tt_guilduninvitebutton"]        , function() AzerothAdminCommands.GuildUninviteButton() end)
  AzerothAdmin:PrepareScript(ma_telenamebutton                  , Locale["tt_telenamebutton"]             , function() AzerothAdminCommands.TeleNameButton() end)
  AzerothAdmin:PrepareScript(ma_mutebutton                      , Locale["tt_mutebutton"]                 , function() AzerothAdminCommands.MuteButton() end)
  AzerothAdmin:PrepareScript(ma_charmorphbutton                 , Locale["tt_charmorphbutton"]            , function() AzerothAdminCommands.CharMorphButton() end)
  AzerothAdmin:PrepareScript(ma_charaurabutton                  , Locale["tt_charaurabutton"]             , function() AzerothAdminCommands.CharAuraButton() end)
  AzerothAdmin:PrepareScript(ma_charunaurabutton                , Locale["tt_charunaurabutton"]           , function() AzerothAdminCommands.CharUnAuraButton() end)
  AzerothAdmin:PrepareScript(ma_jailabutton                     , Locale["tt_JailAButton"]                , function() AzerothAdminCommands.JailA() end)
  AzerothAdmin:PrepareScript(ma_jailhbutton                     , Locale["tt_JailHButton"]                , function() AzerothAdminCommands.JailH() end)
  AzerothAdmin:PrepareScript(ma_unjailbutton                    , Locale["tt_UnJailButton"]               , function() AzerothAdminCommands.UnJail() end)
  AzerothAdmin:PrepareScript(ma_unmutebutton                    , Locale["tt_UnMuteButton"]               , function() AzerothAdminCommands.UnMuteButton() end)
  AzerothAdmin:PrepareScript(ma_damagebutton                    , Locale["tt_DamageButton"]               , function() AzerothAdminCommands.DamageButton() end)
  AzerothAdmin:PrepareScript(ma_hideareabutton                  , Locale["tt_HideAreaButton"]             , function() AzerothAdminCommands.HideAreaButton() end)
  AzerothAdmin:PrepareScript(ma_showareabutton                  , Locale["tt_ShowAreaButton"]             , function() AzerothAdminCommands.ShowAreaButton() end)
  AzerothAdmin:PrepareScript(ma_charclearbutton                 , Locale["tt_gmclearbutton"]              , function() AzerothAdminCommands.CharClearParams() end)

--[[NPC Tab]]
  AzerothAdminCommands.InitModelFrameNPC()
  AzerothAdmin:PrepareScript(ma_npcmodelrotatelbutton           , Locale["tt_NPCRotateLeft"]              , function() AzerothAdminCommands.NpcModelRotateLeft() end)
  AzerothAdmin:PrepareScript(ma_npcmodelrotaterbutton           , Locale["tt_NPCRotateRight"]             , function() AzerothAdminCommands.NpcModelRotateRight() end)
  AzerothAdmin:PrepareScript(ma_npckillbutton                   , Locale["tt_NPCKillButton"]              , function() AzerothAdminCommands.NPCKillSomething() end)
  AzerothAdmin:PrepareScript(ma_respawnbutton                   , Locale["tt_npcrespawn"]                 , function() AzerothAdminCommands.Respawn() end)
  AzerothAdmin:PrepareScript(ma_npcdistancebutton               , Locale["tt_NPCDistanceButton"]          , function() AzerothAdminCommands.NPCDistance() end)
  AzerothAdmin:PrepareScript(ma_NPCEntryIDButton                , Locale["tt_NPCEntryIDButton"]           , function() AzerothAdminCommands.NPCShowGUID() end)
  AzerothAdmin:PrepareScript(ma_npcinfobutton                   , Locale["tt_NPCInfoButton"]              , function() AzerothAdminCommands.NPCInfo() end)
  AzerothAdmin:PrepareScript(ma_npcdemorphbutton                , Locale["tt_NPCDemorph"]                 , function() AzerothAdminCommands.NPCDemorph() end)
  AzerothAdmin:PrepareScript(ma_npcmovebutton                   , Locale["tt_NPCMove"]                    , function() AzerothAdminCommands.NPCMove() end)
  AzerothAdmin:PrepareScript(ma_npcdelbutton                    , Locale["tt_NPCDel"]                     , function() AzerothAdminCommands.NPCDel() end)
  AzerothAdmin:PrepareScript(ma_NPC_guidgetbutton               , Locale["tt_getguid"]                    , function() AzerothAdminCommands.NPC_GUID_Get() end)
  AzerothAdmin:PrepareScript(ma_NPC_addbutton                   , Locale["tt_NPCAdd"]                     , function() AzerothAdminCommands.NPC_Add() end)
  AzerothAdmin:PrepareScript(ma_NPC_addIDbutton                 , Locale["tt_NPCAddID"]                   , function() AzerothAdminCommands.NPC_AddID() end)
  AzerothAdmin:PrepareScript(ma_npcgobutton                     , Locale["tt_NPCGo"]                      , function() AzerothAdminCommands.NPCGo() end)
  AzerothAdmin:PrepareScript(ma_npcmorphbutton                  , Locale["tt_NPCMorph"]                   , function() AzerothAdminCommands.NPCMorph() end)
  AzerothAdmin:PrepareScript(ma_npcsaybutton                    , Locale["tt_NPCSay"]                     , function() AzerothAdminCommands.NPCSay() end)
  AzerothAdmin:PrepareScript(ma_npcyellbutton                   , Locale["tt_NPCYell"]                    , function() AzerothAdminCommands.NPCYell() end)
  AzerothAdmin:PrepareScript(ma_npcaurabutton                   , Locale["tt_NPCAura"]                    , function() AzerothAdminCommands.NPCAura() end)
  AzerothAdmin:PrepareScript(ma_npcunaurabutton                 , Locale["tt_NPCUnaura"]                  , function() AzerothAdminCommands.NPCUnaura() end)
  AzerothAdmin:PrepareScript(ma_npcemotebutton                  , Locale["tt_PlayEmote"]                  , function() AzerothAdminCommands.NpcEmote(UIDropDownMenu_GetSelectedValue(ma_npcemotedropdown)) end)
  AzerothAdmin:PrepareScript(ma_npcemotebutton_a                , Locale["tt_PlayEmote"]                  , function() AzerothAdminCommands.NpcEmote(UIDropDownMenu_GetSelectedValue(ma_npcemotedropdown_a)) end)
  AzerothAdmin:PrepareScript(ma_npcdisplayupbutton              , Locale["tt_DisplayUp"]                  , function() AzerothAdminCommands.DisplayUP() end)
  AzerothAdmin:PrepareScript(ma_npcdisplaydownbutton            , Locale["tt_DisplayDown"]                , function() AzerothAdminCommands.DisplayDown() end)
  AzerothAdmin:PrepareScript(ma_npcID_UPbutton                  , Locale["tt_IDUp"]                       , function() AzerothAdminCommands.ID_UP() end)
  AzerothAdmin:PrepareScript(ma_npcID_DOWNbutton                , Locale["tt_IDDown"]                     , function() AzerothAdminCommands.ID_DOWN() end)
  AzerothAdmin:PrepareScript(ma_npcclearbutton                  , Locale["tt_NPCClear"]                   , function() AzerothAdminCommands.NPCClear() end)
  AzerothAdmin:PrepareScript(ma_npcmodelzoominbutton            , Locale["tt_npcmodelzoominbutton"]       , function() AzerothAdminCommands.NPCModelZoomIn() end)
  AzerothAdmin:PrepareScript(ma_npcmodelzoomoutbutton           , Locale["tt_npcmodelzoomoutbutton"]      , function() AzerothAdminCommands.NPCModelZoomOut() end)
  AzerothAdmin:PrepareScript(ma_npcbindsight                    , Locale["tt_npcbindsight"]               , function() AzerothAdminCommands.NPCBindSight() end)
  AzerothAdmin:PrepareScript(ma_npcunbindsight                  , Locale["tt_npcunbindsight"]             , function() AzerothAdminCommands.NPCUnBindSight() end)
  AzerothAdmin:PrepareScript(ma_npccometomebutton               , Locale["tt_npccometome"]                , function() AzerothAdminCommands.NPCComeToMe() end)
  AzerothAdmin:PrepareScript(ma_npcpossessbutton                , Locale["tt_npcpossess"]                 , function() AzerothAdminCommands.NPCPossess() end)
  AzerothAdmin:PrepareScript(ma_npcunpossessbutton              , Locale["tt_npcunpossess"]               , function() AzerothAdminCommands.NPCUnPossess() end)
  AzerothAdmin:PrepareScript(ma_npcfreezebutton                 , Locale["tt_NPCFreezeButton"]            , function() AzerothAdminCommands.NPCFreeze() end)
  AzerothAdmin:PrepareScript(ma_npcfreezedelbutton              , Locale["tt_NPCFreezeDelButton"]         , function() AzerothAdminCommands.NPCFreezeDEL() end)
  AzerothAdmin:PrepareScript(ma_npcclearparamsbutton            , Locale["tt_gmclearbutton"]              , function() AzerothAdminCommands.NpcClearParams() end)
  AzerothAdmin:PrepareScript(ma_way_endaddbutton                , Locale["tt_WayEndAdd"]                  , function() AzerothAdminCommands.WayEndAdd() end)
  AzerothAdmin:PrepareScript(ma_npcunfreeze_addwaybutton        , Locale["tt_NPCAddWay"]                  , function() AzerothAdminCommands.NPCAdd_Way() end)
  AzerothAdmin:PrepareScript(ma_way_modifyaddbutton             , Locale["tt_WayMAdd"]                    , function() AzerothAdminCommands.WayModifyAdd() end)
  AzerothAdmin:PrepareScript(ma_way_modifydelbutton             , Locale["tt_WayModifyDel"]               , function() AzerothAdminCommands.WayModifyDel() end)
  AzerothAdmin:PrepareScript(ma_way_showonbutton                , Locale["tt_WayShow1"]                   , function() AzerothAdminCommands.WayShowOn() end)
  AzerothAdmin:PrepareScript(ma_way_showoffbutton               , Locale["tt_WayShow0"]                   , function() AzerothAdminCommands.WayShowOff() end)
  AzerothAdmin:PrepareScript(ma_npcunfreeze_addway_showonbutton , Locale["tt_NPCAdd_WayShowOn"]           , function() AzerothAdminCommands.NPCAdd_WayShowOn() end)
  AzerothAdmin:PrepareScript(ma_npcunfreeze_waybutton           , Locale["tt_NPCUnFreeze_WayButton"]      , function() AzerothAdminCommands.NPCUnFreeze_Way() end)
  AzerothAdmin:PrepareScript(ma_npcunfreeze_randombutton        , Locale["tt_NPCUnFreeze_RandomButton"]   , function() AzerothAdminCommands.NPCUnFreeze_Random() end)
  AzerothAdmin:PrepareScript(ma_movestackbutton                 , Locale["tt_MoveStackButton"]            , function() AzerothAdminCommands.ShowMove() end)

--[[Gob Tab]]
  AzerothAdmin:PrepareScript(ma_objgobutton                     , Locale["tt_ObjGo"]                      , function() AzerothAdminCommands.OBJGo() end)
  AzerothAdmin:PrepareScript(ma_objaddbutton                    , Locale["tt_ObjAdd"]                     , function() AzerothAdminCommands.OBJAdd() end)
  AzerothAdmin:PrepareScript(ma_objmovebutton                   , Locale["tt_ObjMove"]                    , function() AzerothAdminCommands.OBJMove() end)
  AzerothAdmin:PrepareScript(ma_objturnbutton                   , Locale["tt_ObjTurn"]                    , function() AzerothAdminCommands.OBJTurn() end)
  AzerothAdmin:PrepareScript(ma_objdelbutton                    , Locale["tt_ObjDel"]                     , function() AzerothAdminCommands.OBJDel() end)
  AzerothAdmin:PrepareScript(ma_objnearbutton                   , Locale["tt_ObjNear"]                    , function() AzerothAdminCommands.OBJNear() end)
  AzerothAdmin:PrepareScript(ma_objtargetbutton                 , Locale["tt_ObjTarget"]                  , function() AzerothAdminCommands.OBJTarget() end)
  AzerothAdmin:PrepareScript(ma_gobactivatebutton               , Locale["tt_ObjActivate"]                , function() AzerothAdminCommands.OBJActivate() end)
  AzerothAdmin:PrepareScript(ma_gobaddtempbutton                , Locale["tt_ObjAddTemp"]                 , function() AzerothAdminCommands.OBJAddTemp() end)
  AzerothAdmin:PrepareScript(ma_gobinfobutton                   , Locale["tt_ObjInfo"]                    , function() AzerothAdminCommands.OBJInfo() end)
  AzerothAdmin:PrepareScript(ma_gobclearinfobutton              , Locale["tt_ObjClearInfo"]               , function() AzerothAdminCommands.OBJClearInfo() end)
  AzerothAdmin:PrepareScript(ma_gobsetphasebutton               , Locale["tt_ObjSetPhase"]                , function() AzerothAdminCommands.OBJSetPhase() end)
  AzerothAdmin:PrepareScript(ma_gobshowmodel                    , Locale["tt_ObjShowModel"]               , function() AzerothAdminCommands.LoadAndShowGobModel() end)
  AzerothAdmin:PrepareScript(ma_gobunloadmodel                  , Locale["tt_ObjUnloadModel"]             , function() AzerothAdminCommands.UnloadModels() end)
  AzerothAdminCommands.InitGobModelFrame()
  AzerothAdminCommands.InitGobButtonStates()
  AzerothAdmin:PrepareScript(ma_gobmodelrotatelbutton           , Locale["tt_ObjRotateLeft"]              , function() AzerothAdminCommands.GobModelRotateLeft() end)
  AzerothAdmin:PrepareScript(ma_gobmodelrotaterbutton           , Locale["tt_ObjRotateRight"]             , function() AzerothAdminCommands.GobModelRotateRight() end)
  AzerothAdmin:PrepareScript(ma_gobmodelzoominbutton            , Locale["tt_ObjModelzoominbutton"]       , function() AzerothAdminCommands.GobModelZoomIn() end)
  AzerothAdmin:PrepareScript(ma_gobmodelzoomoutbutton           , Locale["tt_ObjModelzoomoutbutton"]      , function() AzerothAdminCommands.GobModelZoomOut() end)
  AzerothAdmin:PrepareScript(ma_gobmoveforwardbutton            , Locale["tt_ObjMoveForward"]             , function() AzerothAdminCommands.DMFront() end)
  AzerothAdmin:PrepareScript(ma_gobmovebackbutton               , Locale["tt_ObjMoveBack"]                , function() AzerothAdminCommands.DMBack() end)
  AzerothAdmin:PrepareScript(ma_gobmoveleftbutton               , Locale["tt_ObjMoveLeft"]                , function() AzerothAdminCommands.DMLeft() end)
  AzerothAdmin:PrepareScript(ma_gobmoverightbutton              , Locale["tt_ObjMoveRight"]               , function() AzerothAdminCommands.DMRight() end)
  AzerothAdmin:PrepareScript(ma_gobmoveupbutton                 , Locale["tt_ObjMoveUp"]                  , function() AzerothAdminCommands.DMUP() end)
  AzerothAdmin:PrepareScript(ma_gobmovedownbutton               , Locale["tt_ObjMoveDown"]                , function() AzerothAdminCommands.DMDown() end)
  AzerothAdmin:PrepareScript(ma_gobspawnherebutton              , Locale["tt_ObjSpawnHere"]               , function() AzerothAdminCommands.DMSS2() end)
  AzerothAdmin:PrepareScript(ma_spawnonmovecheck                , nil                                     , function() AzerothAdminCommands.CheckToggle("spawn") end)
  AzerothAdmin:PrepareScript(ma_moveonmovecheck                 , nil                                     , function() AzerothAdminCommands.CheckToggle("move") end)

--[[Tele Tab]]
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry1             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "EK_N"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry2             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "EK_S"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry3             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "K"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry4             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "Ou"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry5             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "N_A"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry6             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "N_H"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry7             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "BG"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry8             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "I_EK"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry9             , nil                                     , function() AzerothAdmin.db.char.selectedCont = "I_K"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry10            , nil                                     , function() AzerothAdmin.db.char.selectedCont = "I_O"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry11            , nil                                     , function() AzerothAdmin.db.char.selectedCont = "I_N"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)
  AzerothAdmin:PrepareScript(ma_ContScrollBarEntry12            , nil                                     , function() AzerothAdmin.db.char.selectedCont = "OT"; cont=AzerothAdmin.db.char.selectedCont; AzerothAdminCommands.TeleScrollUpdate() end)

--[[Tickets Tab]]
  AzerothAdmin:PrepareScript(ma_tabbutton_ticket                , Locale["tt_TicketButton"]               , function() AzerothAdminCommands.ShowTicketTab() end)
  AzerothAdmin:PrepareScript(ma_resetticketsbutton              , Locale["tt_LoadTickets"]                , function() AzerothAdminCommands.RefreshTickets() end)
  AzerothAdmin:PrepareScript(ma_deleteticketbutton              , Locale["tt_DeleteTicket"]               , function() AzerothAdminCommands.Ticket("delete") end)
  AzerothAdmin:PrepareScript(ma_answerticketbutton              , Locale["tt_AnswerTicket"]               , function() AzerothAdminCommands.Ticket("answer") end)
  AzerothAdmin:PrepareScript(ma_getcharticketbutton             , Locale["tt_GetCharTicket"]              , function() AzerothAdminCommands.Ticket("getchar") end)
  AzerothAdmin:PrepareScript(ma_gocharticketbutton              , Locale["tt_GoCharTicket"]               , function() AzerothAdminCommands.Ticket("gochar") end)
  AzerothAdmin:PrepareScript(ma_whisperticketbutton             , Locale["tt_WhisperTicket"]              , function() AzerothAdminCommands.Ticket("whisper") end)
  AzerothAdmin:PrepareScript(ma_goticketbutton                  , Locale["tt_GoTicket"]                   , function() AzerothAdminCommands.Ticket("goticket") end)

--[[Misc Tab]]
  AzerothAdmin:PrepareScript(ma_checktransparencybutton         , nil                                     , function() AzerothAdminCommands.ToggleTransparencyCheckbox() end)
  AzerothAdmin:PrepareScript(ma_checklocalsearchstringsbutton   , nil                                     , function() AzerothAdminCommands.ToggleLocalSearchStringsCheckbox() end)
  AzerothAdmin:PrepareScript(ma_showchatoutputbutton            , nil                                     , function() AzerothAdminCommands.ToggleShowChatOutputCheckbox() end)
  AzerothAdmin:PrepareScript(ma_showminimapbutton               , nil                                     , function() AzerothAdminCommands.ToggleMinimapButtonCheckbox() end)
  AzerothAdmin:PrepareScript(ma_bgcolorshowbutton               , nil                                     , function() AzerothAdminCommands.ShowColorPicker("bg") end)
  AzerothAdmin:PrepareScript(ma_frmcolorshowbutton              , nil                                     , function() AzerothAdminCommands.ShowColorPicker("frm") end)
  AzerothAdmin:PrepareScript(ma_btncolorshowbutton              , nil                                     , function() AzerothAdminCommands.ShowColorPicker("btn") end)
  AzerothAdmin:PrepareScript(ma_linkifiercolorbutton            , nil                                     , function() AzerothAdminCommands.ShowColorPicker("linkifier") end)
  AzerothAdmin:PrepareScript(ma_showminimenubutton              , nil                                     , function() AzerothAdminCommands.ToggleMinimenuCheckbox() end)
  AzerothAdmin:PrepareScript(ma_showtooltipsbutton              , nil                                     , function() AzerothAdminCommands.ToggleTooltipsCheckbox() end)
  AzerothAdmin:PrepareScript(ma_instantteleportbutton           , nil                                     , function() AzerothAdminCommands.ToggleInstantTeleport() end)
  AzerothAdmin:PrepareScript(ma_updatechangesbutton             , Locale["tt_updatechanges"]              , function() AzerothAdminCommands.UpdateChanges() end)
  AzerothAdmin:PrepareScript(ma_ApplyWeatherButton              , Locale["tt_ApplyWeatherButton"]         , function() AzerothAdminCommands.ChangeWeather(UIDropDownMenu_GetSelectedValue(ma_weatherdropdown)) end)

--[[Server Tab]]
  AzerothAdmin:PrepareScript(ma_announcebutton                  , Locale["tt_AnnounceButton"]             , function() AzerothAdminCommands.Announce(ma_announceeditbox:GetText()) end)
  AzerothAdmin:PrepareScript(ma_resetannouncebutton             , nil                                     , function() ma_announceeditbox:SetText("") end)
  AzerothAdmin:PrepareScript(ma_restartbutton                   , Locale["tt_RestartButton"]              , function() AzerothAdminCommands.Restart(ma_shutdowneditbox:GetText()) end)
  AzerothAdmin:PrepareScript(ma_shutdownbutton                  , Locale["tt_ShutdownButton"]             , function() AzerothAdminCommands.Shutdown(ma_shutdowneditbox:GetText()) end)
  AzerothAdmin:PrepareScript(ma_cancelshutdownbutton            , Locale["tt_CancelShutdownButton"]       , function() AzerothAdminCommands.CancelShutdown() end)
  AzerothAdmin:PrepareScript(ma_loadtablebutton                 , Locale["tt_ReloadTableButton"]          , function() AzerothAdminCommands.ReloadTable(UIDropDownMenu_GetSelectedValue(ma_reloadtabledropdown)) end)
  AzerothAdmin:PrepareScript(ma_loadscriptsbutton               , Locale["tt_ReloadScriptsButton"]        , function() AzerothAdminCommands.ReloadScripts() end)
  AzerothAdmin:PrepareScript(ma_updatedelaybutton               , nil                                     , function()
    if ma_delayparam then
      AzerothAdmin.db.profile.style.delayparam = ma_delayparam:GetText()
      AzerothAdmin:Print("Update frequency saved: " .. ma_delayparam:GetText())
    end
  end)

--[[Log Tab]]
end
