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