var vertPos;
var horizPos;
var vertMax=200;
var horizMax=30;
var bgState=0;
var bgEventDelay = 3000;	// 3 second delay

function movebg_event()
  {
  var objectStyle;
  var posString;

  switch(bgState)
    {

    default:		// state 0 => increment vertical until equal vertMax
    case 0:
    vertPos++;		// Increment position 1 px.
    if (vertPos == vertMax) bgState=1;  // transition to change horiz (1)
    break;

    case 1:
    horizPos++;		// increrment horizontal
    if (horizPos == horizMax) bgState=2;	// go to decrement vertical
    break;

    case 2:					// decrement vertical
    vertPos--;
    if (!vertPos) bgState=3;
    break;
    
    case 3:					// decrement horizontal
    horizPos--;
    if (!horizPos) bgState=0;			// back to incr vert.
    break;
    };						// end of switch        

  posString = "-" + horizPos + "px -" + vertPos + "px";  
//  window.alert("Position string is: " + posString);

  objectStyle=document.getElementById("mainsec").style;
  objectStyle.backgroundPosition = posString;
  setTimeout('movebg_event()', bgEventDelay);
  }

function bg_move_startUp()
  {
  horizPos=0;
  vertPos=0;

//  window.alert("startup event");   // debug
  setTimeout('movebg_event()', bgEventDelay);
  }
