//function UpdateDivisionHeight(contentDivisionId)
//{
//    var contentDivision = document.getElementById(contentDivisionId);
//    var midSliceInitialHeight = 0;
//    var flyOut = document.getElementById("flyout");
//    var difference = 0;
//    var midBlockHeight = 0;
//    if(contentDivision != null)
//    {
//        var contentHeight = contentDivision.offsetHeight;                    
//        //increase the height to allow padding for the text
//         difference = Math.abs(flyOut.offsetHeight - contentHeight) + 15;
//        //todo: make the value negative if it is positive
//        //place the text layer over the flyout box. (subtract half of additional height added)
//        
//        //isdvkku : top and bottom div heights are 26+26 = 52
//        var midBlockHeight = Math.abs(contentDivision.offsetHeight - 52) + 10;
//        
//        var midSlice = document.getElementById("midslice");
//        if(midSlice != null)
//        {
//            midSliceInitialHeight = midSlice.offsetHeight;
//            midSlice.style.height = midBlockHeight + 'px';
//        }
//        var midSliceImage = document.getElementById("midsliceImage");
//        if(midSliceImage != null)
//        {
//            midSliceImage.style.height = midBlockHeight + 'px';
//        }        
//        if(flyOut != null)
//        {            
//            var finalHeight = flyOut.offsetHeight + difference - midSliceInitialHeight;
//            flyOut.style.height =  finalHeight + 'px';
//            window.parent.SetIFrameSize("HelpContainer",finalHeight-2);
//        }
//    }
//}



function UpdateDivisionHeight(contentDivisionId)
{
    var contentDivision = document.getElementById(contentDivisionId);
    var midSliceInitialHeight = 0;
    var flyOut = document.getElementById("flyout");
    var difference = 0;
    var midBlockHeight = 0;
    if(contentDivision != null)
    {
        var contentHeight = contentDivision.offsetHeight;                    
        //difference = flyOut.offsetHeight - contentHeight + 15;
        if(contentHeight > 52)
        {
            midBlockHeight = Math.abs(contentDivision.offsetHeight - 52) + 10;
        }
        else
        {
            midBlockHeight = contentDivision.offsetHeight + 10;
        }
        
        //isdvkku : top and bottom div heights are 26+26 = 52
        //var midBlockHeight = Math.abs(contentDivision.offsetHeight - 52) + 10;
        
        var midSlice = document.getElementById("midslice");
        if(midSlice != null)
        {
            //midSliceInitialHeight = midSlice.offsetHeight;
            midSlice.style.height = midBlockHeight + 'px';
        }
        var midSliceImage = document.getElementById("midsliceImage");
        if(midSliceImage != null)
        {
            midSliceImage.style.height = midBlockHeight + 'px';
        }        
        if(flyOut != null)
        {            
            var finalHeight = midBlockHeight + 52;
            flyOut.style.height =  finalHeight + 'px';
            window.parent.SetIFrameSize("HelpContainer",finalHeight-5);
        }
    }
}



function OpenHelpFlyOut(contentId, oClickedElement)
{    
    
    var helpContainer = document.getElementById("HelpContainer");
    if(helpContainer == null)
    {
        helpContainer = getHelpContainer();
    }
    helpContainer.style.visibility = "hidden";
    helpContainer.src = _geApplicationRoot + '/FlyOut.aspx?contentId=' + contentId;   
 
    var clickX = clickY = 0;
	if (oClickedElement.offsetParent) 
	{
		clickX = oClickedElement.offsetLeft
		clickY = oClickedElement.offsetTop
		while (oClickedElement = oClickedElement.offsetParent)
	    {
			clickX += oClickedElement.offsetLeft
			clickY += oClickedElement.offsetTop
		}
	}     
    helpContainer.style.visibility='visible';
    helpContainer.style.top=clickY +15+"px";
    helpContainer.style.left=clickX +"px"; 
}

function CloseHelpFlyOut()
{
    var helpContainer = document.getElementById("HelpContainer");
    if(helpContainer != null)
    {
        helpContainer.style.visibility='hidden';
    }
}


function SetIFrameSize(strIFrameID,intH) 
    {
      if ( document.getElementById(strIFrameID) != null )
      {
      document.getElementById(strIFrameID).style.height    = intH +'px';     
      }
    }

function getHelpContainer()
{
    newPopIframe = document.createElement("IFRAME");
    newPopIframe.src = _geApplicationRoot + "/images/shim.gif";
	newPopIframe.className = "HelpContainer";
	newPopIframe.id = "HelpContainer";
	newPopIframe.name = "HelpContainer";
    newPopIframe.frameBorder = 0;
    newPopIframe.scrolling = "no";
    window.document.body.appendChild(newPopIframe);
    return newPopIframe;
}