/*!
 * jQuery Templates Plugin 1.0.0pre
 * http://github.com/jquery/jquery-tmpl
 * Requires jQuery 1.4.2
 *
 * Copyright Software Freedom Conservancy, Inc.
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 */

(function(d){function m(a,b,e,c){c={data:c||c===0||c===!1?c:b?b.data:{},_wrap:b?b._wrap:null,tmpl:null,parent:b||null,nodes:[],calls:B,nest:C,wrap:D,html:E,update:F};a&&d.extend(c,a,{nodes:[],parent:b});if(e)c.tmpl=e,c._ctnt=c._ctnt||c.tmpl(d,c),c.key=++n,(t.length?o:j)[n]=c;return c}function p(a,b,e){var c,e=e?d.map(e,function(b){return typeof b==="string"?a.key?b.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+l+'="'+a.key+'" $2'):b:p(b,a,b._ctnt)}):a;if(b)return e;e=e.join("");e.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
function(b,a,e,i){c=d(e).get();v(c);a&&(c=u(a).concat(c));i&&(c=c.concat(u(i)))});return c?c:u(e)}function u(a){var b=document.createElement("div");b.innerHTML=a;return d.makeArray(b.childNodes)}function w(a){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+d.trim(a).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
function(a,e,c,g,h,f,i){a=d.tmpl.tag[c];if(!a)throw"Unknown template tag: "+c;c=a._default||[];f&&!/\w$/.test(h)&&(h+=f,f="");h?(h=q(h),i=i?","+q(i)+")":f?")":"",i=f?h.indexOf(".")>-1?h+q(f):"("+h+").call($item"+i:h,f=f?i:"(typeof("+h+")==='function'?("+h+").call($item):("+h+"))"):f=i=c.$1||"null";g=q(g);return"');"+a[e?"close":"open"].split("$notnull_1").join(h?"typeof("+h+")!=='undefined' && ("+h+")!=null":"true").split("$1a").join(f).split("$1").join(i).split("$2").join(g||c.$2||"")+"__.push('"})+
"');}return __;")}function x(a,b){a._wrap=p(a,!0,d.isArray(b)?b:[y.test(b)?b:d(b).html()]).join("")}function q(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function v(a){function b(a){function b(a){var G;a+=e;G=h[a]=h[a]||m(f,j[f.parent.key+e]||f.parent),f=G}var c,g=a,f,i;if(i=a.getAttribute(l)){for(;g.parentNode&&(g=g.parentNode).nodeType===1&&!(c=g.getAttribute(l)););if(c!==i){g=g.parentNode?g.nodeType===11?0:g.getAttribute(l)||0:0;if(!(f=j[i]))f=o[i],f=m(f,j[g]||o[g]),f.key=++n,
j[n]=f;k&&b(i)}a.removeAttribute(l)}else if(k&&(f=d.data(a,"tmplItem")))b(f.key),j[f.key]=f,g=(g=d.data(a.parentNode,"tmplItem"))?g.key:0;if(f){for(c=f;c&&c.key!=g;)c.nodes.push(a),c=c.parent;delete f._ctnt;delete f._wrap;d.data(a,"tmplItem",f)}}var e="_"+k,c,g,h={},f,i,r;f=0;for(i=a.length;f<i;f++)if((c=a[f]).nodeType===1){g=c.getElementsByTagName("*");for(r=g.length-1;r>=0;r--)b(g[r]);b(c)}}function B(a,b,d,c){if(!a)return t.pop();t.push({_:a,tmpl:b,item:this,data:d,options:c})}function C(a,b,e){return d.tmpl(d.template(a),
b,e,this)}function D(a,b){var e=a.options||{};e.wrapped=b;return d.tmpl(d.template(a.tmpl),a.data,e,a.item)}function E(a,b){var e=this._wrap;return d.map(d(d.isArray(e)?e.join(""):e).filter(a||"*"),function(a){if(b)a=a.innerText||a.textContent;else{var d;if(!(d=a.outerHTML))d=document.createElement("div"),d.appendChild(a.cloneNode(!0)),d=d.innerHTML;a=d}return a})}function F(){var a=this.nodes;d.tmpl(null,null,null,this).insertBefore(a[0]);d(a).remove()}var z=d.fn.domManip,l="_tmplitem",y=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
j={},o={},s,A={key:0,data:{}},n=0,k=0,t=[];d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(e){var c=[],e=d(e),g,h,f;g=this.length===1&&this[0].parentNode;s=j||{};if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1)e[b](this[0]),c=this;else{h=0;for(f=e.length;h<f;h++)k=h,g=(h>0?this.clone(!0):this).get(),d(e[h])[b](g),c=c.concat(g);k=0;c=this.pushStack(c,a,e.selector)}e=s;s=null;d.tmpl.complete(e);
return c}});d.fn.extend({tmpl:function(a,b,e){return d.tmpl(this[0],a,b,e)},tmplItem:function(){return d.tmplItem(this[0])},template:function(a){return d.template(a,this[0])},domManip:function(a,b,e){if(a[0]&&d.isArray(a[0])){for(var c=d.makeArray(arguments),g=a[0],h=g.length,f=0,i;f<h&&!(i=d.data(g[f++],"tmplItem")););i&&k&&(c[2]=function(a){d.tmpl.afterManip(this,a,e)});z.apply(this,c)}else z.apply(this,arguments);k=0;s||d.tmpl.complete(j);return this}});d.extend({tmpl:function(a,b,e,c){var g=!c;
if(g)c=A,a=d.template[a]||d.template(null,a),o={};else if(!a)return a=c.tmpl,j[c.key]=c,c.nodes=[],c.wrapped&&x(c,c.wrapped),d(p(c,null,c.tmpl(d,c)));if(!a)return[];typeof b==="function"&&(b=b.call(c||{}));e&&e.wrapped&&x(e,e.wrapped);b=d.isArray(b)?d.map(b,function(b){return b?m(e,c,a,b):null}):[m(e,c,a,b)];return g?d(p(c,null,b)):b},tmplItem:function(a){var b;for(a instanceof d&&(a=a[0]);a&&a.nodeType===1&&!(b=d.data(a,"tmplItem"))&&(a=a.parentNode););return b||A},template:function(a,b){if(b)return typeof b===
"string"?b=w(b):b instanceof d&&(b=b[0]||{}),b.nodeType&&(b=d.data(b,"tmpl")||d.data(b,"tmpl",w(b.innerHTML))),typeof a==="string"?d.template[a]=b:b;return a?typeof a!=="string"?d.template(null,a):d.template[a]||d.template(null,y.test(a)?a:d(a)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});d.extend(d.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},
open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){j={}},afterManip:function(a,
b,e){var c=b.nodeType===11?d.makeArray(b.childNodes):b.nodeType===1?[b]:[];e.call(a,b);v(c);k++}})})(jQuery);
