function initScroller() {
  // arguments: id of layer that scrolls, width and height of scroller (of newsWn), 
  // number of newsItems (including repeated 1st newsItem), axis ("v" or "h")
  // set up pause/resume onmouseover/out? (true or false)
  // for vertical news scroller
  var scr1 = new dw_scroller('newsCnt', 630, 80, 5, "v", true);
  scr1.setTiming(100, 7000);
  // for horizontal event ad scroller
  var scr2 = new dw_scroller('cnt',135,149,4, "h", true);
  scr2.setTiming(100, 7000);
}

function createSWF( w, h, params) {
  var args = "";
  for (var i in params) {
    args += i + "=" + params[i] + "&amp;";
  }
document.writeln('<object width="100%" height="100%" align="middle">'+ '<param name="movie" value="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'"/>'+ '<param name="wmode" value="transparent" />'+ '<embed src="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'" wmode="transparent" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/></object>');
return 1;
} 
function createSWF1( w, h, params) {
  var args = "";
  for (var i in params) {
    args += i + "=" + params[i] + "&amp;";
  }
document.writeln('<object width="100%" height="100%" align="middle">'+ '<param name="movie" value="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'"/>'+ '<param name="wmode" value="transparent" />'+ '<embed src="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'" wmode="transparent" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/></object>');
return 1;
} 
function createSWF2( w, h, params) {
  var args = "";
  for (var i in params) {
    args += i + "=" + params[i] + "&amp;";
  }
document.writeln('<object width="100%" height="100%" align="middle">'+ '<param name="movie" value="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'"/>'+ '<param name="wmode" value="transparent" />'+ '<embed src="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'" wmode="transparent" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/></object>');
return 1;
} 


function removeKeywords() {

 var aKeywords = ['logo','annual blendoff', 'barnegat bay','barnegat inlet','oyster creek channel',
//'double creek channel','icw','icw marker bb','icw marker bi','icw marker 41',//'boating','people','forked river','center','fishing','fishing tournament','new jersey',//'water sports','power boat',
//'albemarle','albin','alden','allmand','angler','aquasport','back cove',
//    'baha cruisers','baja','bayliner','bennetau','bertram','boston whaler','buddy davis',
//     'cdory','cabo','camano','cape horn','carolina','carver',
//'c&c yachts','century','challenger','chaparral','chris craft','jet ski','sail boat',
//'performance boat','commercial boat','commercial','cobalt','cobia',
//'contender','cruisers','crownline',
//'doral','eastbay','edgewater',
//'egg harbor','everglades','formula','fountain','four winns','glacier bay',
//'grady white','grand banks','hampton','hatteras','henriques','hunter','hurricane',
//'hydrasports','irwin','island pilot','jefferson','jersey cape','jersey yachts',
//'jones brothers','kady krogan','kawasaki','laguna','larson','luhrs','mako','maxum',
//'maycraft','meridian','montery','nordic tugs','ocean master',
//'ocean yachts','osprey','pacific trawlers','palm beach','parker','pearson','pheonix',
//'polar','president',
//'pro line','procats','pursuit','regal','regulator',
//'renken','rinker','riviera','robalo','sabre','scout','sea craft',
//'sea doo','sea fox','sea hunt','sea ox',
//'sea ray','sealine','shamrock','silverton','sonic',
//'southern cross','southport','stamas','steiger','sea swirl',
//'striper','sweetwater','tartan',
//'tiara',
//'tollycraft',
//'topaz','triton','trojan',
//'twin vee','viking','wellcraft','wilbur','worldcat',
//'yamaha','zimmerman'
];

 var oBox = YD.get('keywordsBox');
 oKeywords = YD.getElementsByClassName('keyword', 'a', oBox);

 for (i=0; i<oKeywords.length; i++) {
   for (j=0; j<aKeywords.length; j++) {
     if (aKeywords[j] == oKeywords[i].innerHTML) {
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i].previousSibling);
       } catch(e){}
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i].nextSibling);
       } catch(e){}
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i].nextSibling);
       } catch(e){}
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i]);
       } catch(e){}
       break;
     }
   }
 }
}

var galleryRedirectTable = 
 {   
         // no comma on last entry
 }


