
function showInfo(e, message)
{
    showInfoPos(e, message, 25, 0);
}

function showError(e, message) 
{
    showErrorPos(e, message, 25, 0);
}

function showInfoPos(e, message, inX, inY)
{
    var pos=Sys.UI.DomElement.getLocation(e);
    var iw=$get('informationPanel'); 
    var iwData = $get('innerInfoPanel');
    iwData.innerHTML = message;
    iw.style.display = '';
    
    var iwTab =  $get('iwTab');
    var iwBounds = Sys.UI.DomElement.getBounds(iwTab);
    var iwHeight = iwBounds.height + 50;
    var iwWidth = iwBounds.width;
    
    var iwxBuffer = inX;
    var iwyBuffer = inY;
    
    var windowWidth = document.body.clientWidth;
    var windowHeight = document.body.clientHeight;
    
    var x = pos.x;
    if ((x + iwxBuffer + iwWidth) > windowWidth) 
    {
        x = x - iwxBuffer - iwWidth + 5;
    }
    else
    {
        x = x + iwxBuffer;
    }
    
    var y = pos.y;
    if (y + iwyBuffer + iwHeight > windowHeight)
    {
        y = y - iwyBuffer - iwHeight;
    }
    else
    {
        y = pos.y + iwyBuffer;
    }
    
    
    Sys.UI.DomElement.setLocation(iw,x,y);
}

function showErrorPos(e, message, inX, inY) 
{
    var pos = Sys.UI.DomElement.getLocation(e);
    var iw = $get('errorPanel');
    var iwData = $get('innerErrorPanel');
    iwData.innerHTML = message;
    iw.style.display = '';

    var iwTab = $get('ewTab');
    var iwBounds = Sys.UI.DomElement.getBounds(iwTab);
    var iwHeight = iwBounds.height + 50;
    var iwWidth = iwBounds.width;

    var iwxBuffer = inX;
    var iwyBuffer = inY;

    var windowWidth = document.body.clientWidth;
    var windowHeight = document.body.clientHeight;

    var x = pos.x;
    if (x + iwxBuffer + iwWidth > windowWidth) {
        x = x - iwxBuffer - iwWidth + 5;
    }
    else {
        x = x + iwxBuffer;
    }

    var y = pos.y;
    if (y + iwyBuffer + iwHeight > windowHeight) {
        y = y - iwyBuffer - iwHeight;
    }
    else {
        y = pos.y + iwyBuffer;
    }

    Sys.UI.DomElement.setLocation(iw, x, y);
}

function hideInfo()
{
    $get('informationPanel').style.display = 'none';
}

function hideError() 
{
    $get('errorPanel').style.display = 'none';
}

function ShowRejectMessageEx(b, id, hid)
{
	var position = Sys.UI.DomElement.getLocation(b)
    var x = position.x - 330;
    var y = position.y - 5;
    
    var iw = $get('reasonWindow');
	iw.style.display = "";
    Sys.UI.DomElement.setLocation(iw,x,y);
    
    var i = $get(hid);
    i.value = id;
        
    return true;
}

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
