/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-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!
*************************************************************************/

function initScrollLayers() {
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
  // if horizontal scrolling, id of element containing scrolling content (table?)
  var wndo = new dw_scrollObj('viewPort', 'vScrollContent', null);

  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
  // (x/y offsets of dragBar in track)
  wndo.setUpScrollbar("dragBar", "track", "v", 0, 0);
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


window.onload = function() {
	
	var viewPortHeight = 309; // height of the view port
	
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;

	// scrolling content reference 
 	g = MM_findObj("vScrollContent");
	
	// scrolling content height 
	if (document.all || document.getElementById) {
		h = parseInt(g.offsetHeight);
		if (!h) {
			h = parseInt(g.style.pixelHeight);
		}
 	} else if (document.layers) {
		h = parseInt(g.clip.height);
	}
	
	// scroll bar reference 
 	sBar = MM_findObj("scrollbar");
 	ssBar = (document.layers)?sBar:sBar.style;
	
	if (ssBar) {
		// if text don't fit into view port, show scrollbar ...
		if (h > viewPortHeight) {
			ssBar.visibility = "visible";
			initScrollLayers();	
		}
	}
}   