// JavaScript Document

function initScrollLayers() {
	  // arguments: id of layer containing scrolling layers (clipped layer), id of layer tscroll,
	  // if horizontal scrolling, id of element containing scrolling content (table?)

	scroll_resize();

	var wndo1 = new dw_scrollObj('wn1', 'lyr1', null);



	  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
	  // (x/y offsets of dragBar in track)
	  wndo1.setUpScrollbar("dragBar1", "track1", "v", 1, 1);


	  // Scrollbars initially hidden in this example
	  dw_showLayers("scrollbar1", "scrollbar2", "scrollbar3");
	}

function dw_showLayers() {
	  if ( document.getElementById ) {
	    var lyr, i;
	    for (i=0; arguments[i]; i++) {
	      lyr = document.getElementById( arguments[i] );
	      if (lyr) {lyr.style.visibility = 'visible'};
	    }
	  }
	}

function scroll_resize() {
	var allheight = document.getElementById('bod').offsetHeight;
//alert (allheight);

	var header_height = 107;
	var linkzone_height = 120;
	var scroll_content_height = document.getElementById('lyr1').offsetHeight;
//alert (scroll_content_height);

	if(document.getElementById('internal_page_header') || document.getElementById('internal_page_headers')){
		var scroll_height = allheight - header_height - linkzone_height - 110;
	}
	else {
		var scroll_height = allheight - header_height - linkzone_height - 30;
	}
	if(document.getElementById('announce_links')){
		scroll_height = scroll_height - 100;
	}
//alert (scroll_height);

	if(scroll_content_height <= scroll_height ){
		document.getElementById('scrollbar1').style.display = 'none';

		document.getElementById('holder1').style.height = scroll_content_height +'px';

		document.getElementById('wn1').style.height = scroll_content_height + 'px';
		document.getElementById('wn1').style.clip = 'rect(0, 580px, ' + scroll_content_height + 'px, 0)';
	}
	else {
		document.getElementById('holder1').style.height = scroll_height + 'px';

		document.getElementById('wn1').style.height = scroll_height + 'px';
		document.getElementById('wn1').style.clip = 'rect(0, 580px, ' + scroll_height + 'px, 0)';

		document.getElementById('scrollbar1').style.height = scroll_height + 'px';

		document.getElementById('track1').style.height = scroll_height - 40 + 'px';
	}
}