var gshd_floatingPanels = [];
var gshd_fltPnlCnt = 0;
    
function gshd_addPanel(panelName)
{
  gshd_floatingPanels[gshd_fltPnlCnt] = panelName;
  gshd_fltPnlCnt++;
}
    
function gshd_getWindowheight()
{ 
  var windowheight = 0; 
  if (document.documentElement && document.documentElement.clientHeight) 
  { 
    windowheight = document.documentElement.clientHeight + document.documentElement.scrollTop;
      
    //mod for safari as it uses a mix for the size adjustment
    if (document.body.scrollTop)
    {
      windowheight = windowheight + document.body.scrollTop;
    }       
  } 
  else 
  { 
    if (document.body && document.body.clientHeight) 
    { 
      windowheight = document.body.clientHeight + document.body.scrollTop;
    }
  } 
  
  return windowheight; 
} 
    
function gshd_getWindowwidth()
{ 
  var windowwidth = 0; 
  if (document.documentElement && document.documentElement.clientWidth) 
  { 
    windowwidth = document.documentElement.clientWidth + document.documentElement.scrollLeft; 
      
    //mod for safari as it uses a mix for the size adjustment
    if (document.body.scrollLeft)
    {
      windowwidth = windowwidth + document.body.scrollLeft;
    }
  } 
  else 
  { 
    if (document.body && document.body.clientWidth) 
    { 
      windowwidth = document.body.clientWidth + document.body.scrollLeft; 
    } 
  } 

  return windowwidth; 
} 
    
function gshd_setWrap() 
{ 
  if (document.getElementById) 
  { 
    var windowheight = gshd_getWindowheight(); 
    var windowwidth = gshd_getWindowwidth();
       
    if (windowheight > 0 && windowwidth >0) 
    { 
      //modify if more shaders are added
      for (var i=0; i<gshd_fltPnlCnt;i++)
      {
        if (document.getElementById(gshd_floatingPanels[i]))
        {
          var wrapElement = document.getElementById(gshd_floatingPanels[i]); 
          wrapElement.style.position = 'absolute'; 
          wrapElement.style.height = (windowheight) + 'px'; 
          wrapElement.style.width = (windowwidth) + 'px'; 
        }
      }
    } 
  } 
}
    
window.onload = function() 
{ 
  gshd_setWrap(); 
} 
    
window.onresize = function() 
{ 
  gshd_setWrap(); 
} 
    
window.onscroll = function()
{
  gshd_setWrap();
}

