/*--------------------------------------------*
 * Low-level plugin that helps 
 * you to create classes/objects
 * https://github.com/kilhage/jquery-class
 *--------------------------------------------*
 * Author Emil Kilhage
 * MIT Licensed
 *--------------------------------------------*
 * Last Update: 2011-03-16 21:04:27
 * Version 1.0.0
 *--------------------------------------------*/
(function(j){function k(a,b,c,f){c=c!=null?c:b;for(var e in a)if(a.hasOwnProperty(e))c[e]=d.rewrite(e,a,b,f);return b}function h(a){return w.call(a)==="[object Function]"}function m(a){throw d.log_prefix+d.errors[a];}var n=false,q="$.Class :: "+(new Date).getTime(),r=/\b_parent\b/.test(function(){this._parent()}),s=r?/\b_parent\b/:/.*/,t=r?/\b_parent\b\./:/.*/,w=Object.prototype.toString,o=function(){function a(b){if(this instanceof a){if(n===false&&h(this.init))this.init.apply(this,typeof b==="object"&&
b!==null&&b.callee?b:arguments)}else return new a(arguments)}a.__is_class__=q;return a},l=o();l.extend=function(a,b){var c=o(),f,e,g=this.prototype||{};if(typeof a!=="boolean")b=a;b=typeof b==="object"&&b!==null?b:{};e=b.prototype;for(f in this)if(this.hasOwnProperty(f))c[f]=this[f];if(a===true||typeof e==="object"&&e!=null){d.validate(b);k(b,this,c,d.initPopulator(this));b=e}c.constructor=c;n=true;e=new this;n=false;b=b||{};d.validate(b);k(b,g,e,d.initPopulator(g));c.prototype=e;return c};l.addMethods=
function(a){return k(a,this.prototype)};l.prototype={addMethods:function(a){return k(a,this)}};var d=function(a,b){return l.extend(a,b)};d.fnSearch=s;d.parentFnSearch=t;d.log_prefix="$.Class :: ";d.errors={logic_parent_call:"Logic error, unable to call the parent function since it isn't defined..",self_in_prop:"'__self__' is a preserved word used in the jQuery.Class plugin, please rename the function",invalid_$:"Invalid data-type of the global '$' property"};d.makeClass=o;d.rewrite=function(a,b,c,
f){return h(b[a])&&(h(c[a])||!(a in c))&&!d.is(b[a])&&s.test(b[a])?function(e,g,u){g=g||function(){m("logic_parent_call")};var v=h(u)&&t.test(e);return function(){var x=this.hasOwnProperty("_parent"),y=this._parent,i;if(v===true){v=false;i=u();for(var p in i)if(i.hasOwnProperty(p))g[p]=i[p]}this._parent=g;this._parent.__self__=this;i=e.apply(this,arguments);if(x)this._parent=y;else try{delete this._parent}catch(z){}return i}}(b[a],c[a],f):b[a]};d.is=function(a){return a.__is_class__===q};d.initPopulator=
function(a){var b;return function(){if(b==null){b={};for(var c in a)if(a.hasOwnProperty(c)&&h(a[c]))b[c]=function(f){return function(){return f.apply(this.__self__,arguments)}}(a[c])}return b}};d.validate=function(a){h(a.__self__)&&m("self_in_prop")};if(!j.$){"$"in j&&m("invalid_$");j.$={}}j.$.Class=d})(this);
