var NS = (document.layers) ? true: false;
var IE = (document.all) ? true: false;
if (NS){
}
if (IE){
var timerID
function StopBackground() {
  clearTimeout(timerID)
}

function AnimateBackground(hPos,vPos,hInc,vInc,delay) {
  if (arguments[5])
    document.body.style.backgroundImage = "url(\"" + arguments[5] + "\")"

  if (arguments[6])
    document.body.style.backgroundRepeat = arguments[6]

  if (!isNaN(hPos)) {
    if ((hInc!=0) && (hPos>0)) hPos=-100000
    hPos+=hInc 
  } 
  if (!isNaN(vPos)) {
    if ((vInc!=0) && (vPos>0)) vPos=-100000
    vPos+= vInc
  }

  document.body.style.backgroundPosition= hPos + " " + vPos
  if (isNaN(hPos))  hPos = "\"" + hPos + "\""
  if (isNaN(vPos)) vPos = "\"" + vPos + "\""
  timerID = setTimeout("AnimateBackground("+hPos+","+vPos+","+hInc+","+vInc+","+delay+")",delay)
}

AnimateBackground(0,"Top",-1,0,30, "thisbg.jpg","repeat-x")

function getValue(el) {
  for (var i=0; i < el.length; i++) {
    if (el[i].checked) return el[i].value
  }
  return ""
}

var On=1
function ReStart(){
   if (On == 1){
	StopBackground()
	On = 0
	document.bttn.src="bttn2.jpg"
   }
   else if (On == 0){
	AnimateBackground(0,"Top",-1,0,30, "thisbg.jpg","repeat-x")
	On = 1
	document.bttn.src="bttn1.jpg"
   }

}


function Update() {
  var repeat = getValue(document.all.repeatDirection)
  var hDir = getValue(document.all.horizDir)
  var hStep = 0
  if (hDir=="absolute") {
    hDir = parseInt(document.all.horizValue.value)
    hStep = parseInt(document.all.horizStep.value)
  }
  var vDir = getValue(document.all.verDir)
  var vStep = 0
  if (vDir=="absolute") {
    vDir = parseInt(document.all.verValue.value)
    vStep = parseInt(document.all.verStep.value)
  }
  StopBackground()

  AnimateBackground(hDir,vDir,hStep,vStep,parseInt(document.all.speed.value),document.all.img.value,repeat)
  if (isNaN(hDir)) hDir = "\"" + hDir + "\""
  if (isNaN(vDir)) vDir = "\"" + vDir + "\""
  var scode="AnimateBackground(" + hDir + "," + vDir + "," + hStep+ "," + vStep + "," + parseInt(document.all.speed.value) + ",\"" + document.all.img.value + "\",\"" + repeat + "\")"
  document.all.output.innerHTML = scode
}
}
