pinr js functions