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