function ietab_embed(hwnd)
    url=prompt("Open page in IE engine","IE engine","http://")
    if url then
    	url="chrome://plugin/ietab.html?url="..url 
    	km.NavigateTo(url,OPEN_NEWTAB)
    end
end

function ietab(hwnd)
    local title, url = GetDocInfo(hwnd)
    url="chrome://plugin/ietab.html?url="..url
    km.NavigateTo(url,OPEN_NEWTAB)
end


function ietab_link(hwnd)
    local url = GetGlobalVar(TYPE_STRING, "LinkURL")
    url="chrome://plugin/ietab.html?url="..url
    km.NavigateTo(url,OPEN_NEWTAB)
end

function ietab_selected(hwnd)
    local old, new
    old = km.getclipboard()
    km.id("ID_EDIT_COPY")
    new = km.getclipboard()
    km.setclipboard(old)
    if not (string.find(new,"http://") == 1 or string.find(new,"https://") == 1 or string.find(new,"ftp://") == 1 ) then
        new = "http://"..new
    end
    local url = "chrome://plugin/ietab.html?url="..new
    km.NavigateTo(url,OPEN_NEWTAB)
end

function ietab_pref(hwnd)
    local url="chrome://ietab/content/ietabSetting.xul"
    km.NavigateTo(url,OPEN_NEWTAB)
end

function mhtsave(hwnd)
	local km_path=BROWSERPATH.."\\k-meleon.exe";
	local title, url = GetDocInfo(hwnd);
	local mhtsug1 = string.gsub(title,":","");
	local mhtsug2 = string.gsub(mhtsug1,"|","");
	local mhtsug3 = string.gsub(mhtsug2,"?","");
	local mhtsug4 = string.gsub(mhtsug3," ","_");
	--alert(mhtsug4)
	--km.exec(BROWSERPATH.."oGet\\kmmhtsave.exe")
	exec(BROWSERPATH.."oGet\\kmmhtsave.exe \""..km_path.."\" \""..mhtsug4.."\" "..url);
	--exec(BROWSERPATH.."oGet\\kmmhtsave.exe "..mhtsug4.." "..url);
	--exec(BROWSERPATH.."oGet\\kmmhtsave.exe \""..km_path.."\" \"test".."\" "..url);
end