//id of placeholder element
var targetId = "postinclude";

//path to file you want including
var fileName = "post.html";

//auto update preview on save?
var autoUpdate = false;

//----------------------------------------------

function jsInclude() {
  var req = false;
  if(window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  }
  var element = document.getElementById(targetId);
  if(!element) {
    alert("The targetId \"" + targetId + "\" was not found. " + 
  	      "Check that the placeholder ID in your HTML " + 
  	      "matches the targetId variable.");
  	clearInterval(updatePreview);
    return;
  }
  if (req) {
    req.open('GET', fileName, false);
    req.send(null);
    element.innerHTML = req.responseText;
  }
}

function addLoadEvent(func)
{    
  var oldonload = window.onload;
  if(typeof window.onload != 'function')
  {
    window.onload = func;
  } 
  else 
  {
    window.onload = function()
    {
      oldonload();
      func();
    }
  }
}

addLoadEvent(jsInclude);

if (autoUpdate) {
  var updatePreview = setInterval("jsInclude()", 1000);
}