var div_title;

function info(event, pic){
  if(!div_title){
    div_title = document.createElement('div');
    div_title.appendChild(document.createTextNode(''));
    div_title.className = 'info';
    div_title.desc = null;
    document.body.appendChild(div_title);
  }
  if(!div_title.desc){
    status = div_title.style.display;
    div_title.style.display = 'none';
  } else {
    div_title.style.display = 'block';
    div_title.style.top = (event.clientY + document.body.scrollTop + 4) + 'px';
    div_title.style.left = (event.clientX + document.body.scrollLeft + 19) + 'px';
    div_title.firstChild.nodeValue = div_title.desc;
  }
}

function set_info(title){
  if(!div_title) return;
  div_title.desc = title ? title : null;
}

var scrolling = {
  total:10,
  count:20,
  i:0,
  width:0,
  x:0,
  interval:null,
  slide:function(x){
    this.x = x;
    this.i = 0;
    this.width = this.x - document.body.scrollLeft;
    if(this.interval) clearInterval(this.interval);
    this.interval = setInterval('scrolling.scroll()', this.total);
  },
  scroll:function(){
    if(++ this.i > this.count) return this.stop();
    var x = Math.round(((this.i) * this.width / this.count) + this.x - this.width);
    //alert(this.i + ' / ' + x + '(' + (this.x - this.width) + '-' + this.x + ')');
    window.scrollTo(x, document.body.scrollTop);
  },
  stop:function(){
    this.i = 0;
    clearInterval(this.interval);
  }
}

function slide(x){
  scrolling.slide(x);
}
