condensing js and php