function openparallax()

  config_y = xscreen.bot.y
  local m = newmodalwindow("parallax")

  local shiftall = 150
  parallax_table = {
    {"tiledbackground", 0, 0, 0},
    {"clouds_far", 98, 190, 2},
    {"mountains_far", -93, 161, 3},
    {"background", shiftall  -89, 195, 4},
    {"midground", shiftall -126, 272, 8},
    {"clouds_mid", shiftall +104, 7, 16},
    {"foreground_2", shiftall -132, 93, 16},
    {"foreground_1", shiftall-88, 97, 32},
    {"family", shiftall+352-70, 419-70, 32},
    {"clouds_near", shiftall, -100, 32},
    {"player", shiftall+447-100, 437-70, 33},
    {"rocks", 107, 399, 64},
    {"leaves", 167, 387, 100}
    };

  function smartpar(s, value)
    local res = V(0,0)
    for k,v in pairs({1,2,4,8,16,32,64,128}) do
      if bAND(value, v) > 0 then res = res + V.floor(s * v / 1000.) end
      end
    return res
    end
  
  local phase = 2
  local lastshift = V(0,0)
  local origshift = V(0,0)
  local rett
  
  function m.fullshow()
    if not graphicalUI() then return false end

    local orig = xscreen.ctr - tiles["intro/tiledbackground"].size/2
    local mp = mousepos
    if mp then mp = mp - xscreen.ctr end
    
    local shift

    -- print("phase = "..phase.." ls = "..tostring(lastshift).." mp = "..tostring(mp))
    
    -- phase=0: wait for the mouse
    if phase == 0 and not mp then
      shift = lastshift
    elseif phase == 0 and mp then
      phase = 1
      rett = getticks()
      origshift = lastshift
      end
    
    -- back to phase 0
    if phase > 0 and not mp then
      phase = 0
      shift = lastshift
    
    -- phase 1: smooth transit from lastshift to mp
    elseif phase == 1 then
    
      local t = (getticks() - rett) / 1000
      if t > 1 then t = 1 phase = 2 end
      shift = origshift * (1-t) + mp * t
      lastshift = shift
    
    -- phase 2: use mp
    elseif phase == 2 then
      shift = mp
      lastshift = shift
      end
      
    for k,v in pairs(parallax_table) do
      drawnonscaled(tiles["intro/"..v[1]], V(v[2], v[3]) + orig + smartpar(shift, v[4]), V(0, 0))
      end

    -- size of the viewport
    local windowsize = V(800, 500)

    V.drawtile(Gfx, tileshade(0xC0C0C0), rectXY(0,0, xscreen.bot.x, xscreen.ctr.y - windowsize.y/2))
    V.drawtile(Gfx, tileshade(0xC0C0C0), rectXY(0, xscreen.ctr.y + windowsize.y/2, xscreen.bot.x, xscreen.bot.y))
    V.drawtile(Gfx, tileshade(0xC0C0C0), rectXY(0,0, xscreen.ctr.x - windowsize.x/2, xscreen.bot.y))
    V.drawtile(Gfx, tileshade(0xC0C0C0), rectXY(xscreen.ctr.x + windowsize.x/2, 0, xscreen.bot.x, xscreen.bot.y))

    drawnonscaled(tiles["nterface/main.2.0/Logo"], xscreen.ctr - V(0, 260), align_center)

    return true
    end

  function m.handlemouse(ev)
    if not graphicalUI() then return false end
    return true
    end

  openscreen(m)
  return m
  end
