var ABase = {
	init: function() {
		var container = this.container ;
		var fns = [] ;
		for (var property in this) {
			if (property.startsWith('on_instance_') && typeof this[property] == 'function') {
				continue ;
			}
			fns.push(property) ;
		}
		if (!document.all) {
			fns.reverse() ;
		}
		for (var i = 0 ; i < fns.length ; i++) {
			var property = fns[i] ;
			if (property.startsWith('on_init_') && typeof this[property] == 'function') {
				this[property]()
				continue ;
			}
			container[property] = this[property] ;
		}
		container.owner = container.owner ? container.owner : document.body ;
		container.owner.appendChild(container) ;
		//alert(container.owner.innerHTML) ;
		this.first() ;
		return container ;
	},
	register: function(_object) {
		//alert(document.prop(_object).join("\n")) ;
		if (!window.Ad) {
		window.Ad = {} ;
		}
		if (!window.Ad.Components) {
			window.Ad.Components = {} ;
		}
		if (!window.Ad.Components[_object.name]) {
			window.Ad.Components[_object.name] = [] ;
		}
		window.Ad.Components[_object.name].push(_object.object) ;
		_object.object.id = _object.id ? _object.id : _object.name+ '-' + $$('*').length ;
		_object.object.name = _object.name ;
		var fns = [] ;
		for (var property in _object.object) {
			if (!property.startsWith('on_instance_') || typeof _object.object[property] != 'function') {
				continue ;
			}
			fns.push(property) ;
		}
		if (!document.all) {
			fns.reverse() ;
		}
		for (var i = 0 ; i < fns.length ; i++) {
			var property = fns[i] ;
			_object.object[property]() ;
		}
	}
}
