function openWindow(windowlocation, windowname, windowproperties) {
  if (windowproperties == null) {
    windowproperties = "resizable,width=800,height=600,scrollbars";
  }
  newwin = window.open(windowlocation+'&windowname='+windowname, windowname, windowproperties);
  newwin.focus();
  return false;
}

/**
 * Reload the root window of a popup stack (f.i. to show applied changes)
 */
function reloadRootWindow() {
  var root = window;
  while(root.opener) {
    root = root.opener;
  }
  root.location.reload();
}

/**
 * Reload the parent window of a popup  (f.i. to show applied changes)
 */
function reloadParentWindow() {
  if(window.opener) {
    window.opener.location.reload();
  }
  
}

function reloadRecursiveParents() {
  var root = window;
  while(root.opener) {
    root = root.opener;
    root.location.reload();
  }
}

/**
 *  returns the value of the requested get variable.
 */
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];    
    }  
  }   
  alert('Query Variable ' + variable + ' not found');
} 
