// ==================================================
// POPUP CONSTRUCTOR
//
// This is the javascript version of a constructor.
// You can put some construction logic here to
// initialize the object you are creating.
//
Cynapps.Frameworks.Web.UI.Controls._clientControlPopup = function()
{
    this.PostBackButtonControlId = null;
}

// ==================================================
// POPUP CLASS BODY
//
Cynapps.Frameworks.Web.UI.Controls._clientControlPopup.prototype = {

    // --------------------------------------------------
    //      PUBLIC CLASS MEMBERS
    // --------------------------------------------------

    // ==================================================
    // open the wait window
    //
    Open : function(url, qs, width, height, title, returnDataControlId, postBackButtonControlId)
    {
        this.PostBackButtonControlId = postBackButtonControlId;
    
        var returnDataControl = document.getElementById(returnDataControlId);
        returnDataControl.value = '';
        
		var left = (screen.width / 2) - (width / 2);
		var top = (screen.height / 2) - (height / 2);

		var winref = window.open(
		    url + "?id=" + returnDataControlId + "&title=" + title + qs,
		    null,
		    "resizable=yes,scrollbars=no,toolbar=no,titlebar=no" + 
		    ",top=" + top +
		    ",left=" + left +
		    ",width=" + width +
		    ",height=" + height);
		    
		if(window.focus)
		{
		    winref.focus();
		}
    },
    
    SetReturnData : function(returnDataControlId, returnData)
    {
        var returnDataControl = document.getElementById(returnDataControlId);
        returnDataControl.value = returnData;
        
        var postBackButtonControl = document.getElementById(this.PostBackButtonControlId);
        postBackButtonControl.click();
    }
}

// ==================================================
// Create an instance of the prototype.
//
Cynapps.Frameworks.Web.UI.Controls.ClientControlPopup =
    new Cynapps.Frameworks.Web.UI.Controls._clientControlPopup();