
function editWidget(pagename,popupwidth,popupheight)
{

    KEYwebRoot="/";
  window.scrollTo(0, 0);
  var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
	var height = document.documentElement.clientHeight + document.documentElement.scrollTop;

  var layer = document.createElement('div');
  layer.style.zIndex = 2;
  layer.id = 'layer';
  layer.style.position = 'absolute';
  layer.style.top = '0px';
  layer.style.left = '0px';
  layer.style.height = document.documentElement.scrollHeight + 'px';
  layer.style.width = width + 'px';
  layer.style.backgroundColor = 'black';
  layer.style.opacity = '.6';
  layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
  document.body.style.position = 'static';
  document.body.appendChild(layer);     
  var size = { 'height': popupheight, 'width': popupwidth };  
  
  
  var iframe = document.createElement('iframe');
  iframe.name = 'Widget Editor';
  iframe.id = 'WidgetEditor';
	iframe.src = KEYwebRoot + pagename;
	iframe.style.height = size.height + 'px';
	iframe.style.width = size.width + 'px';
	iframe.style.position = 'fixed';
	iframe.style.zIndex = 3;
	iframe.style.backgroundColor = 'white';
	iframe.style.border = '4px solid silver';
	iframe.frameborder = '0';	
	
	iframe.style.top = ((height + document.documentElement.scrollTop) / 2) - (size.height / 2) + 'px';
	iframe.style.left = (width / 2) - (size.width / 2) + 'px';	
	
  document.body.appendChild(iframe);  
}


function closeEditor()
{
   var we = document.getElementById("WidgetEditor");
   var ly = document.getElementById("layer");
   
  document.body.removeChild(we);
  document.body.removeChild(ly);
  document.body.style.position = '';
}