var $ = function (id) {
  return document.getElementById(id);
};

var fader = new function () {
  var _this = this;
  var incr = 0;
  var titleNode;
  var textNode;
  this.textArray = [
    {
      title: 'OUR EXPERIENCE',
      text: 'We have coordinated the stays of visitors from Africa; Europe; South America; Central, South, and East Asia; and the Middle East.'
    },
    {
      title: 'LSI IN BRIEF',
      text: 'We help your company&#8217;s international visitors adjust to new cultural and business environments during their stay.'
    },
    {
      title: 'WHO WE CAN HELP',
      text: 'LSI assists international visitors on assignment to train, study, attend meetings, or work on a short- or long-term basis.'
    }
  ];
  this.init = function () {
    titleNode = $('faderTitleContent');
    textNode = $('faderTextContent');
    this.doFadeIn();
  };
  this.doFadeIn = function () {
    var t = _this.textArray[incr];
    fleegix.fx.setCSSProp(titleNode, 'opacity', 0);
    titleNode.innerHTML = t.title;
    titleNode.style.visibility = 'visible';
    fleegix.fx.fadeIn(titleNode, { duration: 1000 });
    fleegix.fx.setCSSProp(textNode, 'opacity', 0);
    textNode.innerHTML = '&#8220;' + t.text + '&#8221;';
    textNode.style.visibility = 'visible';
    fleegix.fx.fadeIn(textNode, { duration: 1000 });
    incr++;
    incr = incr == _this.textArray.length ? 0 : incr;
    setTimeout(_this.doFadeOut, 7000);
  };
  this.doFadeOut = function () {
    var t = _this.textArray[incr];
    fleegix.fx.fadeOut(titleNode, { duration: 700 });
    fleegix.fx.fadeOut(textNode, { duration: 700 });
    setTimeout(_this.doFadeIn, 1000);
  };
};

fleegix.event.listen(window, 'onload', fader, 'init');


