require "compat"
require "searchbar"

function sync()
	searchbarsync()
	home_sync()
	if getpref(TYPE_BOOL,"adblock.enabled")==true then SetCheck("luamacro(ABToggle)",true) else SetCheck("luamacro(ABToggle)",false) end
	if getpref(TYPE_BOOL,"adblock.fastcollapse")==true then SetCheck("luamacro(ABcollapse)",true) else SetCheck("luamacro(ABcollapse)",false) end
	if getpref(TYPE_BOOL,"adblock.linkcheck")==true then SetCheck("luamacro(ABparlnk)",true) else SetCheck("luamacro(ABparlnk)",false) end
	if getpref(TYPE_BOOL,"adblock.divcheck")==true then SetCheck("luamacro(ABdivcheck)",true) else SetCheck("luamacro(ABdivcheck)",false) end
	if getpref(TYPE_BOOL,"adblock.listsort")==true then SetCheck("luamacro(ABlstsort)",true) else SetCheck("luamacro(ABlstsort)",false) end
	if getpref(TYPE_BOOL,"kmeleon.flash.enable")==false then SetCheck("luamacro(flashblock)",true) else SetCheck("luamacro(flashblock)",false) end

	if getpref(TYPE_BOOL,"kmeleon.startupgroups.enabled")==false then SetCheck("luamacro(nostartup)",true) else SetCheck("luamacro(nostartup)",false) end

	if getpref(TYPE_INT, "network.proxy.type")==0 then SetCheck("luamacro(NoProxy)",true) else SetCheck("luamacro(NoProxy)",false) end
	if getpref(TYPE_INT, "network.proxy.type")~=0 and getpref(TYPE_STRING,"network.proxy.http")==getpref(TYPE_STRING,"network.proxy1.http") then SetCheck("luamacro(proxy1)",true) else SetCheck("luamacro(proxy1)",false) end
	if getpref(TYPE_INT, "network.proxy.type")~=0 and getpref(TYPE_STRING,"network.proxy.http")==getpref(TYPE_STRING,"network.proxy2.http") then SetCheck("luamacro(proxy2)",true) else SetCheck("luamacro(proxy2)",false) end
	if getpref(TYPE_INT, "network.proxy.type")~=0 and getpref(TYPE_STRING,"network.proxy.http")==getpref(TYPE_STRING,"network.proxy3.http") then SetCheck("luamacro(proxy3)",true) else SetCheck("luamacro(proxy3)",false) end 
	if getpref(TYPE_INT, "network.proxy.type")~=0 and getpref(TYPE_STRING,"network.proxy.http")==getpref(TYPE_STRING,"network.proxy4.http") then SetCheck("luamacro(proxy4)",true) else SetCheck("luamacro(proxy4)",false) end 
	if getpref(TYPE_INT, "network.proxy.type")~=0 and getpref(TYPE_STRING,"network.proxy.http")==getpref(TYPE_STRING,"network.proxy5.http") then SetCheck("luamacro(proxy5)",true) else SetCheck("luamacro(proxy5)",false) end 
	if getpref(TYPE_INT, "network.proxy.type")~=0 and getpref(TYPE_STRING,"network.proxy.http")==getpref(TYPE_STRING,"network.proxy6.http") then SetCheck("luamacro(proxy6)",true) else SetCheck("luamacro(proxy6)",false) end 

	if getpref(TYPE_STRING,"image.animation_mode")=="normal" then SetCheck("luamacro(AniToggle)",false) else SetCheck("luamacro(AniToggle)",true) end
	if getpref(TYPE_BOOL,"browser.display.use_document_colors")== true then SetCheck("luamacro(CToggle)",false) else SetCheck("luamacro(CToggle)",true) end
	if getpref(TYPE_INT,"network.cookie.cookieBehavior")==0 then SetCheck("luamacro(CKToggle)",false) else SetCheck("luamacro(CKToggle)",true) end
	if getpref(TYPE_INT,"permissions.default.image")==0 then SetCheck("luamacro(ImgToggle)",false) else SetCheck("luamacro(ImgToggle)",true) end
	if getpref(TYPE_BOOL,"security.enable_java")== true then SetCheck("luamacro(JToggle)",false) else SetCheck("luamacro(JToggle)",true) end
	if getpref(TYPE_BOOL,"javascript.enabled")== true then SetCheck("luamacro(JSToggle)",false) else SetCheck("luamacro(JSToggle)",true) end
	if getpref(TYPE_BOOL,"dom.disable_open_during_load")== false then SetCheck("luamacro(PBToggle)",false) else SetCheck("luamacro(PBToggle)",true) end
	if getpref(TYPE_INT,"network.http.sendRefererHeader")==2 then SetCheck("luamacro(RefToggle)",false) else SetCheck("luamacro(RefToggle)",true) end 

	if getpref(TYPE_INT,"kmeleon.plugins.gestures.links")==0 then SetCheck("luamacro(LinkNormal)",true) else SetCheck("luamacro(LinkNormal)",false) end
	if getpref(TYPE_INT,"kmeleon.plugins.gestures.links")==1 then SetCheck("luamacro(LinkInBackgroundTab)",true) else SetCheck("luamacro(LinkInBackgroundTab)",false) end
	if getpref(TYPE_INT,"kmeleon.plugins.gestures.links")==2 then SetCheck("luamacro(LinkInNewTab)",true) else SetCheck("luamacro(LinkInNewTab)",false) end
	if getpref(TYPE_INT,"kmeleon.plugins.gestures.drag")==1 then SetCheck("luamacro(DragNew)",true) else SetCheck("luamacro(DragNew)",false) end
	if getpref(TYPE_INT,"kmeleon.plugins.gestures.drag")==0 then SetCheck("luamacro(DragBack)",true) else SetCheck("luamacro(DragBack)",false) end

	if getpref(TYPE_INT,"kmeleon.plugins.luamacro.search.searchOpen")==0 then SetCheck("luamacro(search.SetOpen(0))",true) else SetCheck("luamacro(search.SetOpen(0))",false) end
 	if getpref(TYPE_INT,"kmeleon.plugins.luamacro.search.searchOpen")==1 then SetCheck("luamacro(search.SetOpen(1))",true) else SetCheck("luamacro(search.SetOpen(1))",false) end
	if getpref(TYPE_INT,"kmeleon.plugins.luamacro.search.searchOpen")==2 then SetCheck("luamacro(search.SetOpen(2))",true) else SetCheck("luamacro(search.SetOpen(2))",false) end

	if getpref(TYPE_INT,"kmeleon.general.saveType")==1 then SetCheck("luamacro(setsave1)",true) else SetCheck("luamacro(setsave1)",false) end
	if getpref(TYPE_INT,"kmeleon.general.saveType")==2 then SetCheck("luamacro(setsave2)",true) else SetCheck("luamacro(setsave2)",false) end

	SetCheck("luamacro(search.Search(" .. getpref(TYPE_STRING,"kmeleon.plugins.luamacro.search.searchEngine") .. ")",true)
	
end
	