function showquote(quote)
{ var width
  width = parseFloat(sliderwidth) + parseFloat(stopleft) - 40		// extra 40px is for margins
  document.getElementById('quotes').style.width = width + "px"
  fadein(quote,'qt')
  setTimeout("hidequote('"+quote+"')",quotedelay)
}

function hidequote(quote)
{ if (imgnum < 3)
  { fadeout(quote,'qt')
    setTimeout("slideright('slider')",sliderightdelay)
  }
}

function fadein(div,type)
{ var opacity, filter, opacityincr, opacitydelay
  var obj = document.getElementById(div)

  opacityincr = eval(type + "opacityincr")
  opacitydelay = eval(type + "opacitydelay")

  opacity = obj.style.opacity
  opacity = parseFloat(opacity) + parseFloat(opacityincr)
  if (opacity > 1) opacity = 1
  filter = opacity * 100
  obj.style.opacity = opacity
  if (obj.filters) {obj.filters.alpha.opacity = filter}
  if (opacity < 1)
  { setTimeout("fadein('" + div + "','" + type + "')",opacitydelay)
  }else{
  }
}

function fadeout(div,type)
{ var opacity, filter, opacityincr, opacitydelay
  var obj = document.getElementById(div)

  opacityincr = eval(type + "opacityincr")
  opacitydelay = eval(type + "opacitydelay")

  opacity = obj.style.opacity
  opacity = parseFloat(opacity) - parseFloat(opacityincr)
  if (opacity < 0) opacity = 0
  filter = opacity * 100
  obj.style.opacity = opacity
  if (obj.filters) {obj.filters.alpha.opacity = filter}
  if (opacity > 0)
  { setTimeout("fadeout('" + div + "','" + type + "')",opacitydelay)
  }else{
  }
}

function slideright(div)
{ var position
  var obj = document.getElementById(div)
  position = obj.backgroundX
  position = parseFloat(position) + parseFloat(positionincr)
  if (position > stopright) position = stopright
  obj.backgroundX = position
  obj.style.backgroundPosition = position + "px 0"
  if (position < stopright)
  { setTimeout("slideright('"+div+"')",positiondelay)
  }else{
    imgnum++
    document.getElementById('bannerleft').style.backgroundImage = "url(" + homeimage[imgnum].src + ")"
    stopright = -(sliderwidth-document.getElementById('bannerleft').offsetWidth)
    stopleft = stopright-homeimage[imgnum].width
    setTimeout("slideleft('"+div+"')",slideleftdelay)
  }
}

function slideleft(div)
{ var position
  var obj = document.getElementById(div)
  position = obj.backgroundX
  position = parseFloat(position) - parseFloat(positionincr)
  if (position < stopleft) position = stopleft
  obj.backgroundX = position
  obj.style.backgroundPosition = position + "px 0"
  if (position > stopleft)
  { setTimeout("slideleft('"+div+"')",positiondelay)
  }else{
    if (typeof quoteid == 'undefined')
    { if (imgnum < imgmax) setTimeout("slideright('slider')",sliderightdelay)
      return;
    }
    if (quoteid.substr(2,1) != 'a')
    { quoteid = 'q' + quotenum + 'a'
    }else{
      quoteid = 'q' + quotenum + 'b'
    }
    showquote(quoteid)
  }
}

function vunroll(div)
{ var height
  var obj = document.getElementById(div)
  height = obj.offsetHeight
  height = parseFloat(height) + parseFloat(heightincr)
  if (height > obj.maxHeight) height = obj.maxHeight
  obj.style.height = height +'px'
  if (height < obj.maxHeight) setTimeout("vunroll('" + div + "')",heightdelay)
}

function hunroll(div)
{ var width
  var obj = document.getElementById(div)
  width = obj.offsetWidth
  width = parseFloat(width) + parseFloat(widthincr)
  if (width > obj.maxWidth) width = obj.maxWidth
  obj.style.width = width +'px'
  if (width < obj.maxWidth) setTimeout("hunroll('" + div + "')",widthdelay)
}

function darken(div)	// reduce opacity against a black background
{ var opacity, filter
  var obj = document.getElementById(div)

  opacity = obj.style.opacity
  opacity = parseFloat(opacity) - parseFloat(darkenincr)

  if (opacity < darkenlimit) opacity = darkenlimit
  filter = opacity * 100
  obj.style.opacity = opacity
  if (obj.filters) {obj.filters.alpha.opacity = filter}
  if (opacity > darkenlimit) setTimeout("darken('" + div + "')",darkendelay)
}
