function open_pwindow()
{
	var h = window.open('about:blank','Print','width=500,height=500,toolbar=1,resizable=1,scrollbars=1');
	h.document.write(document.getElementById('body').innerHTML);
}


function show_ps(id)
{
  var i;

  if(document.getElementById(id).style.display == 'none')
  {
    document.getElementById(id).style.display = 'block';
    for(i=1;i<=8;i++)
    {
      if('p'+i != id)
        document.getElementById('p'+i).style.display = 'none';
    }
  }
  else
  {
    document.getElementById(id).style.display = 'none';
  }
}


var emptyElements = {
  HR: true, BR: true, IMG: true, INPUT: true
};
var specialElements = {
  TEXTAREA: true
};
HTMLElement.prototype.outerHTML getter = function () {
  return getOuterHTML (this);
};
function getOuterHTML (node) {
  var html = '';
  switch (node.nodeType) {
    case Node.ELEMENT_NODE:
      html += '<';
      html += node.nodeName;
      if (!specialElements[node.nodeName]) {
        for (var a = 0; a < node.attributes.length; a++)
          html += ' ' + node.attributes[a].nodeName.toUpperCase() +
                  '="' + node.attributes[a].nodeValue + '"';
        html += '>';
        if (!emptyElements[node.nodeName]) {
          html += node.innerHTML;
          html += '<\/' + node.nodeName + '>';
        }
      }
      else switch (node.nodeName) {
        case 'TEXTAREA':
          for (var a = 0; a < node.attributes.length; a++)
            if (node.attributes[a].nodeName.toLowerCase() != 'value')
              html += ' ' + node.attributes[a].nodeName.toUpperCase() +
                      '="' + node.attributes[a].nodeValue + '"';
            else
              var content = node.attributes[a].nodeValue;
          html += '>';
          html += content;
          html += '<\/' + node.nodeName + '>';
          break;
      }
      break;
    case Node.TEXT_NODE:
      html += node.nodeValue;
      break;
    case Node.COMMENT_NODE:
      html += '<!' + '--' + node.nodeValue + '--' + '>';
      break;
  }
  return html;
}

