<!-- Beginning of JavaScript -------------------
//
// This script uses dynamic html to display logo images and hyperlinks.
// Three images are displayed at a time.  After every 10 seconds, the
// oldest logo is removed and a new logo is added.
//
// To install, insert this JavaScript into your web page header.  Then
// add the following to your body:
//   <a id="a001" target="_top"><img id="i001" border="0" align="middle"></a>
//   <a id="a002" target="_top"><img id="i002" border="0" align="middle"></a>
//   <a id="a003" target="_top"><img id="i003" border="0" align="middle"></a>
//
// You also need to define your logo list in public arrays.
//
// Public Variables:
// wid[] - <img width>
// hgt[] - <image height>
// img[] - image cache
// src[] - <img src>
// tit[] - <img alt>
// url[] - <a href>
//
// Example:
// wid = new Array() ; hgt = new Array() ; img = new Array()
// src = new Array() ; tit = new Array() ; url = new Array()
// wid[0] = 200 ; hgt[0] = 60 ; img[0] = new Image()
// src[0] = "logo\/york.gif"
// tit[0] = "Local SBT\/ACCPAC customer&#013;&#010;(Formerly LakeShore Casket)"
// url[0] = "http:\/\/www.yorkgreatlakes.com"
//
// Note: Make sure to replace any occurence "/" with "\/"
//       (needed in document.write()).
//
// Note: For external images, add "(x)" to tit[].  Otherwise,
//       this code will wait onload forever.
//
// Finally, add <body onload="logo_init()" onunload="logo_off()">.
//
// For example, see http://www.dennisallen.com/home.htm
//
// Last Updated: 02/06/04
//
// PUBLIC FUNCTIONS
// applyeffect, DynImage, playeffect, rotate
// logo_on, logo_off, logo_init, xRef
//
// PUBLIC VARIABLES
// img_, logoid, logolen
//
//
function applyeffect(main, r) {
  var flag = (document.all)
  // Test for Opera
  if (flag) {flag = false ; for (var i in document) {flag = true ; break}}
  if (flag) {
    if (typeof(document.all[main]) != "object") return
    if (typeof(document.all[main].filters) != "object") return
    document.all[main].style.filter = "revealTrans(duration=3,transition="+r+")"
    document.all[main].filters.revealTrans.stop()
    document.all[main].filters.revealTrans.apply()
 }
}
//
//    This function refreshes the specified image.
//
function DynImage(p,r) {
  var a = xRef('a' + p)
  var i = xRef('i' + p)
  if (typeof(a) != "object" || typeof(i) != "object") return
  a.href = url[r]
  a.title = tit[r]
  i.width = wid[r]
  i.height = hgt[r]
  i.alt = tit[r]
  i.src = img[r].src
}
//
function playeffect(main) {
  var flag = (document.all)
  // Test for Opera
  if (flag) {flag = false ; for (var i in document) {flag = true ; break}}
  if (flag) {
    if (typeof(document.all[main]) != "object") return
    if (typeof(document.all[main].filters) != "object") return
    if (typeof(document.all[main].filters.revealTrans) != "object") return
    document.all[main].filters.revealTrans.play()
  }
}
//
//    This function performs the image rotation.
//
function rotate(waitstate) {
  if (self.status == "Downloading next image...") self.status = ""
  if (waitstate == 0) {
    if (img_ < img.length - 1) img_++ ; else img_=0
    // if (img_ !=0 && img_ < img.length - 1) img_++ ; else img_=0
    // if (img_ !=0 && img_ < img.length - 1) img_++ ; else img_=0
  }
  var r1 = 0 ; var r2 = 0 ; var r3 = 0

  var r1 = img_
  var r2 = r1 ; if (r2 < img.length - 1) r2++ ; else r2=0
  var r3 = r2 ; if (r3 < img.length - 1) r3++ ; else r3=0

  if (typeof src[r1] == "string") {img[r1].src = src[r1] ; src[r1] = 0}
  if (typeof src[r2] == "string") {img[r2].src = src[r2] ; src[r2] = 0}
  if (typeof src[r3] == "string") {img[r3].src = src[r3] ; src[r3] = 0}

  var x1 = img[r1].complete || tit[r1].toLowerCase().indexOf("(x)") != -1
  var x2 = img[r2].complete || tit[r2].toLowerCase().indexOf("(x)") != -1
  var x3 = img[r3].complete || tit[r3].toLowerCase().indexOf("(x)") != -1
  if (!x1 || !x2 || !x3) {
    if (waitstate == 0) self.status = "Downloading next image..."
    logoid = setTimeout('rotate(1)', 100) ; return
  }
  var r = Math.floor(Math.random()*23)
  applyeffect('i001', r) ; DynImage('001',r1) ; playeffect('i001')
  applyeffect('i002', r) ; DynImage('002',r2) ; playeffect('i002')
  applyeffect('i003', r) ; DynImage('003',r3) ; playeffect('i003')
  logoid = setTimeout('rotate(0)', logolen)
}
//
function logo_on() {
  rotate(0)
}
//
function logo_off() {
  if (self.status == "Downloading next image...") self.status = ""
  if (typeof(logoid) == "number") clearTimeout(logoid)
  logoid = null
}
//
function logo_init() {
//
  //
  // Classify browser :
  var xDom=xLay=xAll=false
  xDom = (document.getElementById?true:false)
  if (!xDom) {
    xLay = (document.layers?true:false)
    xAll = (document.all?true:false)
  }
  var x="return false"
  if (xLay) x="return document.layers[id]"
  if (xAll) x="return document.all[id]"
  if (xDom) x="return document.getElementById(id)"
  xRef=new Function("id", x)

  logoid = null ; logolen = 15 * 1000

  if (typeof(img) != "object") return

  for (var i=0 ; i < img.length ; i++) {
    if (tit[i].toLowerCase().indexOf("(x)") != -1) img[i].src = src[i]
  }
  img_ = img.length ; logo_on()
}
// -- End of JavaScript code -------------- -->

