(function(C){var E=document,A=function(D,F){return F.getElementsByTagName(D||"*")};var B={"#":function(H,I){var G=H.split("#"),F=G[0],J=G[1],D=document.getElementById(J);return F&&D.tagName.toLowerCase()!=F?[]:[D]},".":function(D,G){var R=D.split("."),J=R[0],Q=R[1],F=null,H=[],P=0,I=new RegExp("\\b"+Q+"\\b");for(var O=0,L=G.length;O<L;O++){F=A(J,G[O]);var N=null;for(var M=0,K=F.length;M<K;M++){if(!/\S/.test((N=F[M]).nodeValue)){continue}if(I.test(N.className)){H[P++]=N}}}return H},_tag_:function(D,F){var M,G=[],L=0;for(var K=0,I=F.length;K<I;K++){M=A(D,F[K]);for(var J=0,H=M.length;J<H;J++){G[L++]=M[J]}}return G},"]":function(D,F){D.match(/^(.*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/);var G=[],L=fIndex=0,K=RegExp.$3,P=RegExp.$1,M=RegExp.$2,O=RegExp.$4,N=query(P,F);var H={"=":function(Q){return(Q.getAttribute(M)==attrValue)},"~":function(Q){return(Q.getAttribute(M).match(new RegExp("\\b"+attrValue+"\\b")))},"|":function(Q){return(Q.getAttribute(M).match(new RegExp("^"+attrValue+"-?")))},"^":function(Q){return(Q.getAttribute(M).indexOf(attrValue)==0)},"$":function(Q){return(Q.getAttribute(M).lastIndexOf(attrValue)==Q.getAttribute(M).length-attrValue.length)},"*":function(Q){return(Q.getAttribute(M).indexOf(attrValue)>-1)}}[K]||function(Q){return Q.getAttribute(M)};for(var J=0,I=N.length;J<I;J++){if(H(N[J])){G[fIndex++]=N[J]}}return G}};C.query=function(D,G){var F=G||[E],H=new RegExp(C.query.config.reg);var M=D.split(" "),K,I;for(var L=0,J=M.length;L<J;L++){K=M[L];I=K.match(H);F=B[(I&&I[0])||"_tag_"](K,F)}return F};C.query.config={reg:"(\\])|(\\.)|(#)",addSelector:function(F,D){if(!F||!D){return }B[F]=D;F=F.replace(/(\.|\||\[|\]|\^|\\|\$|\?|\*|\+|\{|\}|\(|\))/g,"\\\\$1");this.reg+=this.reg.indexOf(F)!=-1?"":"|("+F+")"},queryMethod:B}})(this);
