(function(a){function l(b,c){throw a.extend(b,c),b}function m(a){var b=[];if(k.call(a)!==e)return!1;for(var c=0,d=a.length;c<d;c++)b[c]=a[c].jqote_id;return b.length?b.sort().join(".").replace(/(\b\d+\b)\.(?:\1(\.|$))+/g,"$1$2"):!1}function n(b,c){var d,f=[],c=c||i,h=k.call(b);if(h===g)return b.jqote_id?[b]:!1;if(h!==e)return[a.jqotec(b,c)];if(h===e)for(var j=0,l=b.length;j<l;j++)(d=n(b[j],c))&&f.push(d[0]);return f.length?f:!1}var b="UndefinedTemplateError",c="TemplateCompilationError",d="TemplateExecutionError",e="[object Array]",f="[object String]",g="[object Function]",h=1,i="%",j=/^[^<]*(<[\w\W]+>)[^>]*$/,k=Object.prototype.toString;a.fn.extend({jqote:function(b,c){var b=k.call(b)===e?b:[b],d="";return this.each(function(e){var f=a.jqotec(this,c);for(var g=0;g<b.length;g++)d+=f.call(b[g],e,g,b,f)}),d}}),a.each({app:"append",pre:"prepend",sub:"html"},function(b,c){a.fn["jqote"+b]=function(d,e,f){var g,h,i=a.jqote(d,e,f),k=j.test(i)?a:function(b){return a(document.createTextNode(b))};return!(g=m(n(d)))||(h=new RegExp("(^|\\.)"+g.split(".").join("\\.(.*)?")+"(\\.|$)")),this.each(function(){var d=k(i);a(this)[c](d),(d[0].nodeType===3?a(this):d).trigger("jqote."+b,[d,h])})}}),a.extend({jqote:function(a,c,d){var f="",d=d||i,g=n(a);g===!1&&l(new Error("Empty or undefined template passed to $.jqote"),{type:b}),c=k.call(c)!==e?[c]:c;for(var h=0,j=g.length;h<j;h++)for(var m=0;m<c.length;m++)f+=g[h].call(c[m],h,m,c,g[h]);return f},jqotec:function(e,g){var m,n,o,g=g||i,p=k.call(e);if(p===f&&j.test(e)){n=o=e;if(m=a.jqotecache[e])return m}else{n=p===f||e.nodeType?a(e):e instanceof jQuery?e:null,(!n[0]||!(o=n[0].innerHTML)&&!(o=n.text()))&&l(new Error("Empty or undefined template passed to $.jqotec"),{type:b});if(m=a.jqotecache[a.data(n[0],"jqote_id")])return m}var q="",r,s=o.replace(/\s*<!\[CDATA\[\s*|\s*\]\]>\s*|[\r\n\t]/g,"").split("<"+g).join(g+">").split(g+">");for(var t=0,u=s.length;t<u;t++)q+=s[t].charAt(0)!==""?"out+='"+s[t].replace(/(\\|["'])/g,"\\$1")+"'":s[t].charAt(1)==="="?";out+=("+s[t].substr(2)+");":s[t].charAt(1)==="!"?";out+=$.jqotenc(("+s[t].substr(2)+"));":";"+s[t].substr(1);q="try{"+('var out="";'+q+";return out;").split("out+='';").join("").split('var out="";out+=').join("var out=")+'}catch(e){e.type="'+d+'";e.args=arguments;e.template=arguments.callee.toString();throw e;}';try{var v=new Function("i, j, data, fn",q)}catch(w){l(w,{type:c})}return r=n instanceof jQuery?a.data(n[0],"jqote_id",h):n,a.jqotecache[r]=(v.jqote_id=h++,v)},jqotefn:function(b){var c=k.call(b),d=c===f&&j.test(b)?b:a.data(a(b)[0],"jqote_id");return a.jqotecache[d]||!1},jqotetag:function(a){k.call(a)===f&&(i=a)},jqotenc:function(a){return a.toString().replace(/&(?!\w+;)/g,"&#38;").split("<").join("&#60;").split(">").join("&#62;").split('"').join("&#34;").split("'").join("&#39;")},jqotecache:{}}),a.event.special.jqote={add:function(a){var b,c=a.handler,d=a.data?k.call(a.data)!==e?[a.data]:a.data:[];a.namespace||(a.namespace="app.pre.sub");if(!d.length||!(b=m(n(d))))return;a.handler=function(a,d,e){return!e||e.test(b)?c.apply(this,[a,d]):null}}}})(jQuery)