Simpler = {
  createClass: function (typeName) {
    var s, o, p, typeNames;
    
    if (arguments.length === 2) {
      o = arguments[1];
    }
    else {
      s = arguments[1];
      o = arguments[2];
    }
  
    var c = o.__create;
    
    if (s) {
      for (p in s.prototype) {
        if (s.prototype.hasOwnProperty(p)) {
          c.prototype[p] = s.prototype[p];
        }
      }
      typeNames = s.prototype.typeNames;
    }
    
    for (p in o) {
      if (o.hasOwnProperty(p)) {
        if (typeof o[p] === 'function') {
          var f = o[p];
          f.base = c.prototype[p];
          c.prototype[p] = f;
        }
        else {
          c.prototype[p] = o[p];
        }
      }
    }
    
    c.prototype.typeNames = [];
    if (typeNames) {
      for (var i = 0; i < typeNames.length; i++) {
        c.prototype.typeNames.push(typeNames[i]);
      }
    }
    c.prototype.typeNames.push(typeName);
    c.prototype.isTypeOf = Simpler.isTypeOf;
    
    eval(typeName + ' = c;');
  },
  
  executeUrl: function (url, callback) {
    if (window.external && window.external.IsWindowsHost) {
      window.external.ExecuteUrl(url);
      
      var o = {};
      o.status = window.external.GetExecuteUrlResponse('StatusCode');
      o.statusText = window.external.GetExecuteUrlResponse('StatusDescription');
      o.responseText = window.external.GetExecuteUrlResponse('ResponseText');
      o.argument = callback.argument;
      
      if (o.status >= 200 && o.status < 300) {
        if (!callback.scope) {
          callback.success(o);
        }
        else {
          callback.success.call(callback.scope, o);
        }
      }
      else {
        if (!callback.scope) {
          callback.failure(o);
        }
        else {
          callback.failure.call(callback.scope, o);
        }
      }
      
      window.external.ExecuteUrlComplete();
    }
    else {
      YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
    }
  },
  
  isTypeOf: function (typeName) {
    for (var i = 0; i < this.typeNames.length; i++) {
      if (this.typeNames[i] === typeName) {
        return true;
      }
    }
    return false;
  }
};
