//
// DHTML API for Netscape/IE4+
// by Kimara Sajn
//
// (c) 2000 General Rubric, Inc
//
//

	function browserID() {
		this.name = navigator.appName;
		this.ver = parseInt(navigator.appVersion);
		this.fullver = parseFloat(navigator.appVersion);
		this.code = navigator.appCodeName;
		this.agent = navigator.userAgent;
		this.isIE3 = ((this.name.indexOf("Microsoft Internet Explorer") != -1) && (this.ver >= 3));
		this.isIE4 = ((this.name.indexOf("Microsoft Internet Explorer") != -1) && (this.ver >= 4));
		this.isIE = (this.isIE3 || this.isIE4);
		this.isNS3 = ((this.name.indexOf("Netscape") != -1) && (this.ver >= 3));
		this.isNS4 = ((this.name.indexOf("Netscape") != -1) && (this.ver >= 3 && this.ver < 5));
		this.isNS6 = ((this.name.indexOf("Netscape") != -1) && (this.ver > 4));
		this.isNS = (this.isNS3 || this.isNS4 || this.isNS6);
		this.isDOM2 = (document.getElementById != null);
		this.isPC = (navigator.appVersion.indexOf("Win") != -1);
		this.isMac = (navigator.appVersion.indexOf("Mac") != -1);
		this.isUnix = (navigator.appVersion.indexOf("X11") != -1);
		this.isUnk = (!this.isPC && !this.isMac && !this.isUnix);
		this.usePlugins = 0;
		return this;
	}

	function isNav() {
		// get browser info
		var browser = new browserID();
		return browser.isNS4;
	}

	function isNav6() {
		// get browser info
		var browser = new browserID();
		return browser.isNS6;
	}

	// returns a layer object reference (nested if n = "layer1,layer2,layer3 ... layerx")
	
	function getLayer(n) {
		var arg = n.split(",");
		if (arg.length == 1) {
			if (isNav()) {
				return document.layers[n];
			}
			else if (isNav6()) {
				return eval("document.getElementById('"+n+"').style");
			}
			else {
				return eval("document.all."+n+".style");
			}
		}
		else {
			if (isNav()) {
				var ref = "";
				for (var i=0; i<arg.length-1; i++) {
					ref = ref + "document.layers['"+arg[i]+"'].";
				}
				ref = ref + "document.layers['"+arg[arg.length-1]+"']";

				return eval(ref);
			}
			else if (isNav6()) {
				return eval("document.getElementById('"+arg[arg.length-1]+"').style");
			}
			else {
				return eval("document.all."+arg[arg.length-1]+".style");
			}
		}
	}

	// get nested layer document reference

	function getNestedDoc(n) {
		var arg = n.split(",");
		if (arg.length == 1) {
			if (isNav()) {
				return document.layers[n].document;
			}
			else {
				return eval("document");
			}
		}
		else {
			if (isNav()) {
				var ref = "";
				for (var i=0; i<arg.length-1; i++) {
					ref = ref + "document.layers['"+arg[i]+"'].";
				}
				ref = ref + "document.layers['"+arg[arg.length-1]+"'].document";

				return eval(ref);
			}
			else {
				return eval("document");
			}
		}
	}

	// set visibility property for layer object n (see above for nesting syntax)
	
	function visible(n,state) {
		var l = getLayer(n);
		if (state) {
			mode = "visible";
		}
		else {
			mode = "hidden";
		}
		l.visibility = mode;
	}

	function collapse(n,state) {
		var l = getLayer(n);
		if (isNav()) {
			visible(n,!state);
		}
		else {
			if (state) {
				mode = "none";
			}
			else {
				mode = "block";
			}
			l.display = mode;
		}
	}

	// get LEFT property for layer object n
	
	function getLeft(n) {
		var l = getLayer(n);

		if (isNav()) {
			return l.left;
		}
		else if (isNav6()) {
			return parseInt(l.left);
		}
		else {
			return l.pixelLeft;
		}
	}
	
	// get TOP property for layer object n

	function getTop(n) {
		var l = getLayer(n);

		if (isNav()) {
			return l.top;
		}
		else if (isNav6()) {
			return parseInt(l.top);
		}
		else {
			return l.pixelTop;
		}
	}

	// set LEFT property for layer object n
	
	function setLeft(n,x) {
		var l = getLayer(n);

		if (isNav()) {
			l.left = x;
		}
		else if (isNav6()) {
			l.left = x + "px";
		}
		else {
			l.pixelLeft = x + "px";
		}
	}
	
	// get TOP property for layer object n

	function setTop(n,y) {
		var l = getLayer(n);

		if (isNav()) {
			l.top = y;
		}
		else if (isNav6()) {
			l.top = y + "px";
		}
		else {
			l.pixelTop = y + "px";
		}
	}

	// MOVE layer object n to absolute x & y coordinates
	
	function move(n,x,y) {
		var l = getLayer(n);

		if (isNav()) {
			l.moveTo(x,y);
		}
		else if (isNav6()) {
			l.left = x + "px";
			l.top = y + "px";
		}
		else {
			l.pixelLeft = x;
			l.pixelTop = y;
		}
	}

	// set ZIndex property for layer object n to Z
	
	function setZOrder(n,z) {
		var l = getLayer(n);

		if (z < 0) {
			z = 0;
		}

		l.zIndex = z;
	}

	// move layer object n to frontmost layer level by setting ZIndex to 100
	
	function moveToFront(n) {
		var l = getLayer(n);

		l.zIndex = 100;
	}

	// move layer object n to backmost layer level by setting ZIndex to 0
	
	function moveToBack(n) {
		var l = getLayer(n);

		l.zIndex = 0;
	}

	// utility functon to convert IE/NS6 DOM3 clip return data
	// into something ACTUALLY USEFUL (geez :)

	function getClipValue(clipRectString,n) {
		var a = clipRectString.split("(");
		var b = a[1].split(")");
		var c = b[0]; // this is the rect w/o "rect(" and ")"

		var values = c.split(" ");

		// returns Nth parametre value
		return parseInt(values[n]);
	}

	// return clip left & top of layer object n
	
	function getClipLeft(n) {
		var l = getLayer(n);
		
		if (isNav()) {
			return l.clip.left;
		}
		else {
			return getClipValue(l.clip,3);
		}
	}

	function getClipTop(n) {
		var l = getLayer(n);
		
		if (isNav()) {
			return l.clip.top;
		}
		else {
			return getClipValue(l.clip,0);
		}
	}

	function getClipRight(n) {
		var l = getLayer(n);
		
		if (isNav()) {
			return l.clip.right;
		}
		else {
			return getClipValue(l.clip,1);
		}
	}

	function getClipBottom(n) {
		var l = getLayer(n);
		
		if (isNav()) {
			return l.clip.bottom;
		}
		else {
			return getClipValue(l.clip,2);
		}
	}

	// return width & height of layer object n
	
	function getWidth(n) {
		var l = getLayer(n);
		
		if (isNav()) {
			return l.clip.width;
		}
		else if (isNav6()) {
			return document.getElementById(n).offsetWidth;
		}
		else {
			return document.all[n].clientWidth;
		}
	}

	function getHeight(n) {
		var l = getLayer(n);
		
		if (isNav()) {
			return l.clip.height;
		}
		else if (isNav6()) {
			return document.getElementById(n).offsetHeight;
		}
		else {
			return document.all[n].clientHeight;
		}
	}

	// clips a region of a layer
	function setClip(layer,left,top,right,bottom) {
		var l = getLayer(layer);

		if (isNav()) {
			l.clip.top = top;
			l.clip.right = right;
			l.clip.bottom = bottom;
			l.clip.left = left;
		}
		else {
			l.clip = "rect("+top+"px "+right+"px "+bottom+"px "+left+"px)";
		}
	}

	// adjust viewport to initial position -- only needed if viewport initial isn't (0,0)
	// default position is (0,0) upper left of layer content

	function positionClippedLayer(layer,left,top) {
		var l = getLayer(layer);

		if (l) {
			move(layer,(left-getClipLeft(layer)),(top-getClipTop(layer)));
		}
	}

	// return width & height of browser window content area
	
	function getWindowContentWidth(w) {
		if (isNav()) {
			return w.innerWidth;
		}
		else if (isNav6()) {
			return w.innerWidth;
		}
		else {
			return w.document.body.clientWidth;
		}
	}

	function getWindowContentHeight(w) {
		if (isNav()) {
			return w.innerHeight;
		}
		else if (isNav6()) {
			return w.innerHeight;
		}
		else {
			return w.document.body.clientHeight;
		}
	}

	// get document scroll position

	function getScrollX(w) {
		if (isNav()) {
			return w.pageXOffset;
		}
		else if (isNav6()) {
			return w.pageXOffset;
		}
		else {
			return w.document.body.scrollLeft;
		}
	}

	function getScrollY(w) {
		if (isNav()) {
			return w.pageYOffset;
		}
		else if (isNav6()) {
			return w.pageYOffset;
		}
		else {
			return w.document.body.scrollTop;
		}
	}

	// center a layer in the browser window

	function centerLayer(layer,width,height) {
		var centrex = Math.max( ((getWindowContentWidth(self) - width)/2), 0 );
		var centrey = Math.max( ((getWindowContentHeight(self) - height)/2), 0);
		move(layer,centrex,centrey);
	}

	// center window w on screen
	
	function screenCenter(w,width,height) {
		var l,t,r,b;

			r = width;
			b = height;
		
			l = ((window.screen.availWidth/2) - (r/2));
			t = ((window.screen.availHeight/2) - (b/2));

			w.moveTo(l,t);
	}

	function writeToLayer(n,text) {
		var l = getLayer(n);

		if (isNav()) {
			l.document.open();
			l.document.write(text);
			l.document.close();
		}
		else if (isNav6()) {
			document.getElementById(n).innerHTML = text;
		}
		else {
			document.all[n].innerHTML = text;
		}
	}

	// START VIEWPORT OBJECT DEFINITIONS

	// creates a Viewport object (a clipped and/or scrollable layer)
	// Viewports can use the scroll functions which follow
 
	function Viewport(name,layer,left,top,width,height) {
		// set ID for reference

			this.id = layer;

		// set viewport variable name for reference

			this.viewport = name;

		// store the origin left, top, width & height properties
		// for later reference

			this.oleft = getLeft(layer);
			this.otop = getTop(layer);
			this.owidth = getWidth(layer);
			this.oheight = getHeight(layer);

		// store the viewport clipping arguments for later reference

			if ((left != null) && (top != null) && (width != null) && (height != null)) {
				this.vleft = left;
				this.vtop = top;
				this.vright = left+width;
				this.vbottom = top+height;

				this.width = width;
				this.height = height;
			}
			else {
				this.vleft = 0;
				this.vtop = 0;

				var bufferx = 50;
				var buffery = 40;

				this.width = Math.max(getWindowContentWidth(self)-bufferx,0);
				this.height = Math.max(getWindowContentHeight(self)-buffery,0);

				this.vright = this.width;
				this.vbottom = this.height;
			}

		// scrollbar properties

			this.scrollh = "";
			this.scrollv = "";

		// scroll position status

			this.scrollDown = 0;
			this.scrollRight = 0;

		// scroll timer variables

			this.scrollTimer = null;
			this.scrollState = false;

	// METHODS:
	//	Open() -- initialise and display viewport
	//	Write(text) -- write content into the viewport
	//	AssignScrollbar(scrollbar_layer,direction,margin) -- assign an auto-scrollbar layer
	//	defaultTextScrollbar(direction,margin,scroll1,scroll2) -- returns a text style scrollbar table
	//	defaultImageScrollbar(direction,margin,scroll1,scroll2) -- returns an image type scrollbar table
	//	defaultFilledImageScrollbar(direction,margin,scroll1,scroll2,fillImage,width,height) -- returns a filled image type scrollbar table
	//	WriteScrollbar(direction,margin) -- writes defaultScrollbar to it's layers
	//	Scroll(direction,speed) -- scroll content in direction
	//	StartScroll(direction,speed) -- set scrollState flag to true (for scrolling)
	//	RepeatScroll(direction,speed) -- timer scroll values based on scrollState
	//	StopScroll() -- set scrollState flag to false (for NO scrolling)

			this.open = initViewport;
			this.write = writeToViewport;
			this.hide = hideViewport;
			this.show = showViewport;
			this.writeScrollLink = writeScrollLink;
			this.assignScrollbar = autoScrollbar;
			this.defaultTextScrollbar = defaultTextScrollbar;
			this.defaultImageScrollbar = defaultImageScrollbar;
			this.defaultFilledImageScrollbar = defaultFilledImageScrollbar;
			this.writeScrollbar = writeDefaultScrollbar;
			this.scroll = scrollViewport;
			this.startScroll = scrollStart;
			this.repeatScroll = scrollActive;
			this.stopScroll = scrollStop;
	}

	// initialise a viewport (adjusting position as necessary)

	function initViewport() {

		// activate the clipping

			setClip(this.id,this.vleft,this.vtop,this.vright,this.vbottom);

		// position the viewport relative to it's clipped area (to original position)

			positionClippedLayer(this.id,this.oleft,this.otop);
	}

	// dynamically update content in a viewport

	function writeToViewport(content) {
		writeToLayer(this.id,content);
	}

	// SHOW/HIDE/COLLAPSE viewport

	function hideViewport() {
		visible(this.id,false);
		if (this.scrollv) {
			visible(this.scrollv,false);
		}
		if (this.scrollh) {
			visible(this.scrollh,false);
		}
	}

	function showViewport() {
		visible(this.id,true);
		if (this.scrollv) {
			visible(this.scrollv,true);
		}
		if (this.scrollh) {
			visible(this.scrollh,true);
		}
	}

	// viewport scrolling functions
	// scrollViewport (manual scroll)

	function scrollViewport(direction,speed) {
		var l = getLayer(this.id);
		if (l) {

			var left = this.oleft;
			var top = this.otop;
			var right = this.owidth;
			var bottom = this.oheight;

			var vleft = this.vleft;
			var vtop = this.vtop;
			var vright = this.vright;
			var vbottom = this.vbottom;

			if (direction == "down") {
				if (getClipBottom(this.id) < bottom) {
					setClip(this.id,getClipLeft(this.id),(getClipTop(this.id) + speed),getClipRight(this.id),(getClipBottom(this.id) + speed))
					move(this.id,(left - getClipLeft(this.id)),(top - getClipTop(this.id)));
				}
			}
			else if (direction == "up") {
				if (getClipTop(this.id) > vtop) {
					setClip(this.id,getClipLeft(this.id),(getClipTop(this.id) - speed),getClipRight(this.id),(getClipBottom(this.id) - speed))
					move(this.id,(left - getClipLeft(this.id)),(top - getClipTop(this.id)));
				}
			}
			else if (direction == "right") {
				if (getClipRight(this.id) < right) {
					setClip(this.id,(getClipLeft(this.id) + speed),getClipTop(this.id),(getClipRight(this.id) + speed),getClipBottom(this.id))
					move(this.id,(left - getClipLeft(this.id)),(top - getClipTop(this.id)));
				}
			}
			else if (direction == "left") {
				if (getClipLeft(this.id) > vleft) {
					setClip(this.id,(getClipLeft(this.id) - speed),getClipTop(this.id),(getClipRight(this.id) - speed),getClipBottom(this.id))
					move(this.id,(left - getClipLeft(this.id)),(top - getClipTop(this.id)));
				}
			}
		}
	}


	// assign & control the appearance of scrollbars for any viewport

	function autoScrollbar(scrollbar_layer,direction,floatMargin) {
		var l = getLayer(scrollbar_layer);
		if (l) {
			// capture scrollbar layer specs
				if (direction == "horizontal") {
					this.scrollh = scrollbar_layer;
				}
				else if (direction == "vertical") {
					this.scrollv = scrollbar_layer;
				}

			// automatically move and display or hide scrollbar layers (w/ margins)
			if (direction == "vertical") {
				if (this.oheight > this.vbottom) {
					if (floatMargin) {
						var x = this.oleft+this.vright;
						move(scrollbar_layer,x+floatMargin,this.otop);
					}
					visible(scrollbar_layer,true);
				}
				else {
					visible(scrollbar_layer,false);
				}
			}
			else if (direction == "horizontal") {
				if (this.owidth > this.vright) {
					if (floatMargin) {
						var y = this.otop+this.vbottom;
						move(scrollbar_layer,this.oleft,y+floatMargin);
					}
					visible(scrollbar_layer,true);
				}
				else {
					visible(scrollbar_layer,false);
				}
			}
		}
	}

	// scrollbar event generation (timer scroll on event)

	function scrollStart(direction,speed) {
		this.scrollState = true;
		this.scrollTimer = setInterval(this.viewport+".repeatScroll('"+direction+"',"+speed+")",1);
	}

	function scrollActive(direction,speed) {
		// does a scroll move ONLY IF scrollState is TRUE
		if (this.scrollState) {
			var l = getLayer(this.id);
			this.scrollDown = l.clip.top;
			this.scrollRight = l.clip.left;
			this.scroll(direction,speed);
		}
	}

	function scrollStop() {
		this.scrollState = false;
		clearInterval(this.scrollTimer);
	}

	// utility for outputting an action link for scrolling

	function writeScrollLink(direction,speed) {
		var browser = new browserID();
		if (browser.isMac) {
			var link = "<a style=\"text-decoration: none\" href=\"#\" onMouseDown=\"return false\" onMouseOver=\""+this.viewport+".startScroll('"+direction+"',"+(speed*3)+")\" onMouseOut=\""+this.viewport+".stopScroll()\">";
		}
		else {
			var link = "<a style=\"text-decoration: none\" href=\"#\" onClick=\""+this.viewport+".stopScroll(); return false\" onMouseDown=\""+this.viewport+".startScroll('"+direction+"',"+speed+"); return false\" onMouseOver=\""+this.viewport+".stopScroll()\" onMouseOut=\""+this.viewport+".stopScroll()\" onMouseUp=\""+this.viewport+".stopScroll()\">";
		}
		return link;
	}

	// utility function for generating a default scrollbar

	function defaultTextScrollbar(direction,speed,scroll1,scroll2) {
		var v = eval(this.viewport);
		if (v) {
			var l = getLayer(v.id);
			if (l) {
				var scroll_img_l = "";
				var scroll_img_r = "";
				var scroll_img_u = "";
				var scroll_img_d = "";

				var s = "";
				if (direction == "horizontal") {
					if (arguments.length == 4) {
						scroll_img_l = scroll1;
						scroll_img_r = scroll2;
					}
					else {
						scroll_img_l = "L";
						scroll_img_r = "R";
					}

					// dynamic handling of the tabling of the horizontal scroll links
					s = s + "<table width=\""+v.vright+"\" cellpadding=\"0\" cellspacing=\"0\">";
					s = s + "<tr>";
					s = s + "<td width=\""+(v.vright/2)+"\" align=\"left\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('left',speed)+scroll_img_l+"</a></font></td>";
					s = s + "<td width=\""+(v.vright/2)+"\" align=\"right\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('right',speed)+scroll_img_r+"</a></font></td>";
					s = s + "</tr>";
					s = s + "</table>";
				}
				else if (direction == "vertical") {
					if (arguments.length == 4) {
						scroll_img_u = scroll1;
						scroll_img_d = scroll2;
					}
					else {
						scroll_img_u = "U";
						scroll_img_d = "D";
					}

					// dynamic handling of the tabling of the vertical scroll links
					s = s + "<table height=\""+v.vbottom+"\" cellpadding=\"0\" cellspacing=\"0\">";
					s = s + "<tr>";
					s = s + "<td height=\""+(v.vbottom/2)+"\" valign=\"top\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('up',speed)+scroll_img_u+"</a></font></td>";
					s = s + "</tr>";
					s = s + "<tr>";
					s = s + "<td height=\""+(v.vbottom/2)+"\" valign=\"bottom\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('down',speed)+scroll_img_d+"</a></font></td>";
					s = s + "</tr>";
					s = s + "</table>";
				}

				return s;
			}
		}
	}

	function defaultImageScrollbar(direction,speed,scroll1,scroll2) {
		var v = eval(this.viewport);
		if (v) {
			var l = getLayer(v.id);
			if (l) {
				var scroll_img_l = "";
				var scroll_img_r = "";
				var scroll_img_u = "";
				var scroll_img_d = "";

				var s = "";
				if (direction == "horizontal") {
					if (arguments.length == 4) {
						scroll_img_l = "<img src=\""+scroll1+"\" border=\"0\">";
						scroll_img_r = "<img src=\""+scroll2+"\" border=\"0\">";
					}
					else {
						scroll_img_l = "L";
						scroll_img_r = "R";
					}

					// dynamic handling of the tabling of the horizontal scroll links
					s = s + "<table width=\""+v.vright+"\" cellpadding=\"0\" cellspacing=\"0\">";
					s = s + "<tr>";
					s = s + "<td width=\""+(v.vright/2)+"\" align=\"left\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('left',speed)+scroll_img_l+"</a></font></td>";
					s = s + "<td width=\""+(v.vright/2)+"\" align=\"right\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('right',speed)+scroll_img_r+"</a></font></td>";
					s = s + "</tr>";
					s = s + "</table>";
				}
				else if (direction == "vertical") {
					if (arguments.length == 4) {
						scroll_img_u = "<img src=\""+scroll1+"\" border=\"0\">";
						scroll_img_d = "<img src=\""+scroll2+"\" border=\"0\">";
					}
					else {
						scroll_img_u = "U";
						scroll_img_d = "D";
					}

					// dynamic handling of the tabling of the vertical scroll links
					s = s + "<table height=\""+v.vbottom+"\" cellpadding=\"0\" cellspacing=\"0\">";
					s = s + "<tr>";
					s = s + "<td height=\""+(v.vbottom/2)+"\" valign=\"top\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('up',speed)+scroll_img_u+"</a></font></td>";
					s = s + "</tr>";
					s = s + "<tr>";
					s = s + "<td height=\""+(v.vbottom/2)+"\" valign=\"bottom\"><font size=\"-2\" face=\"arial,helvetica\">"+this.writeScrollLink('down',speed)+scroll_img_d+"</a></font></td>";
					s = s + "</tr>";
					s = s + "</table>";
				}

				return s;
			}
		}
	}

	function defaultFilledImageScrollbar(direction,speed,scroll1,scroll2,fillImage,width,height) {
		var v = eval(this.viewport);
		if (v) {
			var l = getLayer(v.id);
			if (l) {
				var s = "";
				if (direction == "horizontal") {
					var lr_scroll = "";
					lr_scroll = lr_scroll + "<table border=\"0\" width=\""+v.vright+"\" height=\"17\" cellspacing=\"0\" cellpadding=\"0\">";
					lr_scroll = lr_scroll + "<tr>";
					lr_scroll = lr_scroll + "<td width=\""+width+"\" height=\"height\" align=\"right\">"+this.writeScrollLink('left',speed)+"<img src=\""+scroll1+"\" width=\""+width+"\" height=\""+height+"\" border=\"0\"></a></td>";
					lr_scroll = lr_scroll + "<td height=\""+height+"\" align=\"left\"><img src=\""+fillImage+"\" border=\"0\" width=\""+(v.vright-(width+height))+"\" height=\""+height+"\"></td>";
					lr_scroll = lr_scroll + "<td width=\""+width+"\" height=\""+height+"\" align=\"left\">"+this.writeScrollLink('right',speed)+"<img src=\""+scroll2+"\" width=\""+width+"\" height=\""+height+"\" border=\"0\"></a></td>";
					lr_scroll = lr_scroll + "</tr>";
					lr_scroll = lr_scroll + "</table>";

					s = lr_scroll;
				}
				else if (direction == "vertical") {
					var ud_scroll = "";
					ud_scroll = ud_scroll + "<table border=\"0\" width=\""+width+"\" height=\""+v.vbottom+"\" cellspacing=\"0\" cellpadding=\"0\">";
					ud_scroll = ud_scroll + "<tr>";
					ud_scroll = ud_scroll + "<td width=\""+width+"\" height=\""+height+"\" valign=\"bottom\">"+this.writeScrollLink('up',speed)+"<img src=\""+scroll1+"\" width=\""+width+"\" height=\""+height+"\" border=\"0\"></a></td>";
					ud_scroll = ud_scroll + "</tr>";
					ud_scroll = ud_scroll + "<tr>";
					ud_scroll = ud_scroll + "<td width=\""+width+"\" valign=\"top\"><img src=\""+fillImage+"\" border=\"0\" width=\""+width+"\" height=\""+(v.vbottom-(width+height))+"\"></td>";
					ud_scroll = ud_scroll + "</tr>";
					ud_scroll = ud_scroll + "<tr>";
					ud_scroll = ud_scroll + "<td width=\""+width+"\" height=\""+height+"\" valign=\"top\">"+this.writeScrollLink('down',speed)+"<img src=\""+scroll2+"\" width=\""+width+"\" height=\""+height+"\" border=\"0\"></a></td>";
					ud_scroll = ud_scroll + "</tr>";
					ud_scroll = ud_scroll + "</table>";

					s = ud_scroll;
				}

				return s;
			}
		}
	}


	// write out the default scrollbars

	function writeDefaultScrollbar(mode,direction,speed,scroll1,scroll2,fillImage,width,height) {
		// output the default scrollbar for a viewport

		if (mode == "text") {
			// TEXT mode

			if (direction == "horizontal") {
				if (this.scrollh != "") {
					if (arguments.length < 4) {
						writeToLayer(this.scrollh,this.defaultTextScrollbar(direction,speed));
					}
					else {
						writeToLayer(this.scrollh,this.defaultTextScrollbar(direction,speed,scroll1,scroll2));
					}
				}
			}
			else if (direction == "vertical") {
				if (this.scrollv != "") {
					if (arguments.length < 4) {
						writeToLayer(this.scrollv,this.defaultTextScrollbar(direction,speed));
					}
					else {
						writeToLayer(this.scrollv,this.defaultTextScrollbar(direction,speed,scroll1,scroll2));
					}
				}
			}
		}

		if (mode == "image") {
			// STANDARD IMAGE mode (filled or unfilled scrollbar based on arguments passed)
	
			if (direction == "horizontal") {
				if (this.scrollh != "") {
					if (arguments.length < 6) {
						writeToLayer(this.scrollh,this.defaultImageScrollbar(direction,speed,scroll1,scroll2));
					}
					else if (arguments.length == 8) {
						writeToLayer(this.scrollh,this.defaultFilledImageScrollbar(direction,speed,scroll1,scroll2,fillImage,width,height));
					}
				}
			}
			else if (direction == "vertical") {
				if (this.scrollv != "") {
					if (arguments.length < 6) {
						writeToLayer(this.scrollv,this.defaultImageScrollbar(direction,speed,scroll1,scroll2));
					}
					else if (arguments.length == 8) {
						writeToLayer(this.scrollv,this.defaultFilledImageScrollbar(direction,speed,scroll1,scroll2,fillImage,width,height));
					}
				}
			}
		}
	}

	// END OF VIEWPORT OBJECT DEFINITIONS


// END OF DHTML API
