Implement it as jQuery Plugin.