xa = new xAnimation();
xb = new xAnimation();
window.onload = function(){
  initBtns(btnOnClick);
  demo0();
};
window.onunload = function(){
  initBtns(null);
  xa = null;
};
function initBtns(handler){
  var i, a = xGetElementsByClassName('jsBtn');
  for (i = 0; i < a.length; ++i) { a[i].onclick = handler; }
}
function btnOnClick(){
  var m = this.id;
  if (m.indexOf('demo') != -1) {
    xa.pause();
    resetProps();
    window[m]();
  }
  else {
    xa[m]();
  }
}

/*

  xa.css('d0', 'letter-spacing', 10, 2000, 1, 1, function(a) {
    a.css('d1', 'line-height', 50, 2000, 1, 1, function(a) {
      a.css('d2', 'font-size', 30, 2000, 1, 1, function() {
        demo0();
      });
    });
  });*/
function demo0()
{

xa.css('d3', 'letter-spacing', 14, 4500, 1, 1,function(a) {      
  xa.css('d0', 'font-size', 25, 3000, 1, 1,function(a) {      
    xa.css('d1', 'font-size', 35, 6500, 1, 1,function(a) {
      xa.css('d2', 'font-size', 45, 2500, 1, 1,function() {
        demo0();
      });
    });
  });
});
//xa.css('d1', 'font-size', 15, 1500, 1, 1,'1');
//xa.css('d2', 'font-size', 30, 2000, 1, 1,'1');

}
function resetProps()
{
  var i=0, s, e = xGetElementById('d0');
  while (e) {
    s = e.style;
    s.letterSpacing = '1px';
    s.lineHeight = '16px';
    s.fontSize = '12px';
    e = xGetElementById('d' + (++i));
  }
  e = xGetElementById('dc0');
  s = e.style;
  s.borderWidth = '1px';
  s.wordSpacing = '0px';
}
