local path = getpref(TYPE_STRING, "kmeleon.general.profileDir")

function addimagetoblacklist()
	local url=GetGlobalVar(TYPE_STRING, "ImageURL")
	url=prompt("Are you sure you want to add this into blacklist?","Blacklist",url)
	if url then
		local usercontent = path.."chrome\\adblock.css"
		--local css1=pluginmsgex("utils","read",usercontent,TYPE_STRING)
		-- alert(css1)
		local position=string.find(css1,"{display: none !important;}")
		local a=string.sub(css1,1,position-1)
		local b=string.sub(css1,position)
		local c=",\nimg[src*=\""..url.."\"]"		
		local css2=a..c..b
		--pluginmsg("utils","write",usercontent,css2)
	end
end
	
function adblockeditor()
	local usercontent = path.."chrome\\adblock.css"
	--local css1=pluginmsgex("utils","read",usercontent,TYPE_STRING)
	local position=string.find(css1,"{display: none !important;}")
	local a=string.sub(css1,1,position-1)
	local b=string.sub(css1,position)
	local len=string.len(a)
	local filter={}
	local i=2
	while (len>0) do
		pos1=string.find(a,"\,")
		-- alert(pos1)
		if pos1 then
		filter[i]=string.sub(a,1,pos1-1)
		pos2=string.find(filter[i],"\"]")
		filter[i]=string.sub(filter[i],13,pos2-1)
		a=string.sub(a,pos1+1)
		alert(a)
		len=string.len(a)
		-- alert(filter[i])
		i=i+1
		else 
			len=0
		end
	end
--	filter[#filter+1]=
--[[	idx=choose("filters","filters",unpack(filter))
	if idx then
		filter[idx]=prompt("Change the blacklist?","Blacklist",filter[idx])
	end
	css2=""
	css2="\nimg[src*=\""..filter[1].."\"]"
	for i=2,#filter do
		filter[i]=",\nimg[src*=\""..filter[i].."\"]"
		css2=css2..filter[i]
		alert(css2)
	end
	css2=css2..b
	--pluginmsg("utils","write",usercontent,css2) 
--]]

end