function VIRTUAL(id, control) {
    this.node = document.getElementById(id);
    this.control = control;


    this.srctree=new dhtmlXTreeObject(id,"100%","100%",0);
    if (adei.cfg.dhtmlx_iconset) {
	this.srctree.setImagePath(adei.cfg.dhtmlx_iconset);
    }
    this.srctree.setXMLAutoLoading(adei.GetServiceURL("srctree")); 
    this.srctree.setDataMode("xml");
    this.srctree.enableCheckBoxes(1);
    this.srctree.enableThreeStateCheckboxes(true);
}

VIRTUAL.prototype.AttachConfig = function(config) {
    this.config = config;
//    config.Register(this);
}

VIRTUAL.prototype.Start = function() {
    adei.source.RegisterSelectionCallback(new CALLBACK(adei.virtual, "OnSelect"), /^virtual$/, /.*/, /^virtual_none$/);
    adei.source.RegisterSubmitCallback(new CALLBACK(adei.virtual, "ApplyConfig"), /^virtual$/);
    this.srctree.loadXML(adei.GetServiceURL("srctree"));
}

VIRTUAL.prototype.OnSelect = function() {
    adei.popup.OpenControl(this.control);
}

VIRTUAL.prototype.ApplyConfig = function() {
    this.config.SetVirtualSettings("srctree", this.srctree.getAllChecked());
//    alert();
}

VIRTUAL.prototype.ReadConfig = function(opts) {
/*
    if (this.config) {
	if (typeof opts == "undefined") opts = new Object;
	    
	opts.db_server = this.config.cfg.db_server;
	opts.db_name = this.config.cfg.db_name;
	opts.db_group = this.config.cfg.db_group;
	
	if (this.config.cfg.db_mask != null) {
    	    var mask = this.config.cfg.db_mask;
	    if (mask.search(',')>=0) {
		opts.db_mask = mask;
		opts.db_item = 0;
	    } else if (isNaN(mask)) {
		opts.db_mask = mask;
		opts.db_item = 0;
	    } else {
		opts.db_mask = -1;
		opts.db_item = mask;
	    }
	}
	
	this.interval.ReadConfig(opts);
	this.Update(opts);
    }
*/
}

