function rotateText(el, textGroup) {
	if(el != null)
	{
    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: [
    " \"Winvian is honored to be included as one of Conde Nast Traveler's Hot List Picks.\" ",
    "Andrew Harper features Winvian on its List of Top 20 U.S. Hideaways.",
    " \"over-the-top\" -New York Times ",
    "\"Nothing I've ever seen quite prepared me for Winvian.\" -John Mariani",
    "\"Best Place for a cozy weekend\" -In Style Magazine",
    "\"Serious luxury with a lighthearted vibe\" -Forbes",
    "\"A swanky Relais & Chateaux compound nestled in Litchfield Hills, CT\" -Daily Candy",
    "\"A two hour drive from New York City, the ultimate in country-spa chic\" -Departures",
    "\"Winvian-113 acres of Norman Rockwell meets Alice in Wonderland\" -Departures",
    "\"Behind the gates of this 113-acre oasis lies a world of adventure\" -Boston Common",
    "\"Into the Woods & Over the Top\" -Executive Traveler",
    "\"Winvian breaks the mold with the greatest of ease\" -Inn. Souciant",
    "\"A Testament to ingenuity\" -Celebrated Living Magazine",
    "\"Winvian is the ultimate destination Spa\" -GQ",
    "\"On higher ground, luxe new Connecticut resort\" -Vogue",
    "\"Top stays for outdoor types\" -Boston Magazine",
    "\"5 Stars ... Extraordinary\" -RestaurantsCT.com",
    "\"Playtime for grown-ups\" -Conde Nast Traveler",
    "\"Humor is everywhere\" -New York Post",
    "\"Unaccustomed Elegance\" -Lufthansa Magazine",
    "\"Bucolic Bliss\" -Harpers Bazaar",
    "\"Far-Flung and Fabulous\" -Meetings and Conventions",
    "\"A hidden place that unveiled astonishment after astonishment\" -Travel + Leisure",
	"\"The childhood dens you never had...\" -Sunday Times of London Travel"
  ],
  authors: [
    "Mark Twain",
    "Charles Dickens",
    "Edgar Allen Poe"
  ],
  restaurants: [
    "Burger King",
    "McDonalds",
    "Taco Bell",
    "Wendy's"
  ]
};

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]), 4000);
    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);
  };
}
