// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.


// Repository of old "Atlas" code that we're waiting to have integrated into the new Microsoft Ajax Library


///////////////////////////
/// Sys.UI.DomElement

// DELTA - not present in codebase but called from PopupBehavior
Sys.UI.DomElement.setVisible = function(e, value) {

    if (!e) return;

    if ( _proxy_jslib_handle(null, 'value', value, 0, 0) != Sys.UI.DomElement.getVisible(e)) {
        
        if ( _proxy_jslib_handle(null, 'value', value, 0, 0)) {
            if (e.style.removeAttribute) {
                e.style.removeAttribute("display");
            } else {
               e.style.removeProperty("display");
            }
        }
        else {
            e.style.display = 'none';
        }
        
        e.style.visibility =  _proxy_jslib_handle(null, 'value', value, 0, 0) ? 'visible' : 'hidden';
    }
}

Sys.UI.DomElement.getVisible = function(e) {

    if (!e) return false;

    return (("none" != AjaxControlToolkit.CommonToolkitScripts.getCurrentStyle(e, "display")) &&
        ("hidden" != AjaxControlToolkit.CommonToolkitScripts.getCurrentStyle(e, "visibility")));
}


//////////////////////////////////////
// Sys.UI.Control.overlaps
//

Sys.UI.Control.overlaps = function overlaps(r1, r2) {
    var xLeft = (r1.x >= r2.x && r1.x <= (r2.x + r2.width));
    var xRight = ((r1.x + r1.width) >= r2.x && (r1.x + r1.width) <= r2.x + r2.width);
    var xComplete = ((r1.x < r2.x) && ((r1.x + r1.height) > (r2.x + r2.height)));
    
    var yLeft = (r1.y >= r2.y && r1.y <= (r2.y + r2.height));
    var yRight = ((r1.y + r1.height) >= r2.y && (r1.y + r1.height) <= r2.y + r2.height);
    var yComplete = ((r1.y < r2.y) && ((r1.y + r1.height) > (r2.y + r2.height)));
    if ((xLeft || xRight || xComplete) && (yLeft || yRight || yComplete)) {
        return true;
    }
    
    return false;
}

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded(); ;
_proxy_jslib_flush_write_buffers() ;