// Copyright (c) 2013.08.19 ONTOOL(ontool.net) Licensed MIT function o(e){var ev=document.querySelectorAll(e);return new o.prototype.init(ev);} //요소 선택자 o.prototype.init=function(ev){this.g=ev;this.length=ev.length;return this;};o.prototype.init.prototype=o.prototype; //요소 인덱스값 o.prototype.ap=Element.prototype.ap = function(e){if(this.length){for(var i=0,len=this.length;i < len;i++)this.g[i].appendChild(e);}else{this.appendChild(e);}} //요소추가 o.prototype.on=Element.prototype.on=function(evt, fn){if(this.length){for(i = 0,len = this.length;i < len;i++){this.g[i]["on"+evt]=fn;}}else{this["on"+evt]=fn;}} //이벤트핸들러 o.prototype.hc=Element.prototype.hc=function(c){if(this.length){for(var i=0,len=this.length; i < len; i++)return this.g[i].className.match(c);}else{return this.className.match(c);}} //클래스존재여부 o.prototype.ac=Element.prototype.ac=function(c){if(this.length){for(var i=0,len=this.length;i < len;i++){if(!this.g[i].hc(c)){this.g[i].className+=" "+c;}}}else{if(!this.hc(c))this.className+=" "+c;}} //클래스추가 o.prototype.rc=Element.prototype.rc=function(c){if(this.length){for(var i=0,len=this.length; i < len; i++){if(this.g[i].hc(c)) {this.g[i].className=this.g[i].className.replace(" "+c,"");}}}else{if(this.hc(c)){this.className=this.className.replace(" "+c,"");}}} //클래스삭제 o.prototype.dis=Element.prototype.dis=function(e) {if(this.length){for(var i=0,len=this.length; i < len; i++)this.g[i].style.display =e;}else{this.style.display=e;}} //요소 스타일 display값 o.prototype.html=Element.prototype.html = function(e){if(this.length){for(var i=0,len=this.length; i < len; i++)this.g[i].innerHTML=e;}else{this.innerHTML=e;}o('.button').on('mousedown',function(){this.ac('active');});} //요소 내용변경 o.prototype.x=Element.prototype.x=function(){if(this.length){for(var i=0,len=this.length;i < len; i++)this.g[i].parentNode.removeChild(this.g[i]);}else{this.parentNode.removeChild(this);}} //요소 삭제