//<script language="javascript">
/*=============================================================================
 WebSolvers Framework Library
 Copyright 2003, WebSolvers, Inc., All Rights Reserved.

 Library Effects
 Provides Menus/links, rollovers, and scrollers.

 Revision History:
 6-30-03 Created

 Public Functions:
  imageObject_MakeSwap(

  Notes:
  To use the scroller place the following in your code
<div id="scroller" 
  style="position: relative; visibility: hidden;
    width: 154px; height: 100px; clip: rect(0, 154, 100, 0); overflow: hidden;"> 
    <div id="content" style="position: absolute; left:0; top:0;" visibility="hidden">
    [ contents ]
    </div></div><script language="javascript"><!--
    if(window.dhtml) {
      dhtml.addBasicInit("document.getElement('scroller')", "elemObject_MakeScroller", 0, 100, true);
    }    
    //-->< /script>
=============================================================================

 The WebSolvers Framework Library may be used and/or modified by anyone owning
 the original work as it was incorporated into an original development project
 so long as this copyright notice and the comments above remain intact.

 By using this code you agree to indemnify WebSolvers, Inc. from any liability
 that might arise from its use.

 This code may not be sold exclusively or as a part of other code without prior
 written consent and is expressly forbidden.

 Obtain permission before redistributing this software over the Internet or
 in any other medium. In all cases the copyright and header must remain intact.
============================================================================= */

//======================================================================================
//                                 Internal Routines
//======================================================================================

// --------------------------------------------------------------------------------
//                                 Swapper Code
// --------------------------------------------------------------------------------

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function dhtml_procSwap(elem, doc) {
  var i;
  var attr = null;

  var target, status = "";
  var swapSrc, swapTri, swapType, swapTarget, swap, swapMethod;
  
  dhtml.normalize(elem, doc);
  
  if(elem._isSwap)
    return elem;

  if(attr = elem.getAttribute("swapsrc"))
    swapSrc = attr.split(',');

  if(attr = elem.getAttribute("swaptri"))
    swapTri = attr.split(',');
        
  if(attr = elem.getAttribute("swaptype"))
    swapType = attr.split(',');

  if(attr = elem.getAttribute("status"))
    status = attr;
    
  if(attr = elem.getAttribute("swaptarget")) {
    swapTarget = attr.split(',');
    for(i = 0; i < swapTarget.length; i++) {
      if(swapTarget[i] == "_self")
        target = elem;
      else if(swapTarget[i] == "_parent")
        target = elem.getParent();
      else if(swapTarget[i] == "_child") {
        target = elem.getFirst();
        while(target && target.nodeType != 1)
          target = target.getNext();
      } else {
        target = doc.getElement(swapTarget[i]);
        if(!target) {
          target = doc.getByName(swapTarget[i]);
          if(target && target.length)
            target = target[0];
          else
            target = null;
        }
      }
      swapTarget[i] = target;
    }
  }
 
  if(attr = elem.getAttribute("swap"))
    swap = attr.split(',');
  
  if(attr = elem.getAttribute("swapmethod"))
    swapMethod = attr.split(',');

  if(swapSrc && swapSrc.length)
    for(i = 0; i < swapSrc.length; i++) {
      if(swapType && swapType.length > i)
        switch(swapType[i]) {
        case "image":
          dhtml.setType(elem, swapObject_SwapImg, swapSrc[i], (swapTri && swapTri.length > i && swapTri[i] && swapTri[i].length ? swapTri[i] : null));
          break;
        case "class":
          dhtml.setType(elem, swapObject_SwapClass, swapSrc[i], (swapTri && swapTri.length > i && swapTri[i] && swapTri[i].length ? swapTri[i] : null));
          break;
        }
      else
        dhtml.setType(elem, swapObject_SwapImg, swapSrc[i], (swapTri && swapTri.length > i && swapTri[i] && swapTri[i].length ? swapTri[i] : null));
    }
  
    
  if(swapTarget && swapTarget.length)
    for(i = 0; i < swapTarget.length; i++) {
      if(swapMethod && swapMethod.length > i)
        switch(swapMethod[i]) {
        case "over":
          dhtml.setType(elem, swapObject_SwapOver, swapTarget[i], (swap && swap.length > i ? swap[i] : "all"));
          break;
        case "click":
          dhtml.setType(elem, swapObject_SwapClick, swapTarget[i], (swap && swap.length > i ? swap[i] : "all"));
          break;
        case "tri":;
        case "tristate":;
          dhtml.setType(elem, swapObject_SwapTri, swapTarget[i], (swap && swap.length > i ? swap[i] : "all"));
          break;
        }
      else
        dhtml.setType(elem, swapObject_SwapOver, swapTarget[i], (swap && swap.length > i ? swap[i] : "all"));
    }
    
  return elem;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_SwapImg(src, triSrc) {
  this._isSwap = true;

  dhtml.normalize(this);

  this._swapImgOn = false;
    
  if(window.Image) {
    this.altImage = new Image();
    this.altImage.src = src;
    
    if(triSrc && triSrc.length) {
      this.origImage = new Image();
      this.origImage.src = this.src;
      this.altTriImage = new Image();
      this.altTriImage.src = triSrc;
      this._swapImgOn = 0;
    }
  } else {
    this.altsrc = src;
    if(triSrc && triSrc.length) {
      this.origSrc = this.src;
      this.altTriSrc = triSrc;
      this._swapImgOn = 0;
    }
  }
    
  this.swap = swapObject_Swap;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_SwapClass(src, triSrc) {
  this._isSwap = true;

  dhtml.normalize(this);

  this._swapClassOn = false;
  
  this.altclass = src;
  if(triSrc && triSrc.length) {
    this.origClass = this.getClass();
    this.altTriClass = triSrc;
    this._swapClassOn = 0;
  }
  
  this.swap = swapObject_Swap;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_Swap(type, state) {
  if(!state && state != 0 && state != false)
    state = !(this._swapImgOn || this.swapClassOn);
        
  if(!type || !type.length)
    type = "all";
    
  if((type == "all" || type == "image") && this.altImage && state != this._swapImgOn) {
    if(!state && this.origImage)
      this.src = this.origImage.src;
    else if(state == -1 && this.altTriImage)
      this.src = this.altTriImage.src;
    else if(state && this.origImage)
      this.src = this.altImage.src;
    else {      
      var src = this.src;
      this.src = this.altImage.src;
      this.altImage.src = src;
    }
    this._swapImgOn = state;
  } else if((type == "all" || type == "image") && this.altsrc && state  != this._swapImgOn) {
    if(!state && this.origSrc)
      this.src = this.origSrc;
    else if(state == -1 && this.altTriSrc)
      this.src = this.altTriSrc;
    else if(state && this.origSrc)
      this.src = this.altsrc;
    else {      
      var src = this.src;
      this.src = this.altsrc;
      this.altsrc = src;
    }
    this._swapImgOn = state;
  }
  
  if((type == "all" || type == "class") && this.altclass && state != this._swapClassOn) {
    var cls = this.getClass();
    if(!cls)
      cls = "";
    this.setClass(this.altclass);
    this.altclass = cls;
    this._swapClassOn = !this._swapClassOn;
  }

  return (this._swapImgOn || this._swapClassOn);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_SwapOver(target, type) {
  dhtml.quickNorm(this);

  if(!this._overTarget) {
    this._overTarget = new Array();
    this._overType = new Array();

    this._swapTimeout = 50;    
    this._doSwap = swapObject_DoSwap;
  
    this.addEvent("mouseover", swapObject_OnSwapOn);
    this.addEvent("mouseout", swapObject_OnSwapOff);
  }
    
  this._overTarget[this._overTarget.length] = target;
  this._overType[this._overType.length] = type;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_SwapClick(target, type) {
  dhtml.quickNorm(this);

  if(!this._overTarget) {
    this._overTarget = new Array();
    this._overType = new Array();
  
    this._swapTimeout = 50;    
    this._doSwap = swapObject_DoSwap;
    
    this.addEvent("mousedown", swapObject_OnSwapOn);
    this.addEvent("mouseup", swapObject_OnSwapOff);
  }
    
  this._overTarget[this._overTarget.length] = target;
  this._overType[this._overType.length] = type;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_SwapTri(target, type) {
  dhtml.quickNorm(this);

  if(!this._overTarget) {
    this._overTarget = new Array();
    this._overType = new Array();

    this._swapTimeout = 50;    
    this._doSwap = swapObject_DoSwap;
  
    this.addEvent("mouseover", swapObject_OnSwapOn);
    this.addEvent("mouseout", swapObject_OnSwapOff);
    this.addEvent("mousedown", swapObject_OnSwapDown);
    this.addEvent("mouseup", swapObject_OnSwapOn);
  }
    
  this._overTarget[this._overTarget.length] = target;
  this._overType[this._overType.length] = type;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_DoSwap(state) {
  var i;

  if(this._swapOffTimeout) {
    this.document.parentWindow.clearTimeout(this._swapOffTimeout);
    this._swapOffTimeout = 0;
  }

  for(i = 0; i < this._overTarget.length; i++)
    if(this._overTarget[i] && this._overTarget[i].swap)
      this._overTarget[i].swap(this._overType[i], state);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_OnSwapOn(e) {
  this._doSwap(true);
    
  return true;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_OnSwapOff(e) {
  if(this._swapTimeout > 0)
    this._swapOffTimeout = this.document.parentWindow.setTimeout("document.getElement('"  +this.id + "')._doSwap(false);", this._swapTimeout);
  else
    this._doSwap(false);

  return true;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function swapObject_OnSwapDown(e) {
  this._doSwap(-1);
    
  return true;
}

// --------------------------------------------------------------------------------
//                                  Menu Code
// --------------------------------------------------------------------------------

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
var dhtml_ActiveMenu = null;
var dhtml_ActiveMenuLink = null;

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function dhtml_procMenu(elem, doc) {
  var timeout = 100;
  var attr;
  
  dhtml.normalize(elem, doc);
  
  if(elem._isMenu)
    return elem;

  if(attr = elem.getAttribute("timeout") && !isNaN(parseInt(attr)))
    timeout = parseInt(attr);

  dhtml.setType(elem, menuObject_Menu, timeout);

  return elem;        
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuObject_Menu(timeout) {
  var node = null;
  var i = 0;
  
  this._isMenu = true;

  dhtml.normalize(this);

  this._menuTimeout = timeout;
  this._menuAutoHide = true;
  this.hide(true);

  this.showMenu = menuObject_Show;
  this.hideMenu = menuObject_Hide;

  this.addEvent("mouseover", menuObject_OnMouseOver);
  this.addEvent("mouseout", menuObject_OnMouseOut);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuObject_Show(link) {
  if(this._hideTimeout) {
    this.document.parentWindow.clearTimeout(this._hideTimeout);
    this._hideTimout = 0;
  }

  if(!link && this._menuLink)
    this._menuLink.linkShowMenu();
    
  if(this.visible())
    return;

  if(link)
    this._menuLink = link;
    
  if(dhtml_ActiveMenu && dhtml_ActiveMenu != this && (!this._menuLink || (this._menuLink._parentMenu != dhtml_ActiveMenu))) {
    if(dhtml_ActiveMenu._menuLink)
      dhtml_ActiveMenu._menuLink.linkHideMenu();
    else
      dhtml_ActiveMenu.hideMenu();
  }
  dhtml_ActiveMenu = this;    
    
  this.show();

  if(this._menuLink)
    this._menuLink.linkShowMenu();
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuObject_Hide(timeout) {
  if(this._hideTimeout) {
    this.document.parentWindow.clearTimeout(this._hideTimeout);
    this._hideTimout = 0;
  }
  
  if(!this.visible())
    return;
    
  if(this._overMenu)
    return;
        
  if(timeout > 0) {
    if(this._menuLink)
      this._hideTimeout = this._menuLink.document.parentWindow.setTimeout("document.getElement('" + this._menuLink.id + "').linkHideMenu();", timeout);
    else
      this._hideTimeout = this.document.parentWindow.setTimeout("document.getElement('" + this.id + "').hideMenu();", timeout);
  } else {
    this.hide();
    if(dhtml_ActiveMenu == this)
      dhtml_ActiveMenu = null;

    if(this._menuLink && this._menuLink._parentMenu && this._menuLink._parentMenu) {
      if(this._menuLink._parentMenu._menuLink)
        this._menuLink._parentMenu._hideTimeout = this._menuLink._parentMenu._menuLink.document.parentWindow.setTimeout("document.getElement('" + this._menuLink._parentMenu._menuLink.id + "').linkHideMenu();", this._menuLink._parentMenu._menuTimeout);
      else
        this._menuLink._parentMenu._hideTimeout = this._menuLink._parentMenu.document.parentWindow.setTimeout("document.getElement('" + this._menuLink._parentMenu.id + "').hideMenu();", this._menuLink._parentMenu._menuTimeout);
    }
      
    this._menuLink = null;
  }
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuObject_OnMouseOver(e) {
  this._overMenu = true;
    
  this.showMenu();  

  if(this._menuLink && this._menuLink._parentMenu && this._menuLink._parentMenu && this._menuLink._parentMenu._hideTimeout) {
    this._menuLink._parentMenu.document.parentWindow.clearTimeout(this._menuLink._parentMenu._hideTimeout);
    this._menuLink._parentMenu._hideTimeout = 0;
  }
    
    
  return true;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuObject_OnMouseOut(e) {
  this._overMenu = false;
    
  this.hideMenu(this._menuTimeout);
      
  return true;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function dhtml_procMenuLink(elem, doc) {
  var attr;
  var link, menu, menuAlign, menuVAlign, linkAlign, linkVAlign, linkTimeout, menuShiftX, menuShiftY;
  
  dhtml.normalize(elem, doc);
  
  if(elem._isMenuLink)
    return elem;

  if(attr = elem.getAttribute("menulink")) {
      if(attr == "_self")
        link = elem;
      else if(attr == "_parent")
        link = elem.getParent();
      else if(attr == "_child") {
        link = elem.getFirst();
        while(link && talink.nodeType != 1)
          link = link.getNext();
      } else
        link = doc.getElement(attr);
  } else
    link = elem;

  if(attr = elem.getAttribute("menu")) {
    menu = doc.getElement(attr);
    if(menu) {
      menu = dhtml_procMenu(menu, doc);
      if(attr = elem.getAttribute("menutimeout"))
        menu.timeput = attr;
    }
  }

  if(attr = elem.getAttribute("menualign"))
    menuAlign = attr;
  else
    menuAlign = "left";

  if(attr = elem.getAttribute("menuvalign"))
    menuVAlign = attr;
  else
    menuVAlign = "top";

  if(attr = elem.getAttribute("linkalign"))
    linkAlign = attr;
  else
    linkAlign = "left";

  if(attr = elem.getAttribute("linkvalign"))
    linkVAlign = attr;
  else
    linkVAlign = "bottom";

  if(attr = elem.getAttribute("linktimeout") && !isNaN(parseInt(attr)))
    linkTimeout = parseInt(attr);
  else
    linkTimeout = 500;

  if(attr = elem.getAttribute("menushiftx") && !isNaN(parseInt(attr)))
    menuShiftX = parseInt(attr);

  if(attr = elem.getAttribute("menushifty") && !isNaN(parseInt(attr)))
    menuShiftY = parseInt(attr);

  if(menu && link)
    dhtml.setType(elem, menuLinkObject_MenuLink, link, menu, menuAlign, menuVAlign, linkAlign, linkVAlign, linkTimeout, menuShiftX, menuShiftY);

  return elem;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuLinkObject_MenuLink(link, menu, menuAlign, menuVAlign, linkAlign, linkVAlign, linkTimeout, menuShiftX, menuShiftY) {
  var target;
  var pmenu = null;
  
  if(this._layer)
    target = this.document.anchors[this.name].link;
  else
    target = this;
    
  dhtml.normalize(target);
  dhtml.normalize(link);

  target._isMenuLink = true;
  target._menuLink = link;
  target._realLink = this;
  
  target._menu = menu;
  target._menuAlign = menuAlign;
  target._menuVAlign = menuVAlign;
  target._linkAlign = linkAlign;
  target._linkVAlign = linkVAlign;
  target._linkTimeout = linkTimeout;
  target._menuShiftX = menuShiftX;
  target._menuShiftY = menuShiftY;
  
  pmenu = target.getParent();
  while(pmenu && !pmenu._isMenu) {
    if(pmenu.getParent)
      pmenu = pmenu.getParent();
    else
      pmenu = null;
  }
  target._parentMenu = pmenu;    

  target.linkShowMenu = menuLinkObject_Show;
  target.linkHideMenu = menuLinkObject_Hide;
  
  target.addEvent("mouseover", menuLinkObject_OnMouseOver);
  target.addEvent("mouseout", menuLinkObject_OnMouseOut);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuLinkObject_Show() {
  if(this._menu._hideTimeout) {
    this._menu.document.parentWindow.clearTimeout(this._menu._hideTimeout);
    this._menu._hideTimout = 0;
  }

  if(this._doSwap)
    this._doSwap(true);
      
  if(dhtml_ActiveMenuLink && dhtml_ActiveMenuLink != this && dhtml_ActiveMenuLink._parentMenu == this._parentMenu)
    dhtml_ActiveMenuLink.linkHideMenu();
  dhtml_ActiveMenuLink = this;

  if(!this._parentMenu) {
    this._menu.alignTo(this._menuLink, this._menuAlign, this._menuVAlign, this._linkAlign, this._linkVAlign, this._menuShiftX, this._menuShiftY);
  } else {
    this._menu.alignTo(new Array(this._parentMenu, this._menuLink), this._menuAlign, this._menuVAlign, this._linkAlign, this._menuLink._linkVAlign, this._menuShiftX, this._menuShiftY);
  }
    
  this._menu.showMenu(this);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuLinkObject_Hide(timeout) {
  if(this._menu._hideTimeout) {
    this._menu.document.parentWindow.clearTimeout(this._menu._hideTimeout);
    this._menu._hideTimout = 0;
  }
  
  if(timeout > 0)
    this._menu._hideTimeout = this._menu.document.parentWindow.setTimeout("document.getElement('" +this.id + "').linkHideMenu();", timeout);
  else {
    if(dhtml_ActiveMenuLink == this)
      dhtml_ActiveMenuLink = null;

    if(!this._menu._noMenuHide)
      this._menu.hideMenu();
      
    if(this._doSwap)
      this._doSwap(false);
  }
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuLinkObject_OnMouseOver(e) {
  if(this._parentMenu)
    this._parentMenu._overMenu = true;
    
  this.linkShowMenu();
      
  return true;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function menuLinkObject_OnMouseOut(e) {
  if(this._parentMenu)
    this._parentMenu._overMenu = false;
      
  this.linkHideMenu(this._linkTimeout);  
    
  return true;
}

// --------------------------------------------------------------------------------
//                                Scroller Code
// --------------------------------------------------------------------------------

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function elemObject_MakeScroller(direction, speed, autostop, spacing) {
  dhtml.normalize(this);
  
  if(direction)
    this.direction = 1;
  else
    this.direction = 0;

  if(speed)   
    this.speed = speed;
  else
    this.speed = 1000;

  if(!isNaN(parseInt(spacing, 10)))
    this.spacing = spacing;
  else
    this.spacing = 10;

  this.startScroll = scrollerObject_StartScroll;
  this.stopScroll = scrollerObject_StopScroll;
  this.scrolling = scrollerObject_Scrolling;
  this.scroll = scrollerObject_Scroll;

  if(autostop) {
    this.addEvent("mouseover", scrollerObject_MouseOver);
    this.addEvent("mouseout", scrollerObject_MouseOut);
  }

  if(this.speed > 1000)
    this.speed = 1000;

  if(this.speed < -1000)
    this.speed = -1000;

  if(this.spacing < 0)
    this.spacing = 0;

  this.show();

  this.document.parentWindow.setTimeout("document.getElement('" + this.id + "').startScroll();", 1001 - this.speed);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function scrollerObject_StartScroll() {
  if(!dhtml)
    return;

  if(!this.content) {
    if(dhtml.NN4)
      this.content = dhtml.normalize(this.document.layers[0], this.document);
    else
      this.content = dhtml.normalize(this.firstChild, this.document);
  }

  if(!this.content)
    return;

  if(!this.smooth) {
    if(dhtml.NN4)
      this.smooth = dhtml.normalize(this.document.layers[1], this.document);
    else
      this.smooth = dhtml.normalize(this.content.nextSibling, this.document);
  }

  if(this.speed > 0)
    this.scrollStep = -1;
  else if(this.speed < 0) {
    this.scrollStep = 1;
    this.speed = -this.speed;
  } else
    this.scrollStep = 0;

  if(!dhtml.NN4) {
    if(this.direction)
      this.content.resizeTo(this.content.getWidth(), this.getHeight());
    else
      this.content.resizeTo(this.getWidth(), this.content.getHeight());

    if(this.smooth)
      if(this.direction) {
        this.smooth.moveTo(this.content.getX(true) + this.content.getWidth() + this.spacing, this.content.getY(true));
        this.smooth.resizeTo(this.smooth.getWidth(), this.getHeight());
      } else {
        this.smooth.moveTo(this.content.getX(true), this.content.getY(true) + this.content.getHeight() + this.spacing);
        this.smooth.resizeTo(this.getWidth(), this.smooth.getHeight());
      }
  }
  
  if(this.direction)
    this.resizeTo(this.getWidth(), this.content.getHeight(), false);
  else
    this.resizeTo(this.content.getWidth(), this.getHeight(), false);

  this.content.show();

  if((this.direction && (this.content.getWidth() > this.getWidth())) ||
    (!this.direction && (this.content.getHeight() > this.getHeight()))) {
      if(this.smooth)
        this.smooth.show();
      this.scroll();
  }
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function scrollerObject_MouseOver(e) {
  this.stopScroll();
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function scrollerObject_MouseOut(e) {
  this.startScroll();
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function scrollerObject_StopScroll() {
  if(this.timer)
    this.document.parentWindow.clearTimeout(this.timer);
  this.timer = 0;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function scrollerObject_Scrolling() {
  return (this.timer != 0);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function scrollerObject_Scroll() {
  var x = this.content.getX(true);
  var y = this.content.getY(true);
  var w = this.getWidth();
  var h = this.getHeight();
  var xo = 0;
  var yo = 0;
  
  if(this.smooth) {
    xo = this.smooth.getX(true);
    yo = this.smooth.getY(true);
    w = this.smooth.getWidth() + this.spacing;
    h = this.smooth.getHeight() + this.spacing;
  }
  
  if(this.direction) {
    if(x < -this.content.getWidth() || x > this.content.getWidth())
      x = xo + (w * -this.scrollStep);
    else
      x += this.scrollStep;
  } else {
    if(y < -this.content.getHeight() || y > this.content.getHeight())
      y = yo + (h * -this.scrollStep);
    else
      y += this.scrollStep;
  }

  this.content.moveTo(x, y, true);

  if(this.smooth) {
    x = this.smooth.getX(true);
    y = this.smooth.getY(true);
    xo = this.content.getX(true);
    yo = this.content.getY(true);
    w = this.content.getWidth() + this.spacing;
    h = this.content.getHeight() + this.spacing;

    if(this.direction) {
      if(x < -this.smooth.getWidth() || x > this.smooth.getWidth())
        x = xo + (w * -this.scrollStep);
      else
        x += this.scrollStep;
    } else {
      if(y < -this.smooth.getHeight() || y > this.smooth.getHeight())
        y = yo + (h * -this.scrollStep);
      else
        y += this.scrollStep;
    }

    this.smooth.moveTo(x, y, true);
  }
  
  this.timer = this.document.parentWindow.setTimeout("document.getElement('" + this.id + "').scroll();", 1001 - this.speed);
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
function proc_ScrollEffect(elem, doc) {
  var attr;

  //If the gecko render is not geater than 20020529 then don't
  // do anythign since that version an prior has issues with this.
  if(dhtml.mozilla && !dhtml.checkVersion(1, 20020529))
    return elem;

  dhtml.quickNorm(elem);

  var id = "";
  var cls = "";
  var param1 = Number.NaN;
  var param2 = 0;
  var param3 = false;
  var param4 = Number.NaN;
  var smooth = true;
  var width = 0;
  var height = 0;

  if(attr = elem.getAttribute("id"))
    id = attr;

  if(attr = elem.getAttribute("class"))
    cls = attr;

  if(attr = elem.getAttribute("method")) {
    param1 = dhtml.procAlign(attr);
    if(!isNaN(parseInt(param1, 10))) {
      if(parseInt(param1, 10) == 1)
        param1 = 1;
    } else if(attr.toLowerCase().substr(0, 1) == 'h') {
      param1 = 1;
    }
  }
  
  if(attr = elem.getAttribute("speed") && !isNaN(parseInt(attr)))
    param2 = parseInt(attr);

  if(attr = elem.getAttribute("stop")) 
    param3 = true;
  
  if(attr = elem.getAttribute("width"))
    width = attr;

  if(attr = elem.getAttribute("height"))
    height = attr;

  if(attr = elem.getAttribute("smooth")) {
    if(attr.toLowerCase() == "false")
      smooth = false;
    else if(!isNaN(parseInt(attr, 10)))
      smooth = !parseInt(attr, 10);
  }

  if(attr = elem.getAttribute("spacing")) {
    param4 = parseInt(attr, 10);
  }

  var ep = elem.getParent();
  var frag = doc.newFragment();
  var scroller = doc.newElement('DIV');
  var content = null;
  var content2 = null;

  if(param1) {
    content = doc.newElement('NOBR');
  } else {
    content = doc.newElement('DIV');
  }
  
  if(!param1 && height==0) {
    height="100%";
  } else if(param1 && width==0) {
    width="100%";
  }

  frag.appendElem(scroller);  
  scroller.id = id;
  scroller.style.position = "relative";
  scroller.appendElem(content);
  scroller.hide();

  content.moveTo(0, 0);
  if(cls)
    content.setClass(cls);
  content.hide();

  if(elem.firstChild && elem.firstChild.nodeType == 8) {
    content.setHTML(elem.firstChild.nodeValue);
  } else
    while(elem.firstChild)
      content.appendElem(elem.removeChild(elem.firstChild));

  if(smooth) {
    content2 = content.cloneNode(true);
    scroller.appendElem(content2);
  }

  ep.replaceElem(elem, frag);
  scroller.resizeTo(width, height, false);

  if(id && !isNaN(param2)) {
    dhtml.setType(scroller, elemObject_MakeScroller, param1, param2, param3, param4);
  }
  
  return frag;
}

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------

if(window.dhtml) {
  dhtml.addTag('SWAP', dhtml_procSwap);
  dhtml.addTag('MENU', dhtml_procMenu);
  dhtml.addTag('MENULINK', dhtml_procMenuLink);
  //dhtml.addTag('SCROLL', proc_ScrollEffect, null, null, 0);
}

