Update jquery.ptemplate.js

made it more efficient -- evaluate "ifs" before loops