function moveItem(sRef)
{
  var width = ((window.innerWidth) ? window.innerWidth : document.body.clientWidth) - 23;

  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 = '0';
  layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=0)");
  document.body.appendChild(layer);  

  var div = document.createElement('div');
  div.style.zIndex = 3;
  div.id = 'box';
  div.style.position = 'absolute';
  div.style.top = '230px';
  div.style.left = (width / 2) - (350 / 2) + 'px'; 
  div.style.height = '100px';
  div.style.width = '350px';
  div.style.backgroundColor = '#6d5331';
  div.style.border = '2px solid white';
  div.style.padding = '0px';
  document.body.appendChild(div);

  var a = document.createElement('a');
  a.innerHTML = '<table width="100%" height="100%" border="0" cellpadding="15" cellspacing="0"><tr><td align="center" valign="middle">' +
    '<form><table border="0" cellpadding="5" cellspacing="0">' +
    '<tr><td>Move ' + sRef + ' to:</td>' +
    '<td><select id="mode"><option value="L">Learning</option>' +
    '<option value="F">Draw Deck</option><option value="A">Archive</option></select></td></tr>' +
    '<tr><td colspan="2" align="center"><button type="button" onClick="okMoveItem(\'' + sRef + '\')">&nbsp; OK &nbsp;</button>' +
    ' &nbsp; <button type="button" onClick="closeMoveItem()">Cancel</button></td>' +
    '</tr></table></form></td></tr></table>';
  div.appendChild(a);
}
function okMoveItem(sRef) 
{
  var xmlhttp = getXmlHttpObject();
  var sType = 'V';
  var sMode = document.getElementById('mode').value;
  xmlhttp.open('POST', 'moveitem.php?ref=' + sRef + '&tid=' + sType + '&mid=' + sMode, false);
  xmlhttp.send(null);
  closeMoveItem();
  window.location.reload();
}
function closeMoveItem() 
{
  document.body.removeChild(document.getElementById('layer'));
  document.body.removeChild(document.getElementById('box'));
}
