/* Javascript */

var container_width = 0;

function rotate_header(init) {
  var container = document.getElementById('image_container');
  if (container)
  {
    if (init == "init") {
      /* Initialise ImageContainer width and position */
    
      container.style.marginLeft = "10px";
      
      for (var i = 0; i < container.childNodes.length; i++)
      {
        if (parseInt(container.childNodes[i].offsetWidth) > 0)
          container_width += container.childNodes[i].offsetWidth + 50; /* 50 for margin of the images */
      }
      
      window['set' + 'Interval']("rotate_header()", 100);
    } else {

      /* Old position */      
      var X = parseInt(container.style.marginLeft);
      
      /* Move container */
      if (X + container_width <= 0)
        container.style.marginLeft = 800 + "px";
      else
        container.style.marginLeft = (X - 10) + "px";
        
      /* Endless move it */
      return true;
    }
  }
}
