﻿function createPopupWidget(formName, params)
{
  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 = 1000;
  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': 510, 'width': 505 };
  var iframe = document.createElement('iframe');
  iframe.name = 'Article Editor';
  iframe.id = 'ArticleEditor';
	iframe.src = formName + '?' + params;
	iframe.style.height = size.height + 'px';
	iframe.style.width = size.width + 'px';
	iframe.style.position = 'absolute';
	iframe.style.zIndex = 10000;
	iframe.style.backgroundColor = 'white';
	iframe.style.border = 'none';
	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()
{
  document.body.removeChild(document.getElementById('ArticleEditor'));
  document.body.removeChild(document.getElementById('layer'));
  document.body.style.position = '';
}