if (!document._amcwgtRootURL_)
{
	document._amcwgtRootURL_ = "";
}
var iframesrc = document._amcwgtRootURL_ + "/resources/common/dynweb/spacer.gif";

//============ dw_lib.js

/*************************************************************************
	This code is from Dynamic Web Coding at www.dyn-web.com
	Copyright 2003-4 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!
*************************************************************************/

/*
	dw_lib.js - used with dw_glide.js, dw_glider.js, ...
	version date July 2004
*/

dynObj.holder = {};
// constructor
function dynObj(id,x,y,w,h) {
	var el = dynObj.getElemRef(id);
	if (!el) return;  this.id = id;
	dynObj.holder[this.id] = this; this.animString = "dynObj.holder." + this.id;
	var px = window.opera? 0: "px";
	this.x = x || 0;	if (x) el.style.left = this.x + px;
	this.y = y || 0;	if (y) el.style.top = this.y + px;
	this.w = w || el.offsetWidth || 0;	this.h = h || el.offsetHeight || 0;
	// if w/h passed, set style width/height
	if (w) el.style.width = w + px; if (h) el.style.height = h + px;
}

dynObj.getElemRef = function(id) {
	var el = document.getElementById? document.getElementById(id): null;
	return el;
}

dynObj.getInstance = function(id) {
	var obj = dynObj.holder[id];
	if (!obj) obj = new dynObj(id);
	else if (!obj.el) obj.el = dynObj.getElemRef(id);
	return obj;
}

dynObj.prototype.shiftTo = function(x,y) {
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	if (el) {
		if (x != null) el.style.left = (this.x = x) + "px";
		if (y != null) el.style.top = (this.y = y) + "px";
	}
}

dynObj.prototype.shiftBy = function(x,y) { this.shiftTo(this.x+x, this.y+y); }

dynObj.prototype.show = function() {
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	if (el) {
		//el.style.visibility = "visible";
		el.style.display = "block";
	}
}
dynObj.prototype.hide = function() {
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	if (el) {
		//el.style.visibility = "hidden";
		el.style.display = "none";
	}
}
dynObj.prototype.isVisible = function() {
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	//return (el.style.visibility == "visible");
	return (el.style.display == "block");
}


// for time-based animations
// resources: www.13thparallel.org and www.youngpup.net (accelimation)
var dw_Bezier = {
	B1: function (t) { return t*t*t },
	B2: function (t) { return 3*t*t*(1-t) },
	B3: function (t) { return 3*t*(1-t)*(1-t) },
	B4: function (t) { return (1-t)*(1-t)*(1-t) },
	// returns current value based on percentage of time passed
	getValue: function (percent,startVal,endVal,c1,c2) {
		return endVal * this.B1(percent) + c2 * this.B2(percent) + c1 * this.B3(percent) + startVal * this.B4(percent);
	}
}

// adapted from accelimation.js by Aaron Boodman of www.youngpup.net
dw_Animation = {
	instances: [],
	add: function(fp) {
		this.instances[this.instances.length] = fp;
		if (this.instances.length == 1) this.timerID = window.setInterval("dw_Animation.control()", 10);
	},

	remove: function(fp) {
		for (var i = 0; this.instances[i]; i++) {
			if (fp == this.instances[i]) {
				this.instances = this.instances.slice(0,i).concat( this.instances.slice(i+1) );
				break;
			}
		}
		if (this.instances.length == 0) {
			window.clearInterval(this.timerID);	this.timerID = null;
		}
	},

	control: function() {
		for (var i = 0; this.instances[i]; i++) {
			if (typeof this.instances[i] == "function" ) this.instances[i]();
			else eval(this.instances[i]);
		}
	}
}

//============ dw_event.js - Aug 2008

var dw_Event = {

	add: function(obj, etype, fp, cap) {
		cap = cap || false;
		if (obj.addEventListener) obj.addEventListener(etype, fp, cap);
		else if (obj.attachEvent) obj.attachEvent("on" + etype, fp);
	},

	remove: function(obj, etype, fp, cap) {
		cap = cap || false;
		if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap);
		else if (obj.detachEvent) obj.detachEvent("on" + etype, fp);
	},

	DOMit: function(e) {
		e = e? e: window.event; // e IS passed when using attachEvent though ...
		if (!e.target) e.target = e.srcElement;
		if (!e.preventDefault) e.preventDefault = function () { e.returnValue = false; return false; }
		if (!e.stopPropagation) e.stopPropagation = function () { e.cancelBubble = true; }
		return e;
	},

	getTarget: function(e) {
		e = dw_Event.DOMit(e); var tgt = e.target;
		if (tgt.nodeType != 1) tgt = tgt.parentNode; // safari...
		return tgt;
	}
}

// Danny Goodman's version (DHTML def ref)
function addLoadEvent(func) {
		var oldQueue = window.onload? window.onload: function() {};
		window.onload = function() {
				oldQueue();
				func();
		}
}

//============ dw_viewport.js

var viewport = {
	getWinWidth: function () {
		this.width = 0;
		if (window.innerWidth) this.width = window.innerWidth - 18;
		else if (document.documentElement && document.documentElement.clientWidth)
			this.width = document.documentElement.clientWidth;
		else if (document.body && document.body.clientWidth)
			this.width = document.body.clientWidth;
	},

	getWinHeight: function () {
		this.height = 0;
		if (window.innerHeight) this.height = window.innerHeight - 18;
		else if (document.documentElement && document.documentElement.clientHeight)
			this.height = document.documentElement.clientHeight;
		else if (document.body && document.body.clientHeight)
			this.height = document.body.clientHeight;
	},

	getScrollX: function () {
		this.scrollX = 0;
		if (typeof window.pageXOffset == "number") this.scrollX = window.pageXOffset;
		else if (document.documentElement && document.documentElement.scrollLeft)
			this.scrollX = document.documentElement.scrollLeft;
		else if (document.body && document.body.scrollLeft)
			this.scrollX = document.body.scrollLeft;
		else if (window.scrollX) this.scrollX = window.scrollX;
	},

	getScrollY: function () {
		this.scrollY = 0;
		if (typeof window.pageYOffset == "number") this.scrollY = window.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
			this.scrollY = document.documentElement.scrollTop;
		else if (document.body && document.body.scrollTop)
			this.scrollY = document.body.scrollTop;
		else if (window.scrollY) this.scrollY = window.scrollY;
	},

	getAll: function () {
		this.getWinWidth(); this.getWinHeight();
		this.getScrollX();  this.getScrollY();
	}

}

//============ dw_tooltip_sel.js

var Tooltip = {
		followMouse: true,
		overlaySelects: true,  // iframe shim for select lists (ie win)
		offX: 8,
		offY: 12,
		tipDiv: null,
		stickyTipDiv: null,
		showDelay: 100,
		hideDelay: 200,

		ovTimer: 0, // for overlaySelects
		ready:false, supportsOverlay:false,

		init: function() {
				if ( !this.ready) {
						this.supportsOverlay = this._checkOverlaySupport();
						this.ready = true;
				}
		},

		getDiv: function(sticky, id, doBuild)
		{
			if (!id)
			{
				if (sticky)
					id = "_stickyTipDiv_";
				else
					id = "_tipDiv_";
			}

			var div = document.getElementById(id);
			if (!div && doBuild && document.createElement && document.body && typeof document.body.appendChild != "undefined" )
			{
				div = document.createElement("DIV");
				div.id = id;
				div.style.position = "absolute";
				div.style.visibility = "hidden";
				div.style.left = "0px";
				div.style.top = "0px";
				if (sticky)
					div.style.zIndex = "10000";
				else
					div.style.zIndex = "10100";
				document.body.appendChild(div);
			}

			return div;
		},

		show: function(e, div) {
				if (div.timer) { clearTimeout(div.timer);	div.timer = 0; }
				if (this.followMouse)
				{
					Tooltip.mouseTrackDiv = div;
					dw_Event.add( document, "mousemove", this._trackMouse, true );
				}
				viewport.getAll();
				this._handleOverlay(div, 1, this.showDelay);
				this._positionTip(div, e);
				div.timer = setTimeout("Tooltip._toggleVis('" + div.id + "', 'visible')", this.showDelay);
		},

		stick: function(e, div) {
				if (div.timer) { clearTimeout(div.timer);	div.timer = 0; }
				viewport.getAll();
				this._handleOverlay(div, 1, this.showDelay);
				this._positionTip(div, e);
				div.timer = setTimeout("Tooltip._toggleVis('" + div.id + "', 'visible')", this.showDelay);
		},

		hide: function(div) {
				if (div)
				{
					if (div.timer) { clearTimeout(div.timer);	div.timer = 0; }
					this._handleOverlay(div, 0, this.hideDelay);
					div.timer = setTimeout("Tooltip._toggleVis('" + div.id + "', 'hidden')", this.hideDelay);
					if (this.followMouse)
					{
						dw_Event.remove( document, "mousemove", this._trackMouse, true );
					}
					this.followMouse = true;
				}
		},

		unstick: function(div) {
				if (div)
				{
					if (div.timer) { clearTimeout(div.timer);	div.timer = 0; }
					this._handleOverlay(div, 0, this.hideDelay);
					div.timer = setTimeout("Tooltip._toggleVis('" + div.id + "', 'hidden')", this.hideDelay);
				}
		},

		_positionTip: function(div, e) {
				if ( div && div.style ) {
						// put e.pageX/Y first! (for Safari)
						var x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
						var y = e.pageY? e.pageY: e.clientY + viewport.scrollY;

						if ( x + div.offsetWidth + this.offX > viewport.width + viewport.scrollX ) {
								x = x - div.offsetWidth - this.offX;
								if ( x < 0 ) x = 0;
						} else x = x + this.offX;

						if ( y + div.offsetHeight + this.offY > viewport.height + viewport.scrollY ) {
								y = y - div.offsetHeight - this.offY;
								if ( y < viewport.scrollY ) y = viewport.height + viewport.scrollY - div.offsetHeight;
						} else y = y + this.offY;

						if (y < viewport.scrollY) y = viewport.scrollY;
						div.style.left = x + "px"; div.style.top = y + "px";

						this._positionOverlay(div);
				}
		},

		_toggleVis: function(id, vis) { // to check for el, prevent (rare) errors
				var el = document.getElementById(id);
				if (el) el.style.visibility = vis;
		},

		_trackMouse: function(e) {
			e = dw_Event.DOMit(e);
			Tooltip._positionTip(Tooltip.mouseTrackDiv, e);
		},

		// check need for and support of iframe shim
		_checkOverlaySupport: function() {
				if ( navigator.userAgent.indexOf("Windows") != -1 &&
						typeof document.body != "undefined" &&
						typeof document.body.insertAdjacentHTML != "undefined" &&
						!window.opera && navigator.appVersion.indexOf("MSIE 5.0") == -1
						) return true;
				else return false;
		},

		_handleOverlay: function(div, bVis, d) {
				if ( this.overlaySelects && this.supportsOverlay ) {
						if (div.ovTimer) { clearTimeout(div.ovTimer); div.ovTimer = 0; }
						switch (bVis) {
								case 1 :
										div.shim = document.getElementById(div.id + '_Shim');
										if (!div.shim)
												document.body.insertAdjacentHTML("beforeEnd", '<iframe id="' + div.id + '_Shim' + '" src="' + iframesrc + '" style="position:absolute; left:0; top:0; z-index:500; visibility:hidden" scrolling="no" frameborder="0"></iframe>');
										div.shim = document.getElementById(div.id + '_Shim');
										if (div.shim) {
												div.shim.style.width = div.offsetWidth + "px";
												div.shim.style.height = div.offsetHeight + "px";
										}
										div.ovTimer = setTimeout("Tooltip._toggleVis('" + div.id + "_Shim" + "', 'visible')", d);
								break;
								case 0 :
										div.ovTimer = setTimeout("Tooltip._toggleVis('" + div.id + "_Shim" + "', 'hidden')", d);
								break;
						 }
				}
		},

		_positionOverlay: function(div) {
				if ( this.overlaySelects && this.supportsOverlay && div && div.shim ) {
						div.shim.style.left = div.style.left;
						div.shim.style.top = div.style.top;
				}
		}
}

//============ dw_glide.js

// acc is number between -1 and 1 ( -1 full decelerated, 1 full accelerated, 0 linear, i.e. no acceleration)
dynObj.prototype.slideTo = function (destX,destY,slideDur,acc,endFn) {
	if (!document.getElementById) return;
	this.slideDur = slideDur || .0001; var acc = -acc || 0;
	if (endFn) this.onSlideEnd = endFn;
	// hold destination values (check for movement on 1 axis only)
	if (destX == null) this.destX = this.x;	else this.destX = destX;
	if (destY == null) this.destY = this.y; else this.destY = destY;
	this.startX = this.x; this.startY = this.y;
	this.st = new Date().getTime();
	// control points for bezier-controlled slide (see www.youngpup.net accelimation)
	this.xc1 = this.x + ( (1+acc) * (this.destX-this.x)/3 );
	this.xc2 = this.x + ( (2+acc) * (this.destX-this.x)/3 );
	this.yc1 = this.y + ( (1+acc) * (this.destY-this.y)/3 );
	this.yc2 = this.y + ( (2+acc) * (this.destY-this.y)/3 );
	this.sliding = true;
	this.onSlideStart();
	dw_Animation.add(this.animString + ".doSlide()");
}

dynObj.prototype.doSlide = function() {
	if (!this.sliding) return;
	var elapsed = new Date().getTime() - this.st;
	if (elapsed < this.slideDur) {
		var x = dw_Bezier.getValue(elapsed/this.slideDur, this.startX, this.destX, this.xc1, this.xc2);
		var y = dw_Bezier.getValue(elapsed/this.slideDur, this.startY, this.destY, this.yc1, this.yc2);
		this.shiftTo( Math.round(x) ,Math.round(y) );
		this.onSlide();
	} else {	// if time's up
		dw_Animation.remove(this.animString + ".doSlide()");
		this.shiftTo(this.destX,this.destY);
		this.onSlide();
		this.sliding = false;
		this.onSlideEnd();
	}
}

dynObj.prototype.slideBy = function(dx,dy,slideDur,acc,endFn) {
	var destX=this.x+dx; var destY=this.y+dy;
	this.slideTo(destX,destY,slideDur,acc,endFn);
}

dynObj.prototype.onSlideStart = function () {}
dynObj.prototype.onSlide = function () {}
dynObj.prototype.onSlideEnd = function () { if (this.el) this.el = null; }

//============ dw_glider.js

Glider.holder = [];
function Glider(id,x,y,w,h,d,ac) {
	this.glideDur = d || 1000; this.origX = x; this.origY = y; this.ac = -ac || 0;
	this.baseObj = dynObj;
	this.baseObj(id,x,y,w,h);
	Glider.holder[Glider.holder.length] = this;
	if (!Glider.winHt) Glider.winHt = getWinHeight();
}
Glider.prototype = new dynObj;
Glider.prototype.onGlideInit = function () {}
Glider.prototype.onGlide = function () {}

Glider.prototype.checkGlider = function(manualOverride) {
	if (!this.manualGlide || manualOverride)
	{
		var destY = getScrollY() + this.origY;
		if (destY != this.y) {
			if (destY != this.dy) {
				this.dy = destY;
				this.glideInit();
				this.onGlideInit();
			}
			this.glide();
			this.onGlide();
		}
	}
}

Glider.prototype.glideInit = function() {
	this.gt = new Date().getTime();
	var distY = this.dy - this.y;
	if ( Math.abs(distY) > Glider.winHt ) {	// distance greater than window height?
		this.gsy = (distY > 0)? this.dy - Glider.winHt: this.dy + Glider.winHt;
	} else this.gsy = this.y;
	this.g_yc1 = this.gsy + ( (1+this.ac) * (this.dy - this.gsy)/3 );
	this.g_yc2 = this.gsy + ( (2+this.ac) * (this.dy - this.gsy)/3 );
}

Glider.prototype.glide = function() {
	var elapsed = new Date().getTime() - this.gt;
	if (elapsed < this.glideDur) {
		var y = dw_Bezier.getValue( elapsed/this.glideDur, this.gsy, this.dy, this.g_yc1, this.g_yc2 );
		this.shiftTo(null,y);
	} else this.shiftTo(null,this.dy);
}

Glider.control = function() {
	for (var i=0; Glider.holder[i]; i++) {
		var curObj = Glider.holder[i];
		if (curObj) curObj.checkGlider();
	}
}

dw_Animation.add(Glider.control);

// returns height of window
function getWinHeight() {
	var winHt = 0;
	if (window.innerHeight) winHt = window.innerHeight-18;
	else if (document.documentElement && document.documentElement.clientHeight)
		winHt = document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight)
		winHt = document.body.clientHeight;
	return winHt;
}

// returns amount of vertical scroll
function getScrollY() {
	var sy = 0;
	if (document.documentElement && document.documentElement.scrollTop)
		sy = document.documentElement.scrollTop;
	else if (document.body && document.body.scrollTop)
		sy = document.body.scrollTop;
	else if (window.pageYOffset)
		sy = window.pageYOffset;
	else if (window.scrollY)
		sy = window.scrollY;
	return sy;
}

// onresize, get window height
if (window.addEventListener)
	window.addEventListener("resize", function(){ Glider.winHt = getWinHeight(); }, "false");
else if (window.attachEvent)
	window.attachEvent("onresize", function(){ Glider.winHt = getWinHeight(); } );

//============ dw_shim.js

dw_SelectsShim = {
		doOverlay: true,  // do iframe shim for select lists? (for ie win)
		supported: false,
		checked: false,

		init: function(lyrID) {
				if ( !dw_SelectsShim.checked ) {
						dw_SelectsShim.supported = dw_SelectsShim.checkSupport();
						dw_SelectsShim.checked = true;
				}

				var lyr = document.getElementById? document.getElementById(lyrID): null;
				// create, position, and size iframe
				if ( lyr && dw_SelectsShim.doOverlay && dw_SelectsShim.supported ) {
						// old -- document.body.insertAdjacentHTML("beforeEnd", '<iframe id="' + lyrID + '_shim" src="' + iframesrc + '" style="position:absolute; left:0; top:0; z-index:1; visibility:hidden" scrolling="no" frameborder="0"></iframe>');
						// newer -- document.body.insertAdjacentHTML("beforeEnd", '<iframe id="' + lyrID + '_shim" src="' + iframesrc + '" style="position:absolute; left:0; top:0; z-index:1; display:none" scrolling="no" frameborder="0"></iframe>');
						// set the shim relative to the layer (not the document body)
						lyr.insertAdjacentHTML("afterEnd", '<iframe id="' + lyrID + '_shim" src="' + iframesrc + '" style="position:absolute; left:0; top:0; z-index:1; display:none" scrolling="no" frameborder="0"></iframe>');
						var shim = document.getElementById( lyrID + '_shim' );
						if (shim) {
								shim.style.width = lyr.offsetWidth + "px";
								shim.style.height = lyr.offsetHeight + "px";
								shim.style.left = lyr.style.left;
								shim.style.top = lyr.style.top;
								//shim.style.visibility = lyr.style.visibility;
								shim.style.display = lyr.style.display;
						}
				}
		},

		// position with other layer(s)
		position: function() {
				if (!document.getElementById || !dw_SelectsShim.doOverlay || !dw_SelectsShim.supported ) return;
				var lyr = document.getElementById(this.id);
				var shim = document.getElementById( this.id + '_shim');
				if ( shim && lyr ) {
						shim.style.left = lyr.style.left;
						shim.style.top = lyr.style.top;
				}
		},

		// size with other layer(s)
		syncShimSize: function() {
				if (!document.getElementById || !dw_SelectsShim.doOverlay || !dw_SelectsShim.supported ) return;
				var lyr = document.getElementById(this.id);
				var shim = document.getElementById( this.id + '_shim');
				if ( shim && lyr ) {
						shim.style.width = lyr.offsetWidth + "px";
						shim.style.height = lyr.offsetHeight + "px";
				}
		},

		// show/hide with other layer(s)
		setVisibility: function() {
				if (!document.getElementById || !dw_SelectsShim.doOverlay || !dw_SelectsShim.supported ) return;
				var lyr = document.getElementById(this.id);
				var shim = document.getElementById( this.id + '_shim');
				if ( shim && lyr ) {
						//shim.style.visibility = lyr.style.visibility;
						shim.style.display = lyr.style.display;
				}
		},

		checkSupport: function() {
				if ( navigator.userAgent.indexOf("Windows") != -1 &&
						typeof document.body != "undefined" &&
						typeof document.body.insertAdjacentHTML != "undefined" &&
						!window.opera && navigator.appVersion.indexOf("MSIE 5.0") == -1
						) return true;
				else return false;
		}
};

//============ dw_misc.js

//  sub-window code for presenting example documents - version date Dec 2003
//  Some example links: <a href="yo.html" onclick="return openSubWin(this.href)">link</a>
//  <a href="some.html" onclick="return openSubWin(this.href, 'win2', null, null, 800, 600, 'resizable')">link</a>
function openSubWin(url, nm, x, y, w, h, atts) {
	nm = nm || "subwindow";
	atts = atts || "menubar,resizable,scrollbars";
	w = w || 600; h = h || 450;
	x = (typeof x=="number")? x: window.opera? 100: Math.round( (screen.availWidth - w)/2 );
	y = (typeof y=="number")? y: window.opera? 20: Math.round( (screen.availHeight - h)/2 );
	atts += ',width='+w+',height='+h+',left='+x+',top='+y;
	var win = window.open(url, nm, atts);
	if (win) {
		if (!win.closed) { win.resizeTo(w,h); win.moveTo(x,y); win.focus(); return false; }
	}
	return true;
}

// attach title to links that open sub-windows
function setSubWinTitle() {
	var lnks, att;
	if ( document.getElementsByTagName ) lnks = document.getElementsByTagName("A");
	if ( lnks && lnks[0].getAttribute ) {
		for (var i=0; lnks[i]; i++) {
			if ( ( att = lnks[i].getAttribute("onclick") )  && att.toString().indexOf("openSubWin") != -1 )
				lnks[i].setAttribute("title", "opens sub-window");
		}
	}
}

// set target attribute to "_blank" if link has class="blank"
function setTargetBlank() {
	var lnks;
	if ( document.getElementsByTagName ) lnks = document.getElementsByTagName("A");
	if ( lnks && lnks[0].getAttribute ) {
		for (var i=0; lnks[i]; i++) {
			if ( lnks[i].getAttribute("href") && lnks[i].className == "blank" )
				lnks[i].target = "_blank";
		}
	}
}

// pass id of elements in which you want no marquee to be displayed around links
// for example: preventMarquee("navs", "text");
function preventMarquee() {
	if ( document.getElementById && document.getElementsByTagName ) {
		for (var i=0; arguments[i]; i++) {
			var el = document.getElementById( arguments[i] );
			var lnks = el.getElementsByTagName('A');
			for (var j=0; lnks[j]; j++) lnks[j].hideFocus = true;
		}
	}
}

//	modified from www.hivelogic.com/safeaddress/	by Dan Benjamin
//	presented at www.alistapart.com/stories/spam/
//  to insert email address anywhere in document:
//  <script type="text/javascript">noSpamEmail('link text here')</script>
function noSpamEmail(txt) {
	var address = '<a href="';
	address += "ma";  address += "il";  address += "to:";
	address += "&#99;&#111;&#110;&#116;&#97;&#99;&#116;&#95;&#48;&#49;";
	address += "&#64;";
	address += "&#100;&#121;&#110;&#45;&#119;&#101;&#98;&#46;&#99;&#111;&#109;";
	address += '">' + txt + "<\/a>";
	document.write(address);
}

// for PayPal form
function dw_getAddy2() {
	var addy = "&#115;&#104;&#112;&#48;&#56;&#48;&#56;";
	addy += "&#64;";
	addy += "&#100;&#121;&#110;&#45;&#119;&#101;&#98;&#46;&#99;&#111;&#109;";
	return addy;
}


//============ dw_scroll.js - Aug 2008

// horizId only needed for horizontal scrolling
function dw_scrollObj(wndoId, lyrId, horizId) {
		var wn = document.getElementById(wndoId);
		this.id = wndoId; dw_scrollObj.col[this.id] = this;
		this.animString = "dw_scrollObj.col." + this.id;
		this.load(lyrId, horizId);

		if (wn.addEventListener) {
				wn.addEventListener('DOMMouseScroll', dw_scrollObj.doOnMouseWheel, false);
		}
		wn.onmousewheel = dw_scrollObj.doOnMouseWheel;
}

dw_scrollObj.isSupported = function () {
		if ( document.getElementById && document.getElementsByTagName
				 && document.addEventListener || document.attachEvent ) {
				return true;
		}
		return false;
}

dw_scrollObj.col = {}; // collect instances
dw_scrollObj.defaultSpeed = dw_scrollObj.prototype.speed = 100; // default for mouseover or mousedown scrolling
dw_scrollObj.defaultSlideDur = dw_scrollObj.prototype.slideDur = 500; // default duration of glide onclick

// pseudo events
dw_scrollObj.prototype.on_load = function() {} // when dw_scrollObj initialized or new layer loaded
dw_scrollObj.prototype.on_scroll = function() {}
dw_scrollObj.prototype.on_scroll_start = function() {}
dw_scrollObj.prototype.on_scroll_stop = function() {} // when scrolling has ceased (mouseout/up)
dw_scrollObj.prototype.on_scroll_end = function() {} // reached end
dw_scrollObj.prototype.on_update = function() {} // called in updateDims

dw_scrollObj.prototype.on_glidescroll = function() {}
dw_scrollObj.prototype.on_glidescroll_start = function() {}
dw_scrollObj.prototype.on_glidescroll_stop = function() {} // destination (to/by) reached
dw_scrollObj.prototype.on_glidescroll_end = function() {} // reached end

dw_scrollObj.prototype.load = function(lyrId, horizId) {
		var wndo, lyr;
		if (this.lyrId) { // layer currently loaded?
				lyr = document.getElementById(this.lyrId);
				lyr.style.visibility = "hidden";
		}
		this.lyr = lyr = document.getElementById(lyrId); // hold this.lyr?
		this.lyr.style.position = 'absolute';
		this.lyrId = lyrId; // hold id of currently visible layer
		this.horizId = horizId || null; // hold horizId for update fn
		wndo = document.getElementById(this.id);
		this.y = 0; this.x = 0; this.shiftTo(0,0);
		this.getDims(wndo, lyr);
		lyr.style.visibility = "visible";
		this.ready = true; this.on_load();
}

dw_scrollObj.prototype.shiftTo = function(x, y) {
		if (this.lyr) {
				this.lyr.style.left = (this.x = x) + "px";
				this.lyr.style.top = (this.y = y) + "px";
		}
}

dw_scrollObj.prototype.getX = function() { return this.x; }
dw_scrollObj.prototype.getY = function() { return this.y; }

dw_scrollObj.prototype.getDims = function(wndo, lyr) {
		this.wd = this.horizId? document.getElementById( this.horizId ).offsetWidth: lyr.offsetWidth;
		this.maxX = (this.wd - wndo.offsetWidth > 0)? this.wd - wndo.offsetWidth: 0;
		this.maxY = (lyr.offsetHeight - wndo.offsetHeight > 0)? lyr.offsetHeight - wndo.offsetHeight: 0;
}

dw_scrollObj.prototype.updateDims = function() {
		var wndo = document.getElementById(this.id);
		var lyr = document.getElementById( this.lyrId );
		this.getDims(wndo, lyr);
		this.on_update();
}

// for mouseover/mousedown scrolling
dw_scrollObj.prototype.initScrollVals = function(deg, speed) {
		if (!this.ready) return;
		if (this.timerId) {
				clearInterval(this.timerId); this.timerId = 0;
		}
		this.speed = speed || dw_scrollObj.defaultSpeed;
		this.fx = (deg == 0)? -1: (deg == 180)? 1: 0;
		this.fy = (deg == 90)? 1: (deg == 270)? -1: 0;
		this.endX = (deg == 90 || deg == 270)? this.x: (deg == 0)? -this.maxX: 0;
		this.endY = (deg == 0 || deg == 180)? this.y: (deg == 90)? 0: -this.maxY;
		this.lyr = document.getElementById(this.lyrId);
		this.lastTime = new Date().getTime();
		this.on_scroll_start(this.x, this.y);
		this.timerId = setInterval(this.animString + ".scroll()", 10);
}

dw_scrollObj.prototype.scroll = function() {
		var now = new Date().getTime();
		var d = (now - this.lastTime)/1000 * this.speed;
		if (d > 0) {
				var x = this.x + Math.round(this.fx * d); var y = this.y + Math.round(this.fy * d);
				if ( ( this.fx == -1 && x > -this.maxX ) || ( this.fx == 1 && x < 0 ) ||
								( this.fy == -1 && y > -this.maxY ) || ( this.fy == 1 && y < 0 ) )
			 {
						this.lastTime = now;
						this.shiftTo(x, y);
						this.on_scroll(x, y);
				} else {
						clearInterval(this.timerId); this.timerId = 0;
						this.shiftTo(this.endX, this.endY);
						this.on_scroll(this.endX, this.endY);
						this.on_scroll_end(this.endX, this.endY);
				}
		}
}

// when scrolling has ceased (mouseout/up)
dw_scrollObj.prototype.ceaseScroll = function() {
		if (!this.ready) return;
		if (this.timerId) {
				clearInterval(this.timerId); this.timerId = 0;
		}
		this.on_scroll_stop(this.x, this.y);
}

// glide onclick scrolling
dw_scrollObj.prototype.initScrollByVals = function(dx, dy, dur) {
		if ( !this.ready || this.sliding ) return;
		this.startX = this.x; this.startY = this.y;
		this.destX = this.destY = this.distX = this.distY = 0;
		if (dy < 0) {
				this.distY = (this.startY + dy >= -this.maxY)? dy: -(this.startY  + this.maxY);
		} else if (dy > 0) {
				this.distY = (this.startY + dy <= 0)? dy: -this.startY;
		}
		if (dx < 0) {
				this.distX = (this.startX + dx >= -this.maxX)? dx: -(this.startX + this.maxX);
		} else if (dx > 0) {
				this.distX = (this.startX + dx <= 0)? dx: -this.startX;
		}
		this.destX = this.startX + this.distX; this.destY = this.startY + this.distY;
		this.glideScrollPrep(this.destX, this.destY, dur);
}

dw_scrollObj.prototype.initScrollToVals = function(destX, destY, dur) {
		if ( !this.ready || this.sliding ) return;
		this.startX = this.x; this.startY = this.y;
		this.destX = -Math.max( Math.min(destX, this.maxX), 0);
		this.destY = -Math.max( Math.min(destY, this.maxY), 0);
		this.distY = this.destY - this.startY;
		this.distX = this.destX - this.startX;
		this.glideScrollPrep(this.destX, this.destY, dur);
}

dw_scrollObj.prototype.glideScrollPrep = function(destX, destY, dur) {
		this.slideDur = (typeof dur == 'number')? dur: dw_scrollObj.defaultSlideDur;
		this.per = Math.PI/(2 * this.slideDur); this.sliding = true;
		this.lyr = document.getElementById(this.lyrId);
		this.startTime = new Date().getTime();
		this.timerId = setInterval(this.animString + ".doGlideScroll()",10);
		this.on_glidescroll_start(this.startX, this.startY);
}

dw_scrollObj.prototype.doGlideScroll = function() {
		var elapsed = new Date().getTime() - this.startTime;
		if (elapsed < this.slideDur) {
				var x = this.startX + Math.round( this.distX * Math.sin(this.per*elapsed) );
				var y = this.startY + Math.round( this.distY * Math.sin(this.per*elapsed) );
				this.shiftTo(x, y);
				this.on_glidescroll(x, y);
		} else {	// if time's up
				clearInterval(this.timerId); this.timerId = 0; this.sliding = false;
				this.shiftTo(this.destX, this.destY);
				this.on_glidescroll(this.destX, this.destY);
				this.on_glidescroll_stop(this.destX, this.destY);
				// end of axis reached ?
				if ( this.distX && (this.destX == 0 || this.destX == -this.maxX)
					|| this.distY && (this.destY == 0 || this.destY == -this.maxY) ) {
						this.on_glidescroll_end(this.destX, this.destY);
				}
		}
}

//  resource: http://adomas.org/javascript-mouse-wheel/
dw_scrollObj.handleMouseWheel = function(id, delta) {
		var wndo = dw_scrollObj.col[id];
		var x = wndo.x;
		var y = wndo.y;
		wndo.on_scroll_start(x,y);
		var ny;
		ny = 12  * delta + y
		ny = (ny < 0 && ny >= -wndo.maxY)? ny: (ny < -wndo.maxY)? -wndo.maxY: 0;
		wndo.shiftTo(x, ny);
		wndo.on_scroll(x, ny);
}

dw_scrollObj.doOnMouseWheel = function(e) {
		var delta = 0;
		if (!e) e = window.event;
		if (e.wheelDelta) { /* IE/Opera. */
				delta = e.wheelDelta/120;
				if (window.opera) delta = -delta;
		} else if (e.detail) { // Mozilla
				delta = -e.detail/3;
		}
		if (delta) { // > 0 up, < 0 down
				dw_scrollObj.handleMouseWheel(this.id, delta);
		}
		if (e.preventDefault) e.preventDefault();
		e.returnValue = false;
}

dw_scrollObj.GeckoTableBugFix = function() {} // no longer need old bug fix


// Get position of el within layer (oCont) sOff: 'left' or 'top'
// Assumes el is within oCont
function dw_getLayerOffset(el, oCont, sOff) {
		var off = "offset" + sOff.charAt(0).toUpperCase() + sOff.slice(1);
		var val = el[off];
		while ( (el = el.offsetParent) != oCont )
				val += el[off];
		var clientOff = off.replace("offset", "client");
		if ( el[clientOff] ) val += el[clientOff];
		return val;
}


//============ dw_scrollbar.js - Aug 2008

function dw_Slidebar(barId, trackId, axis, x, y) {
		var bar = document.getElementById(barId);
		var track = document.getElementById(trackId);
		this.barId = barId; this.trackId = trackId;
		this.axis = axis; this.x = x || 0; this.y = y || 0;
		dw_Slidebar.col[this.barId] = this;
		this.bar = bar;  this.shiftTo(x, y);

		// hold for setBarSize
		this.trkHt = track.offsetHeight;
		this.trkWd = track.offsetWidth;

		if (axis == 'v') {
				this.maxY = this.trkHt - bar.offsetHeight - y;
				this.maxX = x; this.minX = x; this.minY = y;
		} else {
				this.maxX = this.trkWd - bar.offsetWidth - x;
				this.minX = x; this.maxY = y; this.minY = y;
		}

		this.on_drag_start =  this.on_drag =   this.on_drag_end =
		this.on_slide_start = this.on_slide =  this.on_slide_end = function() {}

		bar.onmousedown = dw_Slidebar.prepDrag;
		// pass barId to obtain instance from dw_Slidebar.col
		track.onmousedown = function(e) { dw_Slidebar.prepSlide(barId, e); }
		this.bar = bar = null; track = null;
}

dw_Slidebar.col = {}; // hold instances for global access
dw_Slidebar.current = null; // hold current instance

dw_Slidebar.prototype.slideDur = 500;

// track received onmousedown event
dw_Slidebar.prepSlide = function(barId, e) {
		var _this = dw_Slidebar.col[barId];
		dw_Slidebar.current = _this;
		var bar = _this.bar = document.getElementById(barId);

		if ( _this.timer ) { clearInterval(_this.timer); _this.timer = 0; }
		e = e? e: window.event;

		e.offX = (typeof e.layerX != "undefined")? e.layerX: e.offsetX;
		e.offY = (typeof e.layerY != "undefined")? e.layerY: e.offsetY;
		_this.startX = parseInt(bar.style.left); _this.startY = parseInt(bar.style.top);

		if (_this.axis == "v") {
				_this.destX = _this.startX;
				_this.destY = (e.offY < _this.startY)? e.offY: e.offY - bar.offsetHeight;
				_this.destY = Math.min( Math.max(_this.destY, _this.minY), _this.maxY );
		} else {
				_this.destX = (e.offX < _this.startX)? e.offX: e.offX - bar.offsetWidth;
				_this.destX = Math.min( Math.max(_this.destX, _this.minX), _this.maxX );
				_this.destY = _this.startY;
		}
		_this.distX = _this.destX - _this.startX; _this.distY = _this.destY - _this.startY;
		_this.per = Math.PI/(2 * _this.slideDur);
		_this.slideStartTime = new Date().getTime();
		_this.on_slide_start(_this.startX, _this.startY);
		_this.timer = setInterval("dw_Slidebar.doSlide()", 10);
}

dw_Slidebar.doSlide = function() {
		var _this = dw_Slidebar.current;
		var elapsed = new Date().getTime() - _this.slideStartTime;
		if (elapsed < _this.slideDur) {
				var x = _this.startX + _this.distX * Math.sin(_this.per*elapsed);
				var y = _this.startY + _this.distY * Math.sin(_this.per*elapsed);
				_this.shiftTo(x,y);
				_this.on_slide(x, y);
		} else {	// if time's up
				clearInterval(_this.timer);
				_this.shiftTo(_this.destX,  _this.destY);
				_this.on_slide(_this.destX,  _this.destY);
				_this.on_slide_end(_this.destX, _this.destY);
				dw_Slidebar.current = null;
		}
}

dw_Slidebar.prepDrag = function (e) {
		var bar = this; // bar received onmousedown event
		var barId = this.id; // id of element mousedown event assigned to
		var _this = dw_Slidebar.col[barId]; // Slidebar instance
		dw_Slidebar.current = _this;
		_this.bar = bar;
		e = dw_Event.DOMit(e);
		if ( _this.timer ) { clearInterval(_this.timer); _this.timer = 0; }
		_this.downX = e.clientX; _this.downY = e.clientY;
		_this.startX = parseInt(bar.style.left);
		_this.startY = parseInt(bar.style.top);
		_this.on_drag_start(_this.startX, _this.startY);
		dw_Event.add( document, "mousemove", dw_Slidebar.doDrag, true );
		dw_Event.add( document, "mouseup",   dw_Slidebar.endDrag,  true );
		e.stopPropagation(); e.preventDefault();
}

dw_Slidebar.doDrag = function(e) {
		if ( !dw_Slidebar.current ) return; // avoid errors in ie if inappropriate selections
		var _this = dw_Slidebar.current;
		var bar = _this.bar;
		e = dw_Event.DOMit(e);
		var nx = _this.startX + e.clientX - _this.downX;
		var ny = _this.startY + e.clientY - _this.downY;
		nx = Math.min( Math.max( _this.minX, nx ), _this.maxX);
		ny = Math.min( Math.max( _this.minY, ny ), _this.maxY);
		_this.shiftTo(nx, ny);
		_this.on_drag(nx, ny);
		e.preventDefault(); e.stopPropagation();
}

dw_Slidebar.endDrag = function() {
		if ( !dw_Slidebar.current ) return; // avoid errors in ie if inappropriate selections
		var _this = dw_Slidebar.current;
		var bar = _this.bar;
		dw_Event.remove( document, "mousemove", dw_Slidebar.doDrag, true );
		dw_Event.remove( document, "mouseup",   dw_Slidebar.endDrag,  true );
		_this.on_drag_end( parseInt(bar.style.left), parseInt(bar.style.top) );
		dw_Slidebar.current = null;
}

dw_Slidebar.prototype.shiftTo = function(x, y) {
		if ( this.bar ) {
				this.bar.style.left = x + "px";
				this.bar.style.top = y + "px";
		}
}

/////////////////////////////////////////////////////////////////////
//  connect slidebar with scrollObj
dw_scrollObj.prototype.setUpScrollbar = function(barId, trkId, axis, offx, offy, bSize) {
		var scrollbar = new dw_Slidebar(barId, trkId, axis, offx, offy);
		if (axis == "v") {
				this.vBarId = barId;
		} else {
				this.hBarId = barId;
		}
		scrollbar.wndoId = this.id;
		scrollbar.bSizeDragBar = (bSize == false)? false: true;
		if (scrollbar.bSizeDragBar) {
				dw_Scrollbar_Co.setBarSize(this, scrollbar);
		}
		dw_Scrollbar_Co.setEvents(this, scrollbar);
}

// Coordinates slidebar and scrollObj
dw_Scrollbar_Co = {

		// This function is called for each scrollbar attached to a scroll area (change from previous version)
		setBarSize: function(scrollObj, barObj) {
				var lyr = document.getElementById(scrollObj.lyrId);
				var wn = document.getElementById(scrollObj.id);
				if ( barObj.axis == 'v' ) {
						var bar = document.getElementById(scrollObj.vBarId);
						bar.style.height = (lyr.offsetHeight > wn.offsetHeight)?
								barObj.trkHt / ( lyr.offsetHeight / wn.offsetHeight ) + "px":
								barObj.trkHt - ( 2 * barObj.minY ) + "px";
						barObj.maxY = barObj.trkHt - bar.offsetHeight - barObj.minY;
				} else if ( barObj.axis == 'h' ) {
						var bar = document.getElementById(scrollObj.hBarId);
						bar.style.width = (scrollObj.wd > wn.offsetWidth)?
								barObj.trkWd / ( scrollObj.wd / wn.offsetWidth ) + "px":
								barObj.trkWd - ( 2 * barObj.minX ) + "px";
						barObj.maxX = barObj.trkWd - bar.offsetWidth - barObj.minX;
				}
		},

		// Find bars associated with this scrollObj. if they have bSizeDragBar set true reevaluate size and reset position to top
		resetBars: function(scrollObj) {
				var barObj, bar;
				if (scrollObj.vBarId) {
						barObj = dw_Slidebar.col[scrollObj.vBarId];
						bar = document.getElementById(scrollObj.vBarId);
						bar.style.left = barObj.minX + "px"; bar.style.top = barObj.minY + "px";
						if (barObj.bSizeDragBar) {
								dw_Scrollbar_Co.setBarSize(scrollObj, barObj);
						}
				}
				if (scrollObj.hBarId) {
						barObj = dw_Slidebar.col[scrollObj.hBarId];
						bar = document.getElementById(scrollObj.hBarId);
						bar.style.left = barObj.minX + "px"; bar.style.top = barObj.minY + "px";
						if (barObj.bSizeDragBar) {
								dw_Scrollbar_Co.setBarSize(scrollObj, barObj);
						}
				}
		},

		setEvents: function(scrollObj, barObj) {
				// scrollObj
				this.addEvent(scrollObj, 'on_load', function() { dw_Scrollbar_Co.resetBars(scrollObj); } );
				this.addEvent(scrollObj, 'on_scroll_start', function() { dw_Scrollbar_Co.getBarRefs(scrollObj) } );
				this.addEvent(scrollObj, 'on_glidescroll_start', function() { dw_Scrollbar_Co.getBarRefs(scrollObj) } );
				this.addEvent(scrollObj, 'on_scroll', function(x,y) { dw_Scrollbar_Co.updateScrollbar(scrollObj, x, y) } );
				this.addEvent(scrollObj, 'on_glidescroll', function(x,y) { dw_Scrollbar_Co.updateScrollbar(scrollObj, x, y) } );
				this.addEvent(scrollObj, 'on_scroll_stop', function(x,y) { dw_Scrollbar_Co.updateScrollbar(scrollObj, x, y); } );
				this.addEvent(scrollObj, 'on_glidescroll_stop', function(x,y) { dw_Scrollbar_Co.updateScrollbar(scrollObj, x, y); } );
				this.addEvent(scrollObj, 'on_scroll_end', function(x,y) { dw_Scrollbar_Co.updateScrollbar(scrollObj, x, y); } );
				this.addEvent(scrollObj, 'on_glidescroll_end', function(x,y) { dw_Scrollbar_Co.updateScrollbar(scrollObj, x, y); } );

				// barObj
				this.addEvent(barObj, 'on_slide_start', function() { dw_Scrollbar_Co.getWndoLyrRef(barObj) } );
				this.addEvent(barObj, 'on_drag_start', function() { dw_Scrollbar_Co.getWndoLyrRef(barObj) } );
				this.addEvent(barObj, 'on_slide', function(x,y) { dw_Scrollbar_Co.updateScrollPosition(barObj, x, y) } );
				this.addEvent(barObj, 'on_drag', function(x,y) { dw_Scrollbar_Co.updateScrollPosition(barObj, x, y) } );
				this.addEvent(barObj, 'on_slide_end', function(x,y) { dw_Scrollbar_Co.updateScrollPosition(barObj, x, y); } );
				this.addEvent(barObj, 'on_drag_end', function(x,y) { dw_Scrollbar_Co.updateScrollPosition(barObj, x, y); } );

		},

		// Provide means to add functions to be invoked on pseudo events (on_load, on_scroll, etc)
		// without overwriting any others that may already be set
		// by Mark Wubben (see http://simonwillison.net/2004/May/26/addLoadEvent/)
		addEvent: function(o, ev, fp) {
				var oldEv = o[ev];
				if ( typeof oldEv != 'function' ) {
						//o[ev] = fp;
						// almost all the functions (on_scroll, on_drag, etc.) pass x,y
						o[ev] = function (x,y) { fp(x,y); }
				} else {
						o[ev] = function (x,y) {
									oldEv(x,y );
									fp(x,y);
						}
				}
		},

		// Keep position of dragBar in sync with position of layer when scrolled by other means (mouseover, etc.)
		updateScrollbar: function(scrollObj, x, y) { //
				var nx, ny;
				if ( scrollObj.vBar && scrollObj.maxY ) {
						var vBar = scrollObj.vBar;
						ny = -( y * ( (vBar.maxY - vBar.minY) / scrollObj.maxY ) - vBar.minY );
						ny = Math.min( Math.max(ny, vBar.minY), vBar.maxY);
						if (vBar.bar) { // ref to bar el
								nx = parseInt(vBar.bar.style.left);
								vBar.shiftTo(nx, ny);
						}
				}
				if ( scrollObj.hBar && scrollObj.maxX ) {
						var hBar = scrollObj.hBar;
						nx = -( x * ( (hBar.maxX - hBar.minX) / scrollObj.maxX ) - hBar.minX );
						nx = Math.min( Math.max(nx, hBar.minX), hBar.maxX);
						if (hBar.bar) {
								ny = parseInt(hBar.bar.style.top);
								hBar.shiftTo(nx, ny);
						}
				}
		},

		updateScrollPosition: function(barObj, x, y) { // on scrollbar movement
				var nx, ny; var wndo = barObj.wndo;
				if ( !wndo.lyr ) {
						wndo.lyr = document.getElementById(wndo.lyrId);
				}
				if (barObj.axis == "v") {
						nx = wndo.x; // floating point values for loaded layer's position held in shiftTo method
						ny = -(y - barObj.minY) * ( wndo.maxY / (barObj.maxY - barObj.minY) ) || 0;
				} else {
						ny = wndo.y;
						nx = -(x - barObj.minX) * ( wndo.maxX / (barObj.maxX - barObj.minX) ) || 0;
				}
				wndo.shiftTo(nx, ny);
		},

		// Scroll area may have both vertical and horizontal bars
		getBarRefs: function(scrollObj) { // References to Slidebar instance and dom element
				if ( scrollObj.vBarId ) {
						scrollObj.vBar = dw_Slidebar.col[scrollObj.vBarId];
						scrollObj.vBar.bar = document.getElementById(scrollObj.vBarId);
				}
				if ( scrollObj.hBarId ) {
						scrollObj.hBar = dw_Slidebar.col[scrollObj.hBarId];
						scrollObj.hBar.bar = document.getElementById(scrollObj.hBarId);
				}
		},

		getWndoLyrRef: function(barObj) {
				var wndo = barObj.wndo = dw_scrollObj.col[ barObj.wndoId ];
				if ( wndo && !wndo.lyr ) {
						wndo.lyr = document.getElementById(wndo.lyrId);
				}
		}

}


//============ scroll_controls.js - Aug 2008

/////////////////////////////////////////////////////////////////////
// two ways to add style sheet for capable browsers

dw_writeStyleSheet = function(file) {
		document.write('<link rel="stylesheet" href="' + file + '" media="screen" />');
}

function dw_addLinkCSS(file) {
		if ( !document.createElement ) return;
		var el = document.createElement("link");
		el.setAttribute("rel", "stylesheet");
		el.setAttribute("type", "text/css");
		el.setAttribute("media", "screen");
		el.setAttribute("href", file);
		document.getElementsByTagName('head')[0].appendChild(el);
}
/////////////////////////////////////////////////////////////////////

// Example class names: load_wn_lyr1, load_wn_lyr2_t2
dw_scrollObj.prototype.setUpLoadLinks = function(controlsId) {
		var wndoId = this.id; var el = document.getElementById(controlsId);
		var links = el.getElementsByTagName('a');
		var cls, parts;
		for (var i=0; links[i]; i++) {
				cls = dw_scrollObj.get_DelimitedClass( links[i].className );
				parts = cls.split('_');
				if ( parts[0] == 'load' && parts[1] == wndoId && parts.length > 2 ) {
						// no checks on lyrId, horizId
						var lyrId = parts[2]; var horizId = parts[3]? parts[3]: null;
						dw_Event.add( links[i], 'click', function (wndoId, lyrId, horizId) {
								return function (e) {
										dw_scrollObj.col[wndoId].load(lyrId, horizId);
										if (e && e.preventDefault) e.preventDefault();
										return false;
								}
						}(wndoId, lyrId, horizId) ); // see Crockford js good parts pg 39
				}
		}
}

dw_scrollObj.prototype.setUpScrollControls = function(controlsId, autoHide, axis) {
		var wndoId = this.id; var el = document.getElementById(controlsId);
		if ( autoHide && axis == 'v' || axis == 'h' ) {
				dw_scrollObj.handleControlVis(controlsId, wndoId, axis);
				dw_Scrollbar_Co.addEvent( this, 'on_load', function() { dw_scrollObj.handleControlVis(controlsId, wndoId, axis); } );
				dw_Scrollbar_Co.addEvent( this, 'on_update', function() { dw_scrollObj.handleControlVis(controlsId, wndoId, axis); } );
		}

		var links = el.getElementsByTagName('a'), cls, eType;
		for (var i=0; links[i]; i++) {
				cls = dw_scrollObj.get_DelimitedClass( links[i].className );
				eType = dw_scrollObj.getEv_FnType( cls.slice(0, cls.indexOf('_') ) );
				switch ( eType ) {
						case 'mouseover' :
						case 'mousedown' :
								dw_scrollObj.handleMouseOverDownLinks(links[i], wndoId, cls);
								break;
						case 'scrollToId':
								dw_scrollObj.handleScrollToId(links[i], wndoId, cls);
								break;
						case 'scrollTo' :
						case 'scrollBy':
						case 'click':
								dw_scrollObj.handleClick(links[i], wndoId, cls) ;
								break;
				}
		}
}

dw_scrollObj.handleMouseOverDownLinks = function (linkEl, wndoId, cls) {
		var parts = cls.split('_'); var eType = parts[0];
		var re = /^(mouseover|mousedown)_(up|down|left|right)(_[\d]+)?$/;

		if ( re.test(cls) ) {
				var eAlt = (eType == 'mouseover')? 'mouseout': 'mouseup';
				var dir = parts[1];  var speed = parts[2] || null;
				var deg = (dir == 'up')? 90: (dir == 'down')? 270: (dir == 'left')? 180: 0;

				dw_Event.add(linkEl, eType, function (e) { dw_scrollObj.col[wndoId].initScrollVals(deg, speed); } );
				dw_Event.add(linkEl, eAlt, function (e) { dw_scrollObj.col[wndoId].ceaseScroll(); } );

				if ( eType == 'mouseover') {
						dw_Event.add( linkEl, 'mousedown', function (e) { dw_scrollObj.col[wndoId].speed *= 3; } );
						dw_Event.add( linkEl, 'mouseup', function (e) {
								dw_scrollObj.col[wndoId].speed = dw_scrollObj.prototype.speed; } );
				}
				dw_Event.add( linkEl, 'click', function(e) { if (e && e.preventDefault) e.preventDefault(); return false; } );
		}
}

// scrollToId_smile, scrollToId_smile_100, scrollToId_smile_lyr1_100
dw_scrollObj.handleScrollToId = function (linkEl, wndoId, cls) {
		var parts = cls.split('_'); var id = parts[1], lyrId, dur;
		if ( parts[2] ) {
				if ( isNaN( parseInt(parts[2]) ) ) {
						lyrId = parts[2];
						dur = ( parts[3] && !isNaN( parseInt(parts[3]) ) )? parseInt(parts[3]): null;
				} else {
						dur = parseInt( parts[2] );
				}
		}
		dw_Event.add( linkEl, 'click', function (e) {
						dw_scrollObj.scrollToId(wndoId, id, lyrId, dur);
						if (e && e.preventDefault) e.preventDefault();
						return false;
				} );
}

// doesn't checks if lyrId in wndo, el in lyrId
dw_scrollObj.scrollToId = function(wndoId, id, lyrId, dur) {
		var wndo = dw_scrollObj.col[wndoId];
		var el = document.getElementById(id);
		if (el) {
				if ( lyrId ) {
						if ( document.getElementById(lyrId) && wndo.lyrId != lyrId ) {
								wndo.load(lyrId);
						}
				}
				var lyr = document.getElementById(wndo.lyrId);
				var x = dw_getLayerOffset(el, lyr, 'left');
				var y = dw_getLayerOffset(el, lyr, 'top');
				wndo.initScrollToVals(x, y, dur);
		}
}

dw_scrollObj.handleClick = function (linkEl, wndoId, cls) {
		var wndo = dw_scrollObj.col[wndoId];
		var parts = cls.split('_'); var eType = parts[0];
		var dur_re = /^([\d]+)$/; var fn, re, x, y, dur;

		switch (eType) {
				case 'scrollTo' :
						fn = 'scrollTo';  re = /^(null|end|[\d]+)$/;
						x = re.test( parts[1] )? parts[1]: '';
						y = re.test( parts[2] )? parts[2]: '';
						dur = ( parts[3] && dur_re.test(parts[3]) )? parts[3]: null;
						break;
				case 'scrollBy': // scrollBy_m30_m40, scrollBy_null_m100, scrollBy_100_null
						fn = 'scrollBy';  re = /^(([m]?[\d]+)|null)$/;
						x = re.test( parts[1] )? parts[1]: '';
						y = re.test( parts[2] )? parts[2]: '';

						// negate numbers (m not - but vice versa)
						if ( !isNaN( parseInt(x) ) ) {
								x = -parseInt(x);
						} else if ( typeof x == 'string' ) {
								x = x.indexOf('m') !=-1 ? x.replace('m', ''): x;
						}
						if ( !isNaN( parseInt(y) ) ) {
								y = -parseInt(y);
						} else if ( typeof y == 'string' ) {
								y = y.indexOf('m') !=-1 ? y.replace('m', ''): y;
						}

						dur = ( parts[3] && dur_re.test(parts[3]) )? parts[3]: null;
						break;

				case 'click':
						var o = dw_scrollObj.getClickParts(cls);
						fn = o.fn; x = o.x; y = o.y; dur = o.dur;
						break;
		}
		if ( x !== '' && y !== '' ) {
				if (x == 'end') { x = wndo.maxX; }
				if (y == 'end') { y = wndo.maxY; }
				if (x === 'null' || x === null) { x = wndo.x; }
				if (y === 'null' || y === null) { y = wndo.y; }

				x = parseInt(x); y = parseInt(y);
				dur = !isNaN( parseInt(dur) )? parseInt(dur): null;

				if (fn == 'scrollBy') {
						dw_Event.add( linkEl, 'click', function (e) {
										dw_scrollObj.col[wndoId].initScrollByVals(x, y, dur);
										if (e && e.preventDefault) e.preventDefault();
										return false;
								} );
				} else if (fn == 'scrollTo') {
						dw_Event.add( linkEl, 'click', function (e) {
										dw_scrollObj.col[wndoId].initScrollToVals(x, y, dur);
										if (e && e.preventDefault) e.preventDefault();
										return false;
								} );
				}
		}
}

// get info from className (e.g., click_down_by_100)
dw_scrollObj.getClickParts = function(cls) {
		var parts = cls.split('_');
		var re = /^(up|down|left|right)$/;
		var dir, fn = '', dur, ar, val, x = '', y = '';

		if ( parts.length >= 4 ) {
				ar = parts[1].match(re);
				dir = ar? ar[1]: null;

				re = /^(to|by)$/;
				ar = parts[2].match(re);
				if (ar) {
						fn = (ar[0] == 'to')? 'scrollTo': 'scrollBy';
				}

				val = parts[3]; // value on x or y axis
				re = /^([\d]+)$/;
				dur = ( parts[4] && re.test(parts[4]) )? parts[4]: null;

				switch (fn) {
						case 'scrollBy' :
								if ( !re.test( val ) ) {
										x = ''; y = ''; break;
								}
								switch (dir) { // 0 for unspecified axis
										case 'up' : x = 0; y = val; break;
										case 'down' : x = 0; y = -val; break;
										case 'left' : x = val; y = 0; break;
										case 'right' : x = -val; y = 0;
								 }
								break;
						case 'scrollTo' :
								re = /^(end|[\d]+)$/;
								if ( !re.test( val ) ) {
										x = ''; y = ''; break;
								}
								switch (dir) { // null for unspecified axis
										case 'up' : x = null; y = val; break;
										case 'down' : x = null; y = (val == 'end')? val: -val; break;
										case 'left' : x = val; y = null; break;
										case 'right' : x = (val == 'end')? val: -val; y = null;
								 }
								break;
				 }
		}
		return { fn: fn, x: x, y: y, dur: dur }
}

