/// <reference name="MicrosoftAjax.js"/>
/// <reference path="MyComponent.js" />

MyComplexComponent = function() {
  MyComplexComponent.initializeBase(this);
  this.city = null;
  this._areaCodes = [];
  this._myObject = { firstName: "Henryk" };
  this._subComponent = 
    $create(MyComponent, 
      null, 
      null, 
      null, 
      null);
};

MyComplexComponent.prototype = {
  someExpandoProperty: null,
  get_address: function() {
    return this._address;
  },
  set_address: function(value) {
    this._address = value;
  },
  get_areaCodes: function() {
    return this._areaCodes;
  },
  get_myObject: function() {
    return this._myObject;
  },
  get_subComponent: function() {
    return this._subComponent;
  },
  set_subComponent: function(value) {
    this._subComponent = value;
  }
};

MyComplexComponent.registerClass(
  "MyComplexComponent", 
  Sys.Component);
  
Sys.Application.notifyScriptLoaded();
  
var newComponent = 
  $create(
    MyComplexComponent,
    {
      id: "MyNewComplexComponent", 
      city: "Sanok",
      areaCodes: [619, 858, 760],
      someExpandoProperty: "Moja wartość właściwości expando",
      subComponent: { id: "MySubComponent", address: "ul. Fałszywa 123" },
      myObject: { lastName: "Nowak" }
    },
    null,
    null,
    null);
    
    debugger;
    

