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