
function renderPrintFriendlyObit()
{
  var newWin;
  var t;
  var t1;
  var w;
  var h;
  var copyId;

  newWin = window.open("","","",true);
  newWin.document.open("text/html");

  newWin.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
  newWin.document.writeln("<html><head>");
  newWin.document.writeln('<style type="text/css">\n.obitArea {\n  width: 600px;\n}\n\n');
  newWin.document.writeln(  '.innerObit {\nmargin: 10px;\n}\n');
  newWin.document.writeln(  '.obitDetailsTitle {\n  width: 200px;\n}');
  newWin.document.writeln(  '.obitDetails {\n  font-weight: bold;\n}');
  newWin.document.writeln('</style>\n');
  newWin.document.writeln('  <base href="http://www.northcuttandson.com/html/">');
  newWin.document.writeln('  <title>Northcutt &amp; Son Funeral Home</title>');
  newWin.document.writeln('</head>\n<body>\n<div class="obitArea">');
  if (obitItem.picW.slice(0,1) != '_'){//have picture
    h = obitItem.picH;
    w = obitItem.picW;
    if (w > 200) {
      h = Math.floor((h * 200 / w) + 0.5);
      w = 200;
    }
    t = '<img src="../' + obitItem.picFileName + '" width="' + w + '" + height="' + h + '" align="left" style="margin-right: 15px;">\n';
    t += '<h2>' + getName(obitItem) + "</h2>\n<br clear=\"both\" />\n";
    t += '<hr />';
  } else {
    t = '<h2>' + getName(obitItem) + "</h2>\n";
  }
  newWin.document.writeln(t);

  if (obitItem.visit.length > 0  ||  obitItem.funeral.length > 0  ||  obitItem.interment.length > 0){
    t = "<table style='margin: 10px 0px 10px 0px;'>";
    t1 = "";
    if (obitItem.visit.length > 0) t1 += "<tr><td class='obitDetailsTitle'>Visitation</td><td class='obitDetails'>" +  obitItem.visit + "</td></tr>\n";
    if (obitItem.funeral.length > 0) t1 += "<tr><td class='obitDetailsTitle'>Memorial</td><td class='obitDetails'>" +  obitItem.funeral + "</td></tr>\n";
    if (obitItem.interment.length > 0) t1 += "<tr><td class='obitDetailsTitle'>Interment</td><td class='obitDetails'>" + obitItem.interment + "</td></tr>\n";
    if (obitItem.showAge){
      if (obitItem.dob.slice(0,4) != "0000" && obitItem.dod.slice(0,4) != "0000")
      t1 += "<tr><td class='obitDetailsTitle'>Age</td><td class='obitDetails>" + getAge(obitItem.dob,obitItem.dod) + "</td></tr>\n";
    }
    if (obitItem.showDOB_DOD) {
      if (obitItem.dob.slice(0,4) != "0000") t1 += "<tr><td class='obitDetailsTitle'>Born</td><td class='obitDetails'>" + renderDate("",obitItem.dob,"",1) + "</td></tr>\n";
      if (obitItem.dod.slice(0,4) != "0000") t1 += "<tr><td class='obitDetailsTitle'>Died</td><td class='obitDetails'>" + renderDate("",obitItem.dod,"",1) + "</td></tr>\n";

    }
    t += t1 + "</table>\n";
  }
  newWin.document.writeln(t);
  copyId = document.getElementById("obitCopy");
  newWin.document.writeln(copyId.innerHTML);  
  newWin.document.writeln("</div></body>\n</html>");
}



function invokeObitPF()
{
  alert("The print friendly obituary will be displayed in a pop-up.\nPlease enable pop-ups if you are using a pop-up blocker.");
  renderPrintFriendlyObit();
  return(false);
}
