jQuery.fn.initClasses = function(){
  this.each(function(){
    var self = this, cl, cls;
    if(! this.className.match(':')) return;
    cls = this.className.split(' ');
    while(cl = cls.shift()) {
      if(cl.match(/:[^:]+/)) {
        var pair = /^([^:]+):([^:]+)$/.exec(cl);
        if(typeof(assert) === 'function')
          assert(pair instanceof Array && pair.length === 3, 'initClasses Error: '+self.tagName+' "'+self.className+'" ');
        // numbers with leading zeros and overlong numbers will be treated as string.
        var val = pair[2].match(/^\-?([1-9][0-9]{0,15}|0)$/) ? parseInt(pair[2]) :
                                                     decodeURIComponent(pair[2]);
        self[pair[1]] = val;
      }
    }
  });
  return this;
};

