--get adress
if m_simpleTV.Control.ChangeAdress ~= 'No' then return end

local inAdr =  m_simpleTV.Control.CurrentAdress
if inAdr==nil then return end
   
if (not string.match( inAdr, '^http://inetcom%.tv/channel' )) and (not string.match( inAdr, 'InetcomFreeSid')) then return end

m_simpleTV.Control.ChangeAdress='Yes'
m_simpleTV.Control.CurrentAdress =  ' '

dofile (m_simpleTV.MainScriptDir .. "user\\inetcom\\init.lua")
if m_simpleTV.user.inetcom.init ~= true then return end


 if string.match( inAdr, 'InetcomFreeSid') then 
    local sid = inetcomcore.InetcomGetUrl('http://inetcom.tv/channel/russia_1',true)  
	if sid == nil then return end
		
	sid = findpattern(sid,'sid=(.+)',1,4,0)
	
	if sid == nil then return end
	local retAdr = string.gsub(inAdr,'InetcomFreeSid',sid)
		
	--m_simpleTV.OSD.ShowMessage(retAdr,0x00FF00,2)
	 --debug_in_file(retAdr)
        m_simpleTV.Control.CurrentAdress =  retAdr .. '$OPT:http-reconnect'
	return
 end
 
 local retAdr = inetcomcore.InetcomGetUrl(inAdr,false)  
 if retAdr == nil then return end

 --m_simpleTV.OSD.ShowMessage(retAdr,0x00FF00,2)
 m_simpleTV.Control.CurrentAdress =  retAdr
 

 
 
 