var wndo = [];


function GeckoTableBugFix() {
  var i, wndo, holderId, holder, x, y;
	if ( navigator.userAgent.indexOf("Gecko") > -1 ) {
	dw_scrollLayer.hold = []; 
	for (i=0; arguments[i]; i++) {
	  if ( dw_scrollLayers[ arguments[i] ] ) {
		wndo = document.getElementById( arguments[i] );
		holderId = wndo.parentNode.id;
		holder = document.getElementById(holderId);
		document.body.appendChild( holder.removeChild(wndo) );
		wndo.style.zIndex = 1000;
		x = holder.offsetLeft; y = holder.offsetTop;
		wndo.style.left = x + "px"; wndo.style.top = y + "px";
		dw_scrollLayer.hold[i] = [ arguments[i], holderId ];
	  }
	}
   window.addEventListener("resize", rePositionGecko, true);
  }
}


function rePositionGecko() {
  var i, wndo, holder, x, y;
  if (dw_scrollLayer.hold) {
	for (i=0; dw_scrollLayer.hold[i]; i++) {
	  wndo = document.getElementById( dw_scrollLayer.hold[i][0] );
	  holder = document.getElementById( dw_scrollLayer.hold[i][1] );
	  x = holder.offsetLeft; y = holder.offsetTop;
	  wndo.style.left = x + "px"; wndo.style.top = y + "px";
	}
  }
}

function dw_startScroll(num, dir, sp) {
  if ( wndo[num] && wndo[num].startScroll ) wndo[num].startScroll(dir, sp);
}

function dw_stopScroll(num) {
  if ( wndo[num] && wndo[num].stopScroll ) wndo[num].stopScroll();
}

function dw_doubleSpeed(num) {
  if ( wndo[num] && wndo[num].speed ) wndo[num].speed *= 2;
}

function dw_resetSpeed(num) {
  if ( wndo[num] && wndo[num].speed ) wndo[num].speed /= 2;
}

function initScrollLayers() {
  wndo[0] = new dw_scrollLayer('wn1', 'lyr1', null);
  wndo[0].setUpScrollbar("dragBar1", "track1", "v", 1, 1);  

  GeckoTableBugFix('wn1');

  
}
