Javascript function for generating SharePoint CAML queries