/* Thanks to the Dynamic Duo and Howard Chen for this neat script!! Links to this pages can be found on our LINKS page */
/********************************************************************************
 This JavaScript code uses techniques found at
 The Dynamic Duo - http://www.dansteinman.com/dynduo/
 Edited by Howard Chen
********************************************************************************/

// GIF Cursor
function onerror() 
{
  location.href="javascript:"
}
function DynLayer(id,nestref) 
{
  if (ns4) 
  {
    this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
    this.x = this.css.left
    this.y = this.css.top
  }
  else if (ie4) 
  {
    this.css = document.all[id].style
    this.x = this.css.pixelLeft
    this.y = this.css.pixelTop
  }
  else if (ns5) 
  {
    this.css = document.getElementById(id).style
    this.x = this.css.left
    this.y = this.css.top
  }
  this.show = DynLayerShow
  this.hide = DynLayerHide
  this.addon = DynLayerAddon
  this.addon(id,nestref)
}
function DynLayerMoveTo(x,y) 
{
  if (x!=null) 
  {
    this.x = x
    this.css.left = this.x
  }
  if (y!=null) 
  {
    this.y = y
    this.css.top = this.y
  }
}
function DynLayerMoveBy(x,y) 
{
//not used
  this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() 
{
//not used
  this.css.visibility = (ns4) ? "show" : "visible"
}
function DynLayerHide() 
{
//not used
  this.css.visibility = (ns4) ? "hide" : "hidden"
}
function DynLayerAddon(id,nestref) 
{
  this.id = id
  this.nestref = nestref
  this.w = (ns4)? this.css.clip.width : this.css.pixelWidth
  this.h = (ns4)? this.css.clip.height : this.css.pixelHeight
  this.doc = (ns4)? this.css.document : document
  this.event = (ns4)? this.css : (ns5 ? document.getElementById(id) : document.all[id])
  this.obj = id + "DynLayer"
  eval(this.obj + "=this")
  this.moveTo = DynLayerMoveTo
  this.moveBy = DynLayerMoveBy
  this.slideTo = DynLayerSlideTo
  this.slideBy = DynLayerSlideBy
  this.slideStart = DynLayerSlideStart
  this.slide = DynLayerSlide
  this.xshift = this.css.xshift
  this.yshift = this.css.yshift
}
function DynLayerSlideTo(endx,endy,inc,speed,fn) 
{
//not used
  if (endx==null) endx = this.x
  if (endy==null) endy = this.y
  var distx = endx-this.x
  var disty = endy-this.y
  this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) 
{
//not used
  var endx = this.x + distx
  var endy = this.y + disty
  this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) 
{
//not used
  if (this.slideActive) return
  var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc
  var dx = distx/num
  var dy = disty/num
  if (!fn) fn = null
  this.slideActive = true
  this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) 
{
//not used
  if (!this.slideActive) return
  if (i++ < num) 
  {
    this.moveBy(dx,dy)
    setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
  }
  else 
  {
    this.slideActive = false
    this.moveTo(endx,endy)
    eval(fn)
  }
}
function createLayer(id,nestref,left,top,width,height,content,bgColor,visibility,zIndex,xshift,yshift)
{
//in our case nestref is always null
  if (ns4) 
  {
    if (nestref) 
    {
      var lyr = eval("document."+nestref+".document."+id+" = new Layer(width, document."+nestref+")")
    }
    else 
    {
      var lyr = document.layers[id] = new Layer(width)
      eval("document."+id+" = lyr")
    }
    lyr.left = left
    lyr.top = top
    lyr.xshift=xshift
    lyr.yshift=yshift
    if (height!=null) lyr.clip.height = height
    if (bgColor!=null) lyr.bgColor = bgColor
    lyr.visibility = (visibility=='hidden')? 'hide' : 'show'
    if (zIndex!=null) lyr.zIndex = zIndex
    if (content) 
    {
      lyr.document.open()
      lyr.document.write(content)
      lyr.document.close()
    }
  }
  else if (ns5 || ie4) 
  {
    divi = document.createElement('div');
    divi.id = id;
    divi.style.position = 'absolute';
    divi.style.left = left + "px";
    divi.style.top = top + "px";
    divi.style.width = width + "px";
    if (height!=null) 
      divi.style.height = height + "px";
    divi.style.clipLeft = "0px";
    divi.style.clipRight = width + "px";
    divi.style.clipTop = "0px";
    divi.style.clipBottom = height + "px";
    if (bgColor!=null) divi.style.backgroundColor = bgColor         
    if (zIndex!=null) divi.style.zIndex = zIndex
    divi.style.visibility = 'visible';
    divi.innerHTML = content;
    if (nestref) 
    {
      index = nestref.lastIndexOf(".")
      var nestlyr = (index != -1)? nestref.substr(index+1) : nestref
      document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
    }
    else 
    {
      document.body.appendChild(divi)
    }
  }/*
  else if (ie4) 
  {
    var str = '\n<DIV id='+id+' style="position:absolute; left:'+left+'; top:'+top+'; width:'+width+';'// xshift:'+xshift+'; yshift:'+yshift
    if (height!=null) 
    {
      str += '; height:'+height
      str += '; clip:rect(0,'+width+','+height+',0)'
    }
    if (bgColor!=null) str += '; background-color:'+bgColor         
    if (zIndex!=null) str += '; z-index:'+zIndex
    str += '; visibility:'+'visible';
    str += ';">'+((content)?content:'')+'</DIV>'
    if (nestref) 
    {
      index = nestref.lastIndexOf(".")
      var nestlyr = (index != -1)? nestref.substr(index+1) : nestref
      document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
    }
    else 
    {
      document.body.insertAdjacentHTML("BeforeEnd",str)
    }
//    alert(document.getElementById('cursorDiv').outerHtml);
  }*/
}
function mouseMove(e) 
{
  var x = (ns4)? e.pageX : (ie4 ? event.x : e.clientX)
  var y = (ns4)? e.pageY : (ie4 ? (event.y + document.body.scrollTop) : e.clientY)
  cursor.moveTo(x+1,y+1);
}
// Image Rollover
function preloadImage(imgObjName, imgURL)
{
  if (document.images)
  {
    eval(imgObjName + " = new Image()");
    eval(imgObjName + ".src = imgURL");
  }
}
function displayImage(imgTagName, imgObjName)
{
  if (document.images)
    document[imgTagName].src = eval(imgObjName + ".src");
}
