// JavaScrit Document
function truncate() {

  var leng = 100;
  var p = document.getElementById('truncateMe');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate2() {

  var leng = 100;
  var p = document.getElementById('truncateMe2');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate3() {

  var leng = 100;
  var p = document.getElementById('truncateMe3');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate4() {

  var leng = 100;
  var p = document.getElementById('truncateMe4');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate5() {

  var leng = 100;
  var p = document.getElementById('truncateMe5');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate6() {

  var leng = 100;
  var p = document.getElementById('truncateMe6');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate7() {

  var leng = 100;
  var p = document.getElementById('truncateMe7');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}

function truncate8() {

  var leng = 100;
  var p = document.getElementById('truncateMe8');
  if (p) {
    var trunc = p.innerHTML;
    if (trunc.length > leng) {

      /* Truncate the content of the P, then go back to the end of the
         previous word to ensure that we don't truncate in the middle of
         a word */
      trunc = trunc.substring(0, leng);
      trunc = trunc.replace(/w+$/, '');

      /* Add an ellipses to the end and make it a link that expands
         the paragraph back to its original size*/ 
      trunc += '<a href="#" ' +
        'onclick="this.parentNode.innerHTML=' +
        'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
        '...</a>';
      p.innerHTML = trunc;
    }
  }
}
// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  truncate();
  truncate2();
  truncate3();
  truncate4();
  truncate5();
  truncate6();
  truncate7();
  truncate8();
});