function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
}

//------------------------------------------------
//-- H T M L _ G E T   E L E M E N T
function html_GetElement(pNd){
  try{
    var node;
    switch(typeof (pNd)){
      case 'string':node = document.getElementById(pNd); break;
      case 'object':node = pNd; break;
      default:node = false; break;
    }
    return node;
  }catch(e){return false;}
 }

//------------------------------------------------
//-- N E W W I N
function newWin(url_path, win_width, win_height, win_name, win_scroll)
{
  newWindow =
window.open(url_path,win_name,config="resizable=yes,scrollbars="+
win_scroll+",screenX=50,screenY=50,left=50,top=50,width="+
win_width+",height="+win_height);
newWindow.focus();
}

//------------------------------------------------
//-- N E W R W I N
function newRWin(url_path, win_width, win_height, win_name, win_scroll)
{
  var scrollbar = 'no';
  if (!win_scroll) {
    scrollbar = 'yes';
  }

  newWindow =
window.open(url_path,win_name,config="resizable=yes,scrollbars="+scrollbar+",screenX=50,screenY=50,left=50,top=50,width="+
win_width+",height="+win_height);
  newWindow.focus();
}

//------------------------------------------------
//-- N E W V W I N
function newVWin(url_path, win_width, win_height, win_name, win_scroll)
{
  newWindow =
window.open(url_path,win_name,config="resizable=yes,scrollbars="+
win_scroll+",screenX=355,screenY=312,left=355,top=312,width="+
win_width+",height="+win_height);
newWindow.focus();
}

function changeDivHeight() {
  
  var wh; //defined for window height
  var h; //defined for height amount to add to bottom_margin region after calculated

  //get height of topfull area and put it into top variable
  if (!document.getElementById('topfull')){return;}

  if (!document.getElementById('topfull').offsetHeight) {
    var top = 0;
  }
  else {
    var top = document.getElementById('topfull').offsetHeight;
   }

  //get height of subtabs area and put it into subtabs variable
  var subtabs = document.getElementById('subtabsBg').offsetHeight;

  //get height of mainBg area and put it into main variable
  var main = document.getElementById('mainBg').offsetHeight;
  
  //get height of bottomfull area and put it into top variable
  var bottom = document.getElementById('bottomfull').offsetHeight;
  
  //add height of 4 outer-most divs that define the page height to determine page height variable
  var ph  = top + subtabs + main + bottom; //defined as "page height" variable

  //determine the window's height  
  if (self.innerHeight)
	{
		wh = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		wh = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		wh = document.body.clientHeight;
	}
	else return;
  
  //height to add to bottom_margin region is window height - page height
  h = wh - ph;
  
  //if height is less than 10 make it 10 to keep the bottom margin's 
  //10px of space between page text end and footer begin
  if (h < 10){
    h = 10;
  }
  
  //Now that we have the correct height amount we can redefine the height of the bottom_margin region
  document.getElementById('bottom_margin').style.height = h + "px";
  return;
}
onload = changeDivHeight;
