
GB_show_noload = function(caption, url, /* optional */ width, height, callback_fn) {
    var options = {
        caption: caption,
        height: height || 500,
        width: width || 500,
        fullscreen: false,
        show_loading: false,
        callback_fn: callback_fn,
        reload_on_close: false,
        center_win: true
    }
    var win = new GB_Window(options);
    return win.show(url);
}

function LoadingScreen(contentdiv)
{
    var ajaxArea = document.getElementById(contentdiv);
    if (ajaxArea)
    {
        var height = GetHeight(ajaxArea) + 40;
        var width = GetWidth(ajaxArea);
        var parenttop = GetTop(ajaxArea);
        var parentleft = GetLeft(ajaxArea);
        
     
        
        var loadingtop = Math.round(height/2);
        var loadingleft = Math.round(width/2) - 64;
        
        var overlay = document.createElement("div");
        var loadingpic = document.createElement("img");
        overlay.setAttribute("id", "overlayloading");
        overlay.style.position = "absolute";
        overlay.style.top = "0px";
        overlay.style.left = "0px";
        overlay.style.height = height + "px";
        overlay.style.width = width + "px";
        overlay.style.backgroundColor = "#FFFFFF";
        SetOpacity(overlay, 50);
        loadingpic.setAttribute("src", "images/ajax-loader.gif");
        loadingpic.style.paddingTop =  loadingtop + "px";
        loadingpic.style.paddingLeft = loadingleft + "px";
        overlay.appendChild(loadingpic);
        ajaxArea.appendChild(overlay);
       
    }
}
function SetOpacity(elem, opacityAsInt)
{
    var opacityAsDecimal = opacityAsInt;
    
    if (opacityAsInt > 100)
        opacityAsInt = opacityAsDecimal = 100; 
    else if (opacityAsInt < 0)
        opacityAsInt = opacityAsDecimal = 0; 
    
    opacityAsDecimal /= 100;
    if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
    
    elem.style.opacity = (opacityAsDecimal);
    elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}

function GetLeft(ele)
{
	if (ele.offsetParent)
		return ele.offsetLeft + GetLeft(ele.offsetParent);
	else
		return ele.offsetLeft;
}

function GetHeight(ele)
{
    if (ele)
        return ele.offsetHeight;
    return 0;
}

function GetWidth(ele)
{
    if (ele)
        return ele.offsetWidth;
    return 0;
}

function GetTop(ele)
{
	if (ele.offsetParent)
		return (ele.offsetTop + GetTop(ele.offsetParent));
	else
		return (ele.offsetTop);
}
function getPosition(element)
 {
  var elem=element,tagname="",x=0,y=0;

  while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined"))
  {
    y+=elem.offsetTop;
    x+=elem.offsetLeft;
    tagname=elem.tagName.toUpperCase();

    if (tagname=="BODY")
      elem=0;

    if (typeof(elem)=="object")
      if (typeof(elem.offsetParent)=="object")
        elem=elem.offsetParent;
  }

  position=new Object();
  position.x=x;
  position.y=y;
  return position;
 }
