function apply_stylesheet(sheet, iframe){
  var cssLink = document.createElement("link")
  cssLink.href = sheet;
  cssLink.rel = "stylesheet";
  cssLink.type = "text/css";
  
  //Instead of this
  //frames['frame1'].document.body.appendChild(cssLink);
  //Do this
 
  var doc = document.getElementById(iframe).contentWindow.document
  
  ///If you are doing any dynamic writing do that first
  
  //doc.open;
  //doc.write(myData);
  //doc.close();
  
  //Then append child
  doc.firstChild.appendChild(cssLink);
}


function edit_comments()
{
  var ce = document.getElementById('comments_edit');
  var c = document.getElementById('comments_b');
  ce.style.display = 'block';
  c.style.display = 'none';
}

function cancel_edit_comments()
{
  var ce = document.getElementById('comments_edit');
  var c = document.getElementById('comments_b');
  ce.style.display = 'none';
  c.style.display = 'block';
}

function print_contract()
{
  var rel = document.getElementById('closest_relative');
  if (rel.innerHTML == '')
    alert('Muokkaa ensin lomaketta ja anna lähiomaisen nimi!');
  else
    window.print();
}


