if("undefined"==typeof OGX)var OGX=function(){};OGX.Templater=function(){},OGX.Templater.templatize=function(__obj,__template){"use strict";function evalOp(__op){var reg=new RegExp("\\@","g");return __op=__op.replace(reg,"__obj."),eval(__op),!0}function extractOps(){var op,e,html,prop,temp,ver,reg=new RegExp("\\$\\(loop ([^(]*)\\)","gi"),match=__template.match(reg);if(match)for(var j=0;j<match.length;j++)if(op=match[j].substr(1).split(" "),op.shift(),prop=op.shift().substr(1),temp=op.join(" "),temp=temp.substring(0,temp.length-1),ver=eval("__obj."+prop)){html="";for(var i=0;i<ver.length;i++)html+=temp.replace(/\.\$\./g,"["+i+"].");__template=__template.replace(match[j],html)}if(reg=new RegExp("\\$\\([^(]*\\)","g"),match=__template.match(reg))for(var i=0;i<match.length;i++)e=match[i].substr(1),__template=__template.replace(match[i],""),evalOp(e)}function replaceVals(){for(var reg=new RegExp('\\$([^"\\<\\> ]*)',"g"),match=__template.match(reg),m,val,i=0;i<match.length;i++)m=match[i].substring(1),val=eval("__obj."+m),"undefined"!=typeof val&&(__template=__template.replace(match[i],val))}return extractOps(),replaceVals(),__template};
if("undefined"==typeof OGX)var OGX=function(){};OGX.Templater=function(){},OGX.Templater.templatize=function(__obj,__template){"use strict";function evalOp(__op){var reg=new RegExp("\\@","g");return __op=__op.replace(reg,"__obj."),eval(__op),!0}function extractOps(){var op,e,html,prop,temp,ver,reg=new RegExp("\\$\\(loop ([^(]*)\\)","gi"),match=__template.match(reg);if(match)for(var j=0;j<match.length;j++)if(op=match[j].substr(1).split(" "),op.shift(),prop=op.shift().substr(1),temp=op.join(" "),temp=temp.substring(0,temp.length-1),ver=eval("__obj."+prop)){html="";for(var i=0;i<ver.length;i++)html+=temp.replace(/\.\$\./g,"["+i+"].");__template=__template.replace(match[j],html)}if(reg=new RegExp("\\$\\([^(]*\\)","g"),match=__template.match(reg))for(var i=0;i<match.length;i++)e=match[i].substr(1),__template=__template.replace(match[i],""),evalOp(e)}function replaceVals(){for(var reg=new RegExp("\\$([a-zA-Z0-9_\\-\\[\\]\\.]+)","g"),match=__template.match(reg),m,val,i=0;i<match.length;i++)m=match[i].substring(1),val=eval("__obj."+m),"undefined"!=typeof val&&(__template=__template.replace(match[i],val))}return extractOps(),replaceVals(),__template};
Fix array values