﻿function common_showHelpDiv(objIcon)
{

    objIcon.src = objIcon.src.replace("Off", "Hover");
        
    var objDiv = document.getElementById(objIcon.id.replace("imgIcon", "div"));
    objDiv.style.display = "";
    
    //add iframe to cover dropdownlist
    var objIframe = document.getElementById(objIcon.id.replace("imgIcon", "iframe"));
   
    if (objIframe != null)
    {
        objIframe.style.top = objDiv.style.top;
        objIframe.style.left = objDiv.style.left;
        objIframe.style.width = objDiv.offsetWidth;
        objIframe.style.height = objDiv.offsetHeight;
        objIframe.style.marginTop = "21px";
        objIframe.style.marginLeft = "-11px";
        objIframe.style.zIndex = "999";
        objIframe.style.display = "";
        objDiv.style.zIndex = "1000";
     }
    
}

function common_hideHelpDiv(objIcon)
{
    objIcon.src = objIcon.src.replace("Hover", "Off");
    
    var objDiv = document.getElementById(objIcon.id.replace("imgIcon", "div"));
    objDiv.style.display = "none";
    
    var objIframe = document.getElementById(objIcon.id.replace("imgIcon", "iframe"));
    if (objIframe != null)
    {
        objIframe.style.display="none";
    }
}


function trim(s)
{
	return s.replace(/^\s+|\s+$/g,"");
}

function confirmDelete(msg)
{
  if (confirm(msg)==true)
    return true;
  else
    return false;
}

function common_getLeft(nObjWidth)
{
    var scrollx = (document.all)?document.documentElement.scrollLeft:window.pageXOffset; 
   
    var frameWidth;
    
    if (self.innerWidth)
    {
	    frameWidth = self.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
	    frameWidth = document.documentElement.clientWidth;
    }
    else if (document.body)
    {
	    frameWidth = document.body.clientWidth;
    }
    
    return ((frameWidth - nObjWidth) / 2 + scrollx)+ "px";
    
}

function common_getTop(nObjHeight)
{
    var scrolly  = (document.all)?document.documentElement.scrollTop:window.pageYOffset; 
   
    var frameHeight;
    
    if (self.innerWidth)
    {
	    frameHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
	    frameHeight = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
	    frameHeight = document.body.clientHeight;
    }
    
    return ((frameHeight - nObjHeight) / 2 + scrolly)+ "px";
    
}

