function showHelp(o, vRules, help) {
if(document.getElementById('tblOut'))//isWebent mel
{
    return false;
}
else
{
    var oTd = o.parentNode;
   
    var helpIcon = $MS(o.id+"helpIcon");
    var helpSpan = $MS(o.id+"helpSpan");
    
    if ( helpIcon == null){
        var icon = document.createElement("img");
        icon.id = o.id+"helpIcon";
        icon.src = $YBVP + "/App_Themes/Default/Images/General/help.png";
        icon.className = "helpIcon";
        if (help && help != '')
        {
            icon.onmouseover = function (){showToolTip(this,help)};
            icon.onmouseout = function() { hideToolTip() };
            icon.onclick = function() { hideToolTip() };
            oTd.appendChild(icon);
        }
    }
    else
    {
        helpIcon.style.display = '';
    }

    if (helpSpan == null)
    {
        var helpSpan = document.createElement("span");
        helpSpan.id = o.id+"helpSpan";
        oTd.appendChild(helpSpan);
        helpSpan.innerHTML = "" + vRules;
    }
    else
    {
    helpSpan.style.display = '';
    }
}
}

function hideHelp(o)
{
if(document.getElementById('tblOut'))//isWebent mel
{return false;}
else
{
    var hIcon = $MS(o.id+"helpIcon");
    var hSpan = $MS(o.id+"helpSpan");
    if (hIcon)
    {
        hIcon.style.display = "none";
    }
    if (hSpan)
    {
        hSpan.style.display = "none";
    }
}
    
}

function getNextSibling(startBrother){
  endBrother=startBrother.nextSibling;
  while(endBrother.nodeType!=1){
    endBrother = endBrother.nextSibling;
  }
  return endBrother;
} 

function showToolTip(o,t){
    var toolTipDiv = $MS("toolTipDiv");
    var toolIframe = $MS("toolIframe");
    if (toolTipDiv == null){
        var toolTipDiv = document.createElement("div");
        toolTipDiv.className = "toolTipDiv";
        toolTipDiv.id = "toolTipDiv"
        toolTipDiv.style.zIndex="100000000";
        toolTipDiv.style.position="absolute";
        toolTipDiv.style.padding="10px";

        var toolIframe = document.createElement("iframe");
        toolIframe.setAttribute("id","toolIframe");
        toolIframe.setAttribute("allowTransparency","true");
        toolIframe.setAttribute("frameBorder","0");
        toolIframe.setAttribute("width","254");
        toolIframe.setAttribute("scrolling","no");
    
        toolTipDiv.appendChild(toolIframe);
        // o.parentNode.appendChild(toolTipDiv);
        document.body.appendChild(toolTipDiv);
        
        var iframeContent = ""+
        "<table cellpadding='0' cellSpacing='0' border='0' width='100%'>"+
             "<tr>"+
                "<td><img src='" + $YBVP  +  "/App_Themes/Default/Images/General/toolTipTop.png' width='254' height='2' /></td>"+
             "</tr>"+
             "<tr>"+
                "<td id='tipContent' style='background:url(" + $YBVP + "/App_Themes/Default/Images/General/toolTipBg.png); padding:10 10 10 10;font:11px Tahoma;'>"+ t +"</td>"+
             "</tr>"+  
             "<tr>"+
                "<td><img src='" + $YBVP + "/App_Themes/Default/Images/General/toolTipBottom.gif' width='254' height='13' /></td>"+
             "</tr>"+ 
        "</table>";
        
        var doc = findIframeDoc(toolIframe);
        doc.open();
        doc.write(iframeContent);
        doc.close();

        var docBody = doc.getElementsByTagName("body")[0];
        docBody.style.backgroundColor = "transparent";
        docBody.style.margin = "0px";
        
        var tTable = doc.getElementsByTagName("table")[0];
        toolIframe.height = tTable.offsetHeight;
    }else{
        toolTipDiv.style.display = "";
        var doc = findIframeDoc(toolIframe);
        doc.getElementById("tipContent").innerHTML = t;
        toolIframe.height = doc.getElementById("tipContent").offsetHeight+15;
    }

    var posArr = findPos(o);
    $(toolTipDiv).css('left', posArr[0] - 25).css('top', posArr[1] - toolIframe.height - 8);
    //toolTipDiv.style.left = posArr[0]-25;
    //toolTipDiv.style.top = posArr[1]-toolIframe.height-8;
}

function hideToolTip(){
    $MS("toolTipDiv").style.display = "none";
}
function findIframeDoc(iframe){
    var doc = iframe.contentDocument;
    if (doc == undefined || doc == null){
        doc = iframe.contentWindow.document;        
    }
    return doc;
}
function findPos(obj){
    var posX = obj.offsetLeft;
    var posY = obj.offsetTop;
    while(obj.offsetParent){
    if(obj==document.getElementsByTagName('body')[0]){break}
    else{
    posX=posX+obj.offsetParent.offsetLeft;
    posY=posY+obj.offsetParent.offsetTop;
    obj=obj.offsetParent;
    }
    }
    var posArray=[posX,posY]
    return posArray;
}
