/*	maxq = number of imagesto cycle through
	waittime = milliseconds to wait before fading to next
	fadeincr = amount to fade
	fadewait = time between each fade increment
*/
var currq, nextq, maxq = 3, iter = 10, waittime = 11000, fadeincr = .05, fadewait = 100, qfader, qtimer

  function initquote()
  { stretchright()	// match lengths of divs (onload function unrelated to quotes)
    nextq = 1
    var obj = document.getElementById("home_quote_1")
//    obj.style.position = "absolute"
    obj.style.opacity = 1		// set first quote opaque
    if (obj.filters) { obj.filters.alpha.opacity = 100 }
    for ( var i = 2; i <= maxq; i++)	// set others transparent
    { obj = document.getElementById("home_quote_" + i)
//      obj.style.position = "absolute"
      obj.style.opacity = 0
      if (obj.filters) { obj.filters.alpha.opacity = 0 }
    }
    qtimer = window.setTimeout(swapquote, waittime)
  }

  function swapquote()
  { currq = nextq
    nextq++
    if (nextq > maxq)
    { nextq = 1
      iter--
    }
    if (iter > 0) { qfader = setInterval(fade, fadewait) }	// if more iterations, re-initiate the timer
  }

  function fade()
  { var opac
    currobj = document.getElementById("home_quote_" + currq)
    nextobj = document.getElementById("home_quote_" + nextq)
    opac = parseFloat(currobj.style.opacity) - parseFloat(fadeincr)
    currobj.style.opacity = opac
    if (currobj.filters) { currobj.filters.alpha.opacity = (opac * 100) }
    opac = parseFloat(nextobj.style.opacity) + parseFloat(fadeincr)
    nextobj.style.opacity = opac
    if (nextobj.filters) { nextobj.filters.alpha.opacity = (opac * 100) }
    if (nextobj.style.opacity >= 1)
    {  window.clearInterval(qfader)
       qtimer = window.setTimeout(swapquote, waittime)
    }
  }

