function Milestone(url, container) {
    this.MyControlTypeId = "AFC288CD-DC47-4f29-A035-9C06EE8A7390";
    
    // Private Properties
    this.dataURL_ = url;
    this.container_ = container;
};

/***********************************************************
 * Public Methods
 ***********************************************************/
Milestone.prototype.Show = function() {
    this.Hide();
    this.clear_();
    this.getMilestone_();
};

Milestone.prototype.Hide = function() {
    if (this.container_ && this.container_.style) {
        this.container_.style.display = "none";
    }
};

/***********************************************************
 * Private Methods
 ***********************************************************/
Milestone.prototype.clear_ = function() {
    if (this.container_) {
        this.container_.innerHTML = "";
    }
};
 
Milestone.prototype.getMilestone_ = function() {
    var me = this;
    var request = XmlHttp.create();
	request.open("POST", this.dataURL_, true);
	request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	request.onreadystatechange = function() {
		if (request.readyState == 4) {
		    var data = request.responseText;
		    if(data != "") {
                me.showMilestone_(data);
            }
		}
	}
	request.send('CallerId=' + this.MyControlTypeId + '&Action=GET');
};

Milestone.prototype.showMilestone_ = function(xmlData) {
    var html = null;
    var xml = Xml.parse(xmlData);
    var nodes = xml.documentElement.getElementsByTagName("Milestone");
    for(var i = 0; i < nodes.length; i++) {
        var node = nodes[i];
    
        for(var j = 0; j < node.childNodes.length; j++) {
            var child = node.childNodes[j];
            if(child.nodeType == 4 /* CDATA */) {
                html = child.nodeValue;
            }            
        }
        break;
    }
    
    if(html && html != "") {
        this.displayMilestone_(html);
    }
};

Milestone.prototype.displayMilestone_ = function(html) {
    var winW = $telerik.$(window).width();
    var winH = $telerik.$(window).height();

    var me = this;
    this.container_.innerHTML = html;
    this.container_.appendChild(document.createElement("BR"));
    this.container_.appendChild(document.createElement("BR"));
    this.container_.appendChild(this.createButton_("btnClose", JSRES_Continue,
        function() {
            me.Show();
        }
    ));

    this.container_.style.display = "block";

    var divW = this.container_.offsetWidth;
    var divH = this.container_.offsetHeight;

    this.container_.style.top = ((winH / 2) - (divH / 2) + $telerik.$(window).scrollTop()) + "px";
    this.container_.style.left = winW / 2 - divW / 2 + "px";
};

Milestone.prototype.createButton_ = function(id, text, clickHandler) {
    var div = document.createElement("div");
    div.style.width = "100%";
    div.style.textAlign = "right";
    div.style.display = "block";
    div.setAttribute("style","float:right");
    div.style.styleFloat = "right";
    
    var btn = document.createElement("A");
    btn.href="#";
    btn.appendChild(document.createTextNode(text));
    btn.id = id;
    if(clickHandler) {
        addEvent(btn, 'click', clickHandler);
    }
    
    div.appendChild(btn);
    return div;
};