function rotateText(el, textGroup) {
  setOpacity(el, 0);
  var t = rotateText.texts[textGroup];
  var t = t[Math.floor(Math.random() * (t.length - 1))];
  el.innerHTML = t;
  unfadeText(el, textGroup);
}

rotateText.texts = {
  quotes: [
    "\"Addiction is that force which lives in the gap between perfection and reality.\"<br>&nbsp;&nbsp;&nbsp;   --Marion Woodman",
    "\"The dream is the small hidden door in the deepest and most intimate sanctum of the soul.\"<br>&nbsp;&nbsp;&nbsp;  -- Carl Jung",
    "\"Everything that irritates us about others can lead us to a better understanding of ourselves.\"<br>&nbsp;&nbsp;&nbsp;  --Carl Jung",
    "\"As far as we can discern, the sole purpose of human existence is to kindle a light in the darkness of mere being.\"<br>&nbsp;&nbsp;&nbsp;--Carl Jung",
    "\"An eye for an eye makes the whole world blind.\"<br>&nbsp;&nbsp;&nbsp;--Mahatma Gandhi",
    "\"I tell you that I have a long way to go before I am where one begins.\"<br>&nbsp;&nbsp;&nbsp;--Reiner Maria Rilke"
  ],

  images: [
    "\<img src=\"images\/mandala.gif\" ALIGN=\"center\" width=\"170px\"\>",
    "\<img src=\"images\/stream.jpg\" ALIGN=\"center\" width=\"170px\"\>",
    "\<img src=\"images\/radiant_2.jpg\" ALIGN=\"center\" width=\"170px\"\>",
    "\<img src=\"images\/succulent_1.jpg\" ALIGN=\"center\" width=\"170px\"\>",
    "\<img src=\"images\/tree_portrait_1.jpg\" ALIGN=\"center\" width=\"170px\"\>",
    "\<img src=\"images\/genesis.jpg\" ALIGN=\"center\" width=\"170px\"\>",
    "\<img src=\"images\/genesis.jpg\" ALIGN=\"center\" width=\"170px\"\>"
  ]
};

function setOpacity(el, value) {
  el.style.opacity = value / 100;
  el.style.filter = "alpha(opacity=" + value + ")";
}

function unfadeText(el, tg) {
  var v = el.style.opacity * 100 + 1;
  if(v > 100) {
    setOpacity(el, 100);
    //to change how long each quote stays on the screen, change the value at the end of the next line
    setTimeout(bundleFunction(null, fadeText, [el, tg]), 10000);
    return;
  }
  setOpacity(el, v);
  setTimeout(bundleFunction(null, unfadeText, [el, tg]), 10);
}

function fadeText(el, tg) {
  var v = el.style.opacity * 100 - 1;
  if(v < 0) {
    setOpacity(el, 0);
    rotateText(el, tg);
    //or... setTimeout(bundleFunction(null, rotateText, [el, tg]), NUMBER);
    return;
  }
  setOpacity(el, v);
  setTimeout(bundleFunction(null, fadeText, [el, tg]), 10);
}

function bundleFunction(context, func, args) {
  context = context || null;
  if(typeof func == "string" && context)
    func = context[func];
  if(!args)
    args = [];
  else if(!(args instanceof Array))
    args = [args];
  return function() {
    return func.apply(context, args);
  };
}