var scroll_direction;
var text_height;
var heightofLayer=310

var top_clip = 0;
var layer_top
var bottom_clip = heightofLayer;
if (!layer_top) {
layer_top = 99
}
var layer_upperlimit = layer_top;

var maxHeightofText;

var layer_to_scroll;
//This function resets the clip values so that when the option is rolled over, 
//the text always starts at the top.  
function init_scroller(layer_to_scroll) {
   top_clip = 0;
   bottom_clip = heightofLayer;
   layer_upperlimit =layer_top ;

   if (is.ie4){
		document.all[layer_to_scroll].style.clip = 'rect(' + top_clip + ',500,' + bottom_clip + ',0)';
		document.all[layer_to_scroll].style.top = layer_upperlimit + 'px';
		}
	if (is.ns4){
		document.layers[layer_to_scroll].clip.top = top_clip;
		document.layers[layer_to_scroll].clip.right = 500;
		document.layers[layer_to_scroll].clip.bottom = bottom_clip;
		document.layers[layer_to_scroll].clip.left = 0;
		document.layers[layer_to_scroll].top = layer_upperlimit;
		}

}

function scroller(dir, speeder, layerName){
scrollspeed=speeder;
if (!scrollspeed) {
	scrollspeed =1;
	}
if (dir == 'up'){
	scroll_direction = 'up';
	up_scroll = setInterval('scroll_up()', 10);
	}
if (dir == 'down'){
	scroll_direction = 'down';
	down_scroll = setInterval('scroll_down()', 10);
	}
if (!layerName){
	layer_to_scroll = 'content';
	}
	else{
	layer_to_scroll = layerName;
	}
}

function stop_scroller(){
if (scroll_direction == 'up'){
	clearInterval(up_scroll);
	}
if (scroll_direction == 'down'){
	clearInterval(down_scroll);
	}
	scrollspeed=1;
}

function scroll_up(){
if (layer_upperlimit < layer_top){
	top_clip = top_clip-scrollspeed;
	bottom_clip = bottom_clip-scrollspeed;
	layer_upperlimit = layer_upperlimit +scrollspeed;
		if (is.ie4){
		document.all[layer_to_scroll].style.clip = 'rect(' + top_clip + ',500,' + bottom_clip + ',0)';
		document.all[layer_to_scroll].style.top = layer_upperlimit;
		}
	if (is.ns4){
		document.layers[layer_to_scroll].clip.top = top_clip;
		document.layers[layer_to_scroll].clip.right = 500;
		document.layers[layer_to_scroll].clip.bottom = bottom_clip;
		document.layers[layer_to_scroll].clip.left = 0;
		document.layers[layer_to_scroll].top = layer_upperlimit;
		}
	}
	else{
	stop_scroller();
	}
}


function scroll_down(){
if (bottom_clip <= eval(layer_to_scroll + '_height')){
	top_clip = top_clip + scrollspeed;
	bottom_clip= bottom_clip + scrollspeed;
	layer_upperlimit= layer_upperlimit - scrollspeed;
   if (is.ie4){
		document.all[layer_to_scroll].style.clip = 'rect(' + top_clip + ',500,' + bottom_clip + ',0)';
		document.all[layer_to_scroll].style.top = layer_upperlimit + 'px';
		}
	if (is.ns4){
		document.layers[layer_to_scroll].clip.top = top_clip;
		document.layers[layer_to_scroll].clip.right = 500;
		document.layers[layer_to_scroll].clip.bottom = bottom_clip;
		document.layers[layer_to_scroll].clip.left = 0;
		document.layers[layer_to_scroll].top = layer_upperlimit;
		}
	}
	else{
	stop_scroller();
	}
}
maxHeightofText=heightofLayer
function clipper(which_section) {
    scrollsection = 'copylayerscrolls';
	scrolls = eval(doc + '.' + scrollsection + sty);
	clipping_section = eval(doc + '.' + which_section);
	if (is.ie4){
		text_height = clipping_section.offsetHeight
		if (text_height > maxHeightofText){
			clipping_section.style.clip = 'rect(0,500,' + heightofLayer + ',0)';
			scrolls.visibility='visible';
			}
			
		}
		if (is.ns4){
			text_height = eval(doc + '.' + which_section +'.clip.height');
			if (text_height > maxHeightofText){
				scrolls.visibility='visible';
				clipping_section.clip.top = 0;
				clipping_section.clip.right = 500;
				clipping_section.clip.bottom = heightofLayer;
				clipping_section.clip.left = 0;
			}
  		}
		return text_height;
}