dw_scrollObj.getEv_FnType = function(str) {
		var re = /^(mouseover|mousedown|scrollBy|scrollTo|scrollToId|click)$/;
		if (re.test(str) ) {
				return str;
		}
		return '';
}

// return class name with underscores in it
dw_scrollObj.get_DelimitedClass = function(cls) {
		if ( cls.indexOf('_') == -1 ) {
				return '';
		}
		var whitespace = /\s+/;
		if ( !whitespace.test(cls) ) {
				return cls;
		} else {
				var classes = cls.split(whitespace);
				for(var i = 0; classes[i]; i++) {
						if ( classes[i].indexOf('_') != -1 ) {
								return classes[i];
						}
				}
		}
}

dw_scrollObj.handleControlVis = function(controlsId, wndoId, axis) {
		var wndo = dw_scrollObj.col[wndoId];
		var el = document.getElementById(controlsId);
		if ( ( axis == 'v' && wndo.maxY > 0 ) || ( axis == 'h' && wndo.maxX > 0 ) ) {
				el.style.visibility = 'visible';
		} else {
				el.style.visibility = 'hidden';
		}
}


/* ===============================================================================================
			Custom Functions for tool tips
=============================================================================================== */
function _buildDiv(sticky, msg, args)
{
	var divId;
	var divClass;
	var msgClass;
	var caption;
	var captionClass;
	var divWidth;
	var content;

	var idx;
	var key;
	var val;
	for (var i = 2; i < args.length; i++)
	{
		idx = args[i].indexOf("=");
		if (idx > 0 && idx < (args[i].length - 1))
		{
			key = args[i].substring(0, idx);
			val = args[i].substring(idx + 1, args[i].length);
			if (key.toLowerCase() == "id")
			{
				divId = val;
			}
			else if (key.toLowerCase() == "divclass")
			{
				divClass = val;
			}
			else if (key.toLowerCase() == "msgclass")
			{
				msgClass = val;
			}
			else if (key.toLowerCase() == "caption")
			{
				caption = val;
			}
			else if (key.toLowerCase() == "captionclass")
			{
				captionClass = val;
			}
			else if (key.toLowerCase() == "width" || key.toLowerCase() == "divwidth")
			{
				divWidth = val;
			}
		}
	}

	var div = Tooltip.getDiv(sticky, divId, true);


	if (!divClass)
		divClass = "toolTipDivDefault";

	if (!captionClass)
		captionClass = "toolTipCaptionDefault";

	if (!msgClass)
		msgClass = "toolTipMsgDefault";

	content = "<table cellpadding='0' cellspacing='0' border='0' class='" + divClass + "'";
	if (divWidth)
		content = content + " style='width:" + divWidth + ";'";
	content = content + ">";


	if (sticky)
	{
		content = content + "<tr><td style='padding:0px;'><table cellpadding='0' cellspacing='0' border='0' width='100%'><tr>";
		if (caption)
		{
			content = content + "<td align='left' valign='middle' class='" + captionClass + "'>" + caption + "</td>";
		}
		content = content + "<td align='right' valign='middle' class='" + captionClass + "'><img src='" + document._amcwgtRootURL_ + "/resources/common/images/icn_close.gif' border=0 onclick='unstickTip(\"" + div.id + "\");'></td></tr></table></td></tr>";
	}
	else if (caption)
	{
		content = content + "<tr><td align='left' valign='middle' class='" + captionClass + "'>" + caption + "</td></tr>";
	}

	content = content + "<tr><td align='left' class='" + msgClass + "'";
	if (sticky && caption)
		content = content + " colspan='2'";
	content = content + ">" + msg + "</td></tr></table>";

	if (typeof div.innerHTML != "undefined" )
	{
		div.innerHTML = "";
		div.innerHTML = content;
	}

	return div;
}

function doTooltip(e, msg)
{
	if (!Tooltip.ready ) return;
	Tooltip.showDelay = 100;
	Tooltip.hideDelay = 200;
	Tooltip.show(e, _buildDiv(false, msg, arguments));
}

function stickTooltip(e, msg)
{
	if (!Tooltip.ready ) return;
	Tooltip.showDelay = 0;
	Tooltip.hideDelay = 0;
	Tooltip.stick(e, _buildDiv(true, msg, arguments));
}

function hideTip(divId)
{
	if (!Tooltip.ready) return;
	Tooltip.hide(Tooltip.getDiv(false, divId, false));
}

function unstickTip(divId)
{
	if (!Tooltip.ready ) return;
	Tooltip.unstick(Tooltip.getDiv(true, divId, false));
	grayOut(false);
}

var _msgDivGlider_;

function showWaitMsg(msg)
{
	var msgDiv = document.getElementById("_waitMsgDiv_");
	if (!msgDiv)
	{
		var msgDiv = document.createElement("div");
		msgDiv.id = "_waitMsgDiv_";
		msgDiv.style.display = "none";
		msgDiv.style.position = "absolute";
		msgDiv.style.zIndex = "500";
		msgDiv.style.width = "500px";
		msgDiv.style.border = "3px solid #AA0000";
		msgDiv.style.background = "#FF3333";
		msgDiv.style.textAlign = "center";

		var br = document.createElement("br");
		msgDiv.appendChild(br);
		br = document.createElement("br");
		msgDiv.appendChild(br);

		var span = document.createElement("span");
		span.id = "_waitMsgSpan_";
		span.style.color = "#FFFFFF";
		span.style.fontWeight = "bold";
		span.style.fontSize = "20px";
		span.style.fontFamily = "sans-serif";
		msgDiv.appendChild(span);

		br = document.createElement("br");
		msgDiv.appendChild(br);
		br = document.createElement("br");
		msgDiv.appendChild(br);
		br = document.createElement("br");
		msgDiv.appendChild(br);

		document.body.appendChild(msgDiv);
	}

	var msgSpan = document.getElementById("_waitMsgSpan_");
	msgSpan.innerHTML = msg;

	var needsShim = false;
	if (!_msgDivGlider_)
	{
		var viewPortWidth;
		if (document.body.clientWidth) viewPortWidth = document.body.clientWidth;
		else if (window.innerWidth) viewPortWidth = window.innerWidth;
		else viewPortWidth = 5;
		var divLeft = (viewPortWidth / 2) - (parseInt(document.getElementById("_waitMsgDiv_").style.width) / 2);
		divLeft = parseInt("" + divLeft);
		var divTop = 150;
		// args: id, left, top, w, h, duration of glide to location onscroll, acceleration factor
		// acceleration factor should be -1 to 1. -1 is full deceleration
		_msgDivGlider_ = new Glider("_waitMsgDiv_", divLeft, divTop, null, null, 300, -1);
		needsShim = true;
	}

	_msgDivGlider_.show();
	if (needsShim)
	{
		dw_SelectsShim.init( _msgDivGlider_.id );
		_msgDivGlider_.onGlide = dw_SelectsShim.position;
		_msgDivGlider_.setShimVisibility = dw_SelectsShim.setVisibility;
		_msgDivGlider_.syncShimSize = dw_SelectsShim.syncShimSize;
	}
	else
	{
		_msgDivGlider_.setShimVisibility();
	}
}

function hideWaitMsg()
{
	if (_msgDivGlider_)
	{
		_msgDivGlider_.hide();
		_msgDivGlider_.setShimVisibility();
	}
}

function grayOut(vis, options)
{
	// this function is stubbed out because grayOut is now handled
	// automatically by the ExtJS window that is used for popup panels
	// this can go away when all references to it are removed.
}