Javascript, PHP small function & code