function OnNavigateComplete(Object) 

  if m_simpleTV.User.VietTV.VTVPlus ~= nil then
     m_simpleTV.Config.SetElementText(Object, 'Mess', 'VTV Plus login (your email) and password required')
  end

  m_simpleTV.Config.AddEventHandler(Object,'OnClick','btnok','OnClickLoadPls')

end
-----------------------------------------------------------------
function OnClickLoadPls(Object)

m_simpleTV.Config.SetElementText(Object, 'Mess', '')
local login = m_simpleTV.Config.GetElementValueString_UTF8(Object,'login')
local pass = m_simpleTV.Config.GetElementValueString_UTF8(Object,'pass')

if login == nil or pass == nil or login == '' or pass == '' then 
  m_simpleTV.Config.SetElementText(Object, 'Mess', 'Login or password field is empty')
         return 
end

    if not string.match(login,'@') then 
        m_simpleTV.Config.SetElementText(Object, 'Mess', 'VTV Plus - incorrect login data, email required')
      return
    end

local auth = m_simpleTV.MainScriptDir .. 'user\\tvplaylists\\viet\\auth.txt'

local fhandle = io.open (auth , "w+")
if fhandle == nil then return end

   if m_simpleTV.User.VietTV.VTVPlus ~= nil then
      local str = m_simpleTV.User.VietTV.VTVPlus ..':login="' .. login .. '",password="' .. pass .. '"\n'

      fhandle:write(str)
      fhandle:close()
      m_simpleTV.OSD.ShowMessage("VTV Plus: your login and password saved in\n" .. auth ,0xFF00,10)
      m_simpleTV.Dialog.Close(Object)
      m_simpleTV.Common.Wait(3000)
      dofile(m_simpleTV.MainScriptDir .. 'user/tvplaylists/viet/vtvplus.lua')
   end

end
----------------------------------------------------------------


