function rotateText(el, textGroup) {
  setOpacity(el, 0);
  var t = rotateText.texts[textGroup];
  el.innerHTML = t;
  unfadeText(el, textGroup);
}
rotateText.texts = {
  gallery1: [
    "Paintings associated with Old Films"
     ],
  gallery2: [
    "Paintings associated with Horse Racing"
     ],
 gallery3: [
    "Paintings associated with Animals"
     ],
 gallery4: [
    "Paintings associated with Water"
     ],
  gallery5: [
    "A mixed bag of Paintings"
     ],
  gallery6: [
    "Paintings associated with Old Films"
     ],
  gallery7: [
    "Paintings associated with Birds"
     ],
  gallery8: [
    "Paintings associated with Transport"
     ],	 
   Latest: [
    "Progression of my Latest Paintings"
     ]	 
};

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);
    setTimeout(bundleFunction(null, fadeText, [el, tg]), 2000);
    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);
  };
}rotate1.html