function CheckRedirects()
 {
  if (! YD.hasClass(document.body, 'loggedIn'))
     {
         // get the path from the current URL, 
         // convert it to lowercase and remove the leading slash
         var path = window.location.pathname.substr(9); 
         
         var newURL = galleryRedirectTable[path];        // look it up in our table

         // if we found it in the table && newURL is different than where we are
         if (newURL && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
 }

/*=========================*/
/*== SLIDE SHOW          ==*/
/*== version 0.57        ==*/
/*== Updated 12 Dec 2006 ==*/
/*=========================*/
var SLIDE_SHOW = 0;
var RANDOM_PHOTO = 1;
var slideshowContainer;
var sSlide;
var sCaption;
var ssSlides;
var ssSlideTotal;
var ssSlideTimer;
var ssOldSlide;
var ssFadeTimer;
var ssFade;
var ssTimerId;
var blank;
var ssTitle;



function PrepSlideEnvironment() {
  tmpCookie = getCookie("Template");

  blank = new Image();
  blank.src = "/img/spacer.gif";

  if (typeof(slideshowType) == "undefined" || (slideshowType != SLIDE_SHOW && slideshowType != RANDOM_PHOTO)) {
    slideshowType = SLIDE_SHOW;
  }

  if (slideshowType == RANDOM_PHOTO) {
    randomSlides = true;
  }

  if (typeof(slideshowContainerId) == "undefined") {
    return false;
  } else if (typeof(slideshowContainerId) == "string") {
    slideshowContainer = YD.get(slideshowContainerId);
  }

  if (!slideshowContainer) {
    return false;
  }

  if (typeof(slideshowUrl) == "undefined" || typeof(slideshowUrl) != "string") {
    return false;
  } else {
    slideshowUrl =  /(?:http:\/\/[^\/]+)?(\/\S+)/.exec(slideshowUrl)[1];
  }

  if (/\/gallery\/[0-9]+/.test(slideshowUrl)) {
    slideSourceIsGallery = true;
  } else {
    slideSourceIsGallery = false;
  }

  if (typeof(slideHeight) == "undefined" || isNaN(slideHeight)) {
    slideHeight = "200";
  }

  if (typeof(slideWidth) == "undefined" || isNaN(slideWidth)) {
    slideWidth = "300";
  }

  if (typeof(photoHeight) == "undefined" || isNaN(photoHeight)) {
    photoHeight = slideHeight;
  }

  if (typeof(photoWidth) == "undefined" || isNaN(photoWidth)) {
    photoWidth = slideWidth;
  }

  if (typeof(slideDuration) == "undefined" || isNaN(slideDuration)) {
    slideDuration = 3;
  }

  if (typeof(firstSlideUrl) == "undefined" || typeof(firstSlideUrl) != "string") {
    firstSlideUrl = blank.src;
  }

  if (typeof(showSlideTransition) == "undefined" || typeof(showSlideTransition) != "boolean") {
    showSlideTransition = true;
  }
   
  if (typeof(resizeToPhoto) == "undefined" || typeof(resizeToPhoto) != "boolean") {
    resizeToPhoto = true;
  }

  if (typeof(quickStart) == "undefined" || typeof(quickStart) != "boolean") {
    quickStart = true;
  }

  if (typeof(randomSlides) == "undefined" || typeof(randomSlides) != "boolean") {
    randomSlides = false;
  }

  if (typeof(slideControls) == "undefined" || typeof(slideControls) != "boolean") {
    slideControls = false;
  }

  if (typeof(slideCaptions) == "undefined" || typeof(slideCaptions) != "boolean") {
    slideCaptions = false;
  }

  if (typeof(slidesClickable) == "undefined" || typeof(slidesClickable) != "boolean") {
    slidesClickable = false;
  }

if (typeof(slideTitle) == "undefined" || typeof(slideTitle) != "boolean") {
    slideTitle = false;
  }

  return true;
}


function loadSlideshow() {
  if (!PrepSlideEnvironment()) {
    return false;
  }

if (slideTitle)
   { slideshowContainer.innerHTML = '<p id="ssTitle"> "' + slideshowTitle + '"</p>';}

  slideshowContainer.innerHTML = '<img src="http://www.smugmug.com/img/spacer.gif" alt="" id="ssSlide" height="' + slideHeight + '" width="' + slideWidth + '" style="opacity: .99; background-image: url(' + firstSlideUrl + '); background-repeat: no-repeat; background-position: center;" />';

  if (slideCaptions) {
    slideshowContainer.innerHTML += '<div id="ssCaption"></div>';
  }

  if (slideControls) {
    slideshowContainer.innerHTML += '<div id="ssControl"><a title="Previous Slide" id="ssPrev" class="ssBtn" href="javascript: void(0);" onclick="prevSlide();"><img src="/img/spacer.gif" border="0" /></a><a title="Next Slide" id="ssNext" class="ssBtn" href="javascript: void(0);" onclick="nextSlide();"><img src="/img/spacer.gif" border="0" /></a><a title="Pause Slideshow" id="ssPause" class="ssBtn" href="javascript: void(0);" onclick="pauseSlideshow();"><img src="/img/spacer.gif" border="0" /></a><a title="Resume Slideshow" id="ssPlay" class="ssBtn" href="javascript: void(0);" onclick="resumeSlideshow();"><img src="/img/spacer.gif" border="0" /></a></div>';
  }

  sSlide = YD.get('ssSlide');
  sCaption = YD.get('ssCaption');

  if (slidesClickable) {
    sSlide.style.cursor = 'pointer';
  
    if (firstSlideUrl != blank.src) {
      ssAddSlideClick(slideshowUrl);
    }
  }

  ssSlides = [];
  ssSlideTotal = 0;
  ssSlideTimer = 0;
  ssOldSlide = 0;
  ssFadeTimer = 100;
  ssFade = "out";  

  if (slideSourceIsGallery) {
    ajax_query(slideshowHandler, '/photos/sspopup.mg?AlbumID=' + /\/gallery\/([0-9]+)/.exec(slideshowUrl)[1], null, true);
  } else {
    var postArray = [];
    postArray['TemplateID'] = '8';
    postArray['origin'] = slideshowUrl;
    ajax_query(slideshowHandler, '/homepage/templatechange.mg', postArray, true);
  }
}


function slideshowHandler(response)
{
  if (!slideSourceIsGallery) {
    if (tmpCookie && tmpCookie != "") {
      setCookie('Template', tmpCookie, 30, '/', 'smugmug.com');
    } else {
      deleteCookie("Template", "/", "smugmug.com");
    }
  }

  var re = /imageID\[\d+\] = "\d+";/g;
  var re2 = /width\[\d+\] = "\d+";/g;
  var re3 = /height\[\d+\] = "\d+";/g;
  var re4 = /caption\[\d+\] = ".*";/g;

  s = response.match(re); 
  w = response.match(re2);
  h = response.match(re3);
  c = response.match(re4);

  var oSlide;

  for (i = 0; i < s.length; i++) {
    oSlide = {};

    temp = s[i].split(/"/);
    oSlide.ImageId = temp[1];
    oSlide.File = 'http://upload.smugmug.com/photos/toolthumbs.mg?ImageID=' + temp[1] + '&tool=slideshowXL&winHeight=' + photoHeight + '&winWidth=' + photoWidth;
    oSlide.Gallery = slideshowUrl + '/1/' + oSlide.ImageId;

    temp = h[i].split(/"/);
    oSlide.Height = temp[1];

    temp = w[i].split(/"/);
    oSlide.Width = temp[1];

    temp = c[i].split(/"/);
    oSlide.Caption = temp[1];

    oSlide.Loaded = false;
 
    if ((oSlide.Width > photoWidth) || (oSlide.Height > photoHeight)) {
      if (oSlide.Width >= oSlide.Height) {
         oSlide.Height = Math.round((oSlide.Height / oSlide.Width) * photoWidth);
         oSlide.Width = photoWidth;
      } else {
        oSlide.Width = Math.round((oSlide.Width / oSlide.Height) * photoHeight);
        oSlide.Height = photoHeight;
      }
    }

    ssSlideTotal = ssSlides.push(oSlide);
  }

  ssSlideTotal -= 1;

  if (randomSlides) {
    ssSlides.shift();
    ssSlides.shuffle();
    ssSlides.unshift(0);
  }

  if (quickStart) {
    ssSlideTimer = (slideDuration * 1000);
  }

  ssPrepSlide(1);
  window.setTimeout("ssPrepSlide(2);", 0);
  window.setTimeout("ssPrepSlide(ssSlideTotal);", 0);

  if (slideshowType == SLIDE_SHOW) {
    ssPlaySlideshow();
  } else {
    ssSlideSwap(1);
  }
}


function ssPauseSlideshow()
{
  window.clearTimeout(ssTimerId);
  ssTimerId = null;
}


function ssResumeSlideshow()
{
  if (!ssTimerId) {
    ssTimerId = window.setTimeout("ssPlaySlideshow()", 10);
  }
}


function ssPrepSlide(prep)
{
  if (ssSlides[prep].Loaded == false) {
    ssSlides[prep].Image = new Image();
    ssSlides[prep].Image.src = ssSlides[prep].File;
    ssSlides[prep].Loaded = true;
  }   
}


function ssMoveSlide(i) {
  ssSlideTimer = 0;
  ssFadeTimer = 100;
  ssTransition(ssFadeTimer);
  ssFade = "out";
  ssSlideSwap(i);                       
}


function ssPlaySlideshow()
{
  if (ssSlideTimer >= (slideDuration * 1000))
  {                
    if (ssFade == 'out') {
      ssTransition(ssFadeTimer -= 10);
    }
 
    if (ssFadeTimer == 0) {
      ssSlideSwap(1);
      ssFade = 'in';
    }
 
    if (ssFade == 'in') {
      ssTransition(ssFadeTimer += 10);
    }
 
    if (ssFadeTimer == 100) {
      ssSlideTimer = 0;
      ssFade = 'out';
    }
  } else {
    ssSlideTimer += 10;
  }
 
  ssTimerId = window.setTimeout("ssPlaySlideshow()", 10);
}


function ssTransition(opacity)
{
  if (showSlideTransition)
  {
    if (opacity != 100) {
      YD.setStyle(sSlide, 'opacity', (opacity / 100));
    } else {
      YD.setStyle(sSlide, 'opacity', '.99'); // to prevent flashing in mozilla browsers
    }
 
    // only affects Win IE
    YD.setStyle(sSlide, 'filter', 'alpha(opacity=' + opacity + ')');

    if (sCaption) {
      YD.setStyle(sCaption, 'opacity', sSlide.style.opacity);
      YD.setStyle(sCaption, 'filter', sSlide.style.filter);
    }
  }
}


function ssSlideSwap(i)
{
  var newSlide = ssOldSlide + i;
 
  if (newSlide > ssSlideTotal)
    newSlide = 1;
 
  if (newSlide < 1)
    newSlide = ssSlideTotal;
 
  if (ssSlides[newSlide].Loaded != false)
  {
    document.images['ssSlide'].src = blank.src;
    YD.setStyle(sSlide, 'backgroundImage', 'url(' + ssSlides[newSlide].File + ')');

    if (resizeToPhoto)
    {
      document.images['ssSlide'].height = ssSlides[newSlide].Height;
      document.images['ssSlide'].width = ssSlides[newSlide].Width;
    }

    if (slidesClickable) {
      ssAddSlideClick(ssSlides[newSlide].Gallery);
    }
    
    if (slideCaptions) {
      YD.get('ssCaption').innerHTML = ssSlides[newSlide].Caption;
    }

    ssPrepSlide(newSlide < ssSlideTotal ? newSlide + i : 1);
    ssOldSlide = newSlide;
  } else {
    ssPrepSlide(newSlide);
    ssSlideSwap(i);
  }
}


function ssAddSlideClick(sUrl) {
  YE.purgeElement(sSlide, false, 'click');
  YE.addListener(sSlide, 'click', function() {
	location.href = sUrl;
  })
}


Array.prototype.shuffle = function()
{
  var len = this.length;
  var rand, temp, i;

  for (i = 0; i < len; i++)
  {
    rand = Math.floor(Math.random()*len);
    temp = this[i];
    this[i] = this[rand];
    this[rand] = temp;
  }
}


function pauseSlideshow()
{
  YD.setStyle('ssPause', 'display', 'none');
  YD.setStyle('ssPlay', 'display', 'inline');
  ssPauseSlideshow();
}


function resumeSlideshow()
{
  YD.setStyle('ssPause', 'display', 'inline');
  YD.setStyle('ssPlay', 'display', 'none');
  ssResumeSlideshow();
}


function prevSlide()
{
  pauseSlideshow();
  ssMoveSlide(-1);
}


function nextSlide()
{
  pauseSlideshow();
  ssMoveSlide(1);
}


function getCookie(name) {
  var start = document.cookie.indexOf(name + "=");
  var len = start + name.length + 1;
  
  if ((!start) && (name != document.cookie.substring(0, name.length))) {
    return null;
  }

  if (start == -1) {
    return null;
  }

  var end = document.cookie.indexOf(";", len);

  if (end == -1) {
    end = document.cookie.length;
  }

  return unescape(document.cookie.substring(len, end));
}


function setCookie(name, value, expires, path, domain, secure) {
  var today = new Date();
  today.setTime( today.getTime() );

  if (expires) {
    expires = expires * 1000 * 60 * 60 * 24;
  }

  var expires_date = new Date(today.getTime() + (expires));

  document.cookie = name + '='+escape(value) +
    ((expires) ? ';expires=' + expires_date.toGMTString() : '') +
    ((path) ? ';path=' + path : '') +
    ((domain) ? ';domain=' + domain : '') +
    ((secure) ? ';secure' : '');
}

function norobotmail(aUser, aDomain) { 
       document.location = "mailto:" + aUser + "@" + aDomain;
    }

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}

//Goto Recent Gallery 
 function showRecent(days)
{
   endDate = new Date();
   oneDay = 1000*60*60*24;
   startDate = new Date(endDate.getTime() - (parseInt(days) * oneDay));
   sUrl = "/date/";
   sUrl += startDate.getFullYear() + "-" + padDate(startDate.getMonth() + 1) + "-" + padDate(startDate.getDate());
   sUrl += "/";
   sUrl += endDate.getFullYear() + "-" + padDate(endDate.getMonth() + 1) + "-" + padDate(endDate.getDate());
    window.location = sUrl;
}

function padDate(datePart)
{
   if (datePart.toString().length != 1)
     return datePart
   return "0" + datePart;
}
//Goto Recent Gallery

YE.onAvailable('Category_By-Location', function() {this.innerHTML = 'Locations'});

/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-5 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
    pausing scroller - vertical or horizontal 
    version date: March 2005 (revised GeckoTableFix)
*/

// Arguments: id of content layer (inside wn), width and height of scroller (of wn, that is), 
// number of items (repeat 1st one at end!), axis ("v" or "h"),
// set up mouse events? (boolean)
function dw_scroller(id, w, h, num, axis, bMouse) {
    this.id=id; this.el = document.getElementById? document.getElementById(id): null; 
    if (!this.el) return; this.css = this.el.style; 
    this.css.left = this.x = 0; this.css.top = this.y = 0;
    this.w=w; this.h=h; this.num=num; this.axis=axis||"v"; 
    this.ctr=1; // pause onload (for large doc's, may want to set this to 1)
    this.pause=5000; this.speed=60; // defaults
    if (bMouse) dw_scrollers.setMouseEvents(this.el);
    this.lastTime = new Date().getTime(); this.check = 0;
    this.index = dw_scrollers.ar.length;  dw_scrollers.ar[this.index] = this;
    this.active = true;
}

dw_scroller.prototype.setTiming = function(speed, pause) {
    this.speed = speed; this.pause = pause;
}

dw_scroller.prototype.controlScroll = function() {
    if (this.ctr > this.num-1) {
        this.shiftTo(0, 0); this.ctr = 1;
    } else {
        switch (this.axis) {
            case "v" :
                if (this.y > -this.h * this.ctr) { 
                    var ny = this.y + -1 * this.elapsed/1000 * this.speed;
                    ny = Math.max(ny, -this.h * this.ctr);
                    this.shiftTo(0, ny);	
                } else this.doPause();
                break;
            case "h" :
                if (this.x > -this.w * this.ctr) { 
                    var nx = this.x + -1 * this.elapsed/1000 * this.speed;
                    nx = Math.max(nx, -this.w * this.ctr);
                    this.shiftTo(nx, 0);	
                } else this.doPause();
            break;
        }
    }
}

dw_scroller.prototype.doPause = function() {
    this.check += this.elapsed;
    if (this.check >= this.pause) { this.ctr++; this.check = 0; }
}

dw_scroller.prototype.shiftTo = function(x, y) {
    this.css.left = (this.x = x) + "px";
    this.css.top = (this.y = y) + "px";
}

////////////////////////////////////////////////////////////////////////////
// common to all scrollers (pausing or continuous, vertical or horizontal)
dw_scrollers = {};  
dw_scrollers.ar = []; // global access to all scroller instances

dw_scrollers.setMouseEvents = function(obj) {
    obj.onmouseover = dw_scrollers.halt;
    obj.onmouseout = dw_scrollers.resume;
}

dw_scrollers.halt = function() {
    var curObj;
    for (var i=0; curObj = dw_scrollers.ar[i]; i++) 
        if ( curObj.id == this.id ) { curObj.active = false; return; }
}

dw_scrollers.resume = function(e) {
    var curObj;
    for (var i=0; curObj = dw_scrollers.ar[i]; i++) {
        if ( curObj.id == this.id ) {
            e = e? e: window.event;
            var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
            if ( this != toEl && !dw_contained(toEl, this) ) { 
                var now = new Date().getTime();
                curObj.elapsed = now - curObj.lastTime;
                curObj.lastTime = now; curObj.active = true; return; 
            }
        }
    }
}

// Handle all instances with one timer - idea from youngpup.net
dw_scrollers.timer = window.setInterval("dw_scrollers.control()", 10);
dw_scrollers.control = function() {
    var curObj;
    for (var i=0; curObj = dw_scrollers.ar[i]; i++) {
        if ( curObj.active ) {
            var now = new Date().getTime();
            curObj.elapsed = now - curObj.lastTime;
            curObj.lastTime = now; curObj.controlScroll();
        }
    }
}

// remove layers from table for ns6+/mozilla (needed for scrollers inside tables)
// pass id's of scrollers (i.e., div's that contain content that scrolls, usually wn, or wn1, ...)
dw_scrollers.GeckoTableFix = function() {
    var ua = navigator.userAgent;
    if ( ua.indexOf("Gecko") > -1 && ua.indexOf("Firefox") == -1 
        && ua.toLowerCase().indexOf("like gecko") == -1 ) {
        dw_scrollers.hold = []; // holds id's of wndo (i.e., 'the scroller') and its container
        for (var i=0; arguments[i]; i++) {
            var wndo = document.getElementById( arguments[i] );
            var holderId = wndo.parentNode.id;
            var holder = document.getElementById(holderId);
            document.body.appendChild( holder.removeChild(wndo) );
            wndo.style.zIndex = 1000;
            var pos = getPageOffsets(holder);
            wndo.style.left = pos.x + "px"; wndo.style.top = pos.y + "px";
            dw_scrollers.hold[i] = [ arguments[i], holderId ];
        }
        window.addEventListener("resize", dw_scrollers.rePosition, true);
    }
}

// ns6+/mozilla need to reposition layers onresize when scrollers inside tables.
dw_scrollers.rePosition = function() {
    if (dw_scrollers.hold) {
        for (var i=0; dw_scrollers.hold[i]; i++) {
            var wndo = document.getElementById( dw_scrollers.hold[i][0] );
            var holder = document.getElementById( dw_scrollers.hold[i][1] );
            var pos = getPageOffsets(holder);
            wndo.style.left = pos.x + "px"; wndo.style.top = pos.y + "px";
        }
    }
}

function getPageOffsets(el) {
    var left = el.offsetLeft;
    var top = el.offsetTop;
    if ( el.offsetParent && el.offsetParent.clientLeft || el.offsetParent.clientTop ) {
        left += el.offsetParent.clientLeft;
        top += el.offsetParent.clientTop;
    }
    while ( el = el.offsetParent ) {
        left += el.offsetLeft;
        top += el.offsetTop;
    }
    return { x:left, y:top };
}

// returns true if oNode is contained by oCont (container)
function dw_contained(oNode, oCont) {
  if (!oNode) return; // in case alt-tab away while hovering (prevent error)
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}

// avoid memory leak in ie
dw_scrollers.unHook = function() {
  var i, curObj;
  for (i=0; curObj = dw_scrollers.ar[i]; i++) {
    if ( curObj.el ) { 
      curObj.el.onmouseover = null;
      curObj.el.onmouseout = null;
      curObj.el = null;
    }
  }
}

if ( window.addEventListener ) window.addEventListener( "unload", dw_scrollers.unHook, true);
else if ( window.attachEvent ) window.attachEvent( "onunload", dw_scrollers.unHook );
