function changePopupClass()
{
  if (!document.getElementById || !screen.width || !screen.height) {
    return false;
  }
  
  var a = document.getElementById('newWindowEighty');
  if (a == null) {
  	return false;
  }

  var w = screen.width;
  var h = screen.height;
  
  if (isNaN(w)) {
  	w = 800;
  }
  
  if (isNaN(h)) {
  	h = 600;
  }

  if (window.innerWidth && typeof(window.innerWidth) == 'number') {
    w = window.innerWidth;
    h = window.innerHeight;
  } else if (document.documentElement && (document.documentElement.clientWidth && document.documentElement.clientHeight)) {
    w = document.documentElement.clientWidth;
    h = document.documentElement.clientHeight;
  }

	var original_w = w;
	var original_h = h;
	
  w = parseInt((w * 80) / 100);
  h = parseInt((h * 80) / 100);


  
  var str = a.className;
  var i = -2;
  var count = 0;
  
  do {
  	i = str.indexOf('p');
  	if (i == -1) {
  		break;
  	}
  	if (str.substr(i, 5) == "popup") {
  		a.className = str.substring(0, i) + " popup?_width:" + w + "$_height:" + h + "$_status:yes$_menubar:yes$_scrollbars:yes$_toolbar:yes";
  		break;
  	}
  } while (i = str.indexOf('p') && --count > str.len);

  document.getElementById('debug').innerHTML =  "<p><b>This window's width:</b> " + original_w + "<br><b>This window's height:</b> " + original_h;
  document.getElementById('debug').innerHTML += "<b>New window's width:</b> " + w + "<br><b>New window's height:</b> " + h + "</p>";
  document.getElementById('debug').innerHTML += "<p><b>className for popup.js:</b> " + a.className + "</p>";

  return true;
}

addEvent(window, 'load', changePopupClass);
addEvent(window, 'resize', changePopupClass);
