<!-- Beginning of JavaScript -------------------
//
// This script uses dynamic html to demonstrate IE style filters.
// A different filter is used each day of the week.
//
// To install, insert this JavaScript into your web page header.
// Then add <img id="spotlight"> to your image.  Finally, add
// <body onload="light_init()" onunload="light_off()">.
//
// You can invoke light_init(ldow), where ldow = 0-6 (day of the week)
//
// For example, see http://www.dennisallen.com/home.htm
//
// Moving light on image script, spotlight() originally from
// © Dynamic Drive (www.dynamicdrive.com)
//
/// Last Updated: 03/06/05
//
// PUBLIC VARIABLES
// x, y, direction, delta, phaseme, ldte, ldow, lightid
//
//
function glow() {
  var olight = document.all.spotlight
  if ((olight.filters.glow.strength + delta > 20)
   || (olight.filters.glow.strength + delta < 1)) {delta = - delta}
  olight.filters.glow.strength += delta
}
//
function opac() {
  var olight = document.all.spotlight
  if ((olight.filters.alpha.opacity + delta > 100)
   || (olight.filters.alpha.opacity + delta < 10)) {delta = - delta}
  olight.filters.alpha.opacity += delta
}
//
function reveal() {
  var olight = document.all.spotlight
  if (olight.filters.revealTrans.status!=2) {
    if (direction == 1) {
      direction = 2
      var t1 = "visible" ; var t2 = "hidden"
      delta ++ ; if (delta > 22) delta = 0
    }
    else {
      direction = 1
      var t1 = "hidden" ; var t2 = "visible"
      if (delta == 17) delta = 20
      if (delta ==  0 || delta ==  2 || delta ==  4
       || delta == 6  || delta == 13 || delta == 15) {
        delta ++ ; if (delta > 22) delta = 0
      }
    }
    olight.style.visibility=t1
    olight.filters.revealTrans.Transition=delta
    olight.filters.revealTrans.apply()
    olight.style.visibility=t2
    olight.filters.revealTrans.play()
  }
}
//
function spotlight() {
  var olight = document.all.spotlight
  olight.filters.light.MoveLight(0,x,y,200,-1)

  if (x < olight.width+100 && direction == "right")
    x+=10
  else if (x > olight.width+100) {
    direction = "left"
    x-=10
  }
  else if (x < -50) {
    direction = "right"
    x+=10
  }
  else {
    direction = "left"
    x-=10
  }
}
//
function wave() {
  var olight = document.all.spotlight
  if ((olight.filters.wave.strength + delta > 7)
   || (olight.filters.wave.strength + delta < 0)) {delta = - delta}
  olight.filters.wave.strength += delta
  phaseme = (phaseme + 10) % 100
  olight.filters.wave.phase = phaseme
}
//
function light_on() {
  var flag = (document.all && window.spotlight)
  // Test for Opera
  if (flag) {flag = false ; for (var i in document) {flag = true ; break}}
  if (flag) {
    var olight = document.all.spotlight
    if (ldow == 0) {
      olight.style.filter = "light"
      x = 0 ; y = olight.height ; direction = "right"
      olight.filters.light.addPoint(0,0,0,255,255,255,90)
      lightid = setInterval("spotlight()",olight.speed)
    }
    if (ldow == 1) {
      olight.style.filter = "light"
      x = 0 ; y = olight.height ; direction = "right"
      olight.filters.light.addCone(0,0,0,100,50,255,255,255,40,90)
      lightid = setInterval("spotlight()",olight.speed)
    }
    if (ldow == 2) {
      olight.style.filter = "light"
      x = 0 ; y = olight.height ; direction = "right"
      olight.filters.light.addCone(0,0,0,100,50,255,255,255,60,15)
      lightid = setInterval("spotlight()",olight.speed)
    }
    if (ldow == 3) {
      olight.style.filter = "alpha(opacity=100)"
      delta = 5
      lightid = setInterval("opac()",olight.speed*2)
    }
    if (ldow == 4) {
      var colors=new Array("#2994fd", "#11fff2", "#c0b189", "#f2fd89", "#00ff00")
      var rnd = Math.round(Math.random() * (colors.length-1))
      olight.style.filter = "glow(color="+colors[rnd]+" ; strength=0 ; enabled=1)"
      delta = 1
      lightid = setInterval("glow()",olight.speed*2)
    }
    if (ldow == 5) {
      olight.style.filter = "wave(strength=8, freq=3, lightstrength=20, add=0, phase=45)"
      delta = 1 ; phaseme = 0
      lightid = setInterval("wave()",olight.speed*4)
    }
    if (ldow == 6) {
      olight.style.filter = "revealTrans(duration=3,transition=23)"
      delta = -1 ; direction = 1
      lightid = setInterval("reveal()",olight.speed*10)
    }
  }
}
//
function light_off() {
  var flag = (document.all && window.spotlight)
  // Test for Opera
  if (flag) {flag = false ; for (var i in document) {flag = true ; break}}
  if (flag) {
    var olight = document.all.spotlight
    olight.style.filter = " "
    olight.style.visibility="visible"
  }
  if (typeof(lightid) == "number") clearInterval(lightid)
  lightid = null
}
//
function light_init(ldow0) {
  var flag = (document.all && window.spotlight)
  // Test for Opera
  if (flag) {flag = false ; for (var i in document) {flag = true ; break}}
  if (flag) {
    var olight = document.all.spotlight
    olight.speed="50"
  }
  ldte = new Date() ; ldow = ldte.getDay()
  if (typeof(ldow0) == "string") ldow0 = parseFloat(ldow0)
  if (typeof(ldow0) == "number") ldow = ldow0
  lightid = null ; light_on()
}
// -- End of JavaScript code -------------- -->
