
function OnNavigateComplete(Object)

	local value=m_simpleTV.Config.GetConfigString(m_simpleTV.Defines.ID_YTV_LOGIN)

	if value~=nil then  m_simpleTV.Config.SetElementValueString(Object,'Login',value) end

	value=m_simpleTV.Config.GetConfigString(m_simpleTV.Defines.ID_YTV_PASS)
	if value~=nil then m_simpleTV.Config.SetElementValueString(Object,'Pass',value) end

	value=m_simpleTV.Config.GetConfigInt(m_simpleTV.Defines.ID_YTV_UPDATEPLSONSTART)
	if value~=nil then m_simpleTV.Config.SetCheckBoxValue(Object,'UpdateOnStart',value) end
  
	value=m_simpleTV.Config.GetConfigInt(m_simpleTV.Defines.ID_YTV_UPDATEPLSONREFRESH)
	if value~=nil then m_simpleTV.Config.SetCheckBoxValue(Object,'UpdateOnRefresh',value) end

               value=m_simpleTV.Config.GetConfigInt(m_simpleTV.Defines.ID_YTV_DELETEBEFORELOAD)
	if value~=nil then m_simpleTV.Config.SetCheckBoxValue(Object,'DeleteBeforeLoad',value) end
	
	value=m_simpleTV.Config.GetConfigInt(m_simpleTV.Defines.ID_EXT_YTV_NOTADDMENU)
  if value==nil then value=0 end
  m_simpleTV.Config.SetCheckBoxValue(Object,'NotAddMenu',value) 

	m_simpleTV.Config.AddEventHandler(Object,'OnClick','ButtonUpdatePlaylist','OnClickButtonUpdatePlaylist')
                m_simpleTV.Config.AddEventHandler(Object,'OnClick','ButtonDeletePlaylist','OnClickButtonDeletePlaylist')

end
------------------------------------------------------------------
function OnOk(Object)

	local value = m_simpleTV.Config.GetElementValueString(Object,'Login')
	if value~=nil then m_simpleTV.Config.SetConfigString(m_simpleTV.Defines.ID_YTV_LOGIN,value) end

	value = m_simpleTV.Config.GetElementValueString(Object,'Pass')
	if value~=nil then m_simpleTV.Config.SetConfigString(m_simpleTV.Defines.ID_YTV_PASS,value) end

	value = m_simpleTV.Config.GetCheckBoxValue(Object,'UpdateOnStart')
	if value~=nil then m_simpleTV.Config.SetConfigInt(m_simpleTV.Defines.ID_YTV_UPDATEPLSONSTART,value) end

	value = m_simpleTV.Config.GetCheckBoxValue(Object,'UpdateOnRefresh')
	if value~=nil then m_simpleTV.Config.SetConfigInt(m_simpleTV.Defines.ID_YTV_UPDATEPLSONREFRESH,value) end

               value = m_simpleTV.Config.GetCheckBoxValue(Object,'DeleteBeforeLoad')
	if value~=nil then m_simpleTV.Config.SetConfigInt(m_simpleTV.Defines.ID_YTV_DELETEBEFORELOAD,value) end

	           value = m_simpleTV.Config.GetCheckBoxValue(Object,'NotAddMenu')
    if value~=nil then m_simpleTV.Config.SetConfigInt(m_simpleTV.Defines.ID_EXT_YTV_NOTADDMENU,value) end
end
------------------------------------------------------------------
function OnClickButtonUpdatePlaylist(Object)

	OnOk(Object)
	dofile(m_simpleTV.MainScriptDir .. 'user\\Viet-Simpletv\\updateplaylist.lua')


end
------------------------------------------------------------------
function OnClickButtonDeletePlaylist(Object)

	OnOk(Object)
	dofile(m_simpleTV.MainScriptDir .. 'user\\Viet-Simpletv\\updateplaylist1.lua')


end
