local hm_loaded = false;

function HanulMinimap_OnLoad()
	this:RegisterEvent("PLAYER_ENTERING_WORLD");
	--HanulMinimap_Register();
end

function HanulMinimap_OnEvent()
	if ( event == "PLAYER_ENTERING_WORLD" ) then
		if ( not loaded ) then
			HanulMinimap_SetMask();
			MinimapZoomIn:SetAlpha(0);
			MinimapZoomOut:SetAlpha(0);
			GameTimeFrame:Hide();
			local wheelframe = getglobal("HanulMinimap");
			wheelframe:EnableMouse(false);
			wheelframe:SetPoint("TOPLEFT", Minimap, "TOPLEFT");
			wheelframe:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT");
			wheelframe:EnableMouseWheel(true);
			hm_loaded = true;
		end
	end
end

function HanulMinimap_SetMask()
	MinimapBorderTop:SetTexture("Interface\\AddOns\\HanulMinimap\\HanulMinimapBorder.blp");
	MinimapBorder:SetTexture("Interface\\AddOns\\HanulMinimap\\HanulMinimapBorder.blp");
	Minimap:SetMaskTexture("Interface\\AddOns\\HanulMinimap\\HanulMinimapMask.blp");
end

function HanulMinimap_OnMouseWheel(arg1)
	if not arg1 then return; end

	local z = Minimap:GetZoom();
	if arg1 > 0 and z < 5 then
		Minimap:SetZoom(z + 1);
	elseif arg1 < 0 and z > 0 then
		Minimap:SetZoom(z - 1);
	end
end