var oDIV_LAYER_FOR_HELP = null;
var bHELP_CHECKING_CLICKED = false;
function checkHelp(buttonId,uriToAction) {
    bHELP_CHECKING_CLICKED = true;
    new Ajax.Request(uriToAction, {
        asynchronous:true, evalScripts:false, parameters: {  },
        onLoading: function(request, json){ displayHelpContent(null,null, buttonId) }, 
        onComplete: function(request, json){ displayHelpContent(request, json, buttonId) }
    });
}

function displayHelpContent(oRequest, oJSON, helpButtonId) {
    if(oDIV_LAYER_FOR_HELP == null) {
        oDIV_LAYER_FOR_HELP = document.createElement('div');
        oDIV_LAYER_FOR_HELP.id = 'helpDisplayLayer';
        oDIV_LAYER_FOR_HELP.className = 'help-display-layer';
        document.body.appendChild(oDIV_LAYER_FOR_HELP);
    }
    bHELP_CHECKING_CLICKED = false;

    if(oRequest == null) {
        oDIV_LAYER_FOR_HELP.innerHTML = oDIV_LAYER_FOR_HELP_TOP+'<br/><center><img src="'+strPathToWebDirectory+'/images/help-ajax-loader.gif" alt="Loading..." /></center>'+oDIV_LAYER_FOR_HELP_BOTTOM;
    }else{
	    oDIV_LAYER_FOR_HELP.innerHTML = oDIV_LAYER_FOR_HELP_TOP+oRequest.responseText+oDIV_LAYER_FOR_HELP_BOTTOM;
    }
    var coordsEl = YAHOO.util.Dom.getXY(helpButtonId)
    oDIV_LAYER_FOR_HELP.style.display = 'block';
    oDIV_LAYER_FOR_HELP.style.top = (coordsEl[1]-oDIV_LAYER_FOR_HELP.clientHeight+10)+'px';
    oDIV_LAYER_FOR_HELP.style.left = coordsEl[0]+'px';
}
