var clipTop= new Array(); 		
var clipLeft=0; 	
var clipWidth=428;    
var clipBottom=new Array();   
var topper= new Array();       
var lyrheight = 0;
var time = new Array();
var amount
var theTime
var DHTML;
var enterVer=new Array(); 
var enter= new Array();
var origY=new Array();
var x = new Array();
var maxY = new Array();
var numberOfResults=0;

function init5(numberOfResults)
{
	DHTML = (document.getElementById || document.all || document.layers);
	if (!DHTML) return;	
	for(i=0;i<numberOfResults;i++) {
    topper[i]=30;
    clipTop[i]=0;
    clipBottom[i]=70;
    enterVer[i]=true;
    enter[i]="";
    origY[i]=0;
    var elem = "scrollingText"+i;
    x[i] = new getObj1(elem);	
	}	
	if (document.layers)	{
		lyrheight1 = x.style.clip.bottom;
		lyrheight1 += 20;
		x.style.clip.top = clipTop1;
		x.style.clip.left = clipLeft1;
		x.style.clip.right = clipWidth1;
		x.style.clip.bottom = clipBottom1;
	} else if (document.getElementById || document.all)	{
		//lyrheight = x[0].obj.offsetHeight;
    for(i=0; i<numberOfResults;i++){
      x[i].style.clip = 'rect('+clipTop[i]+'px,'+clipWidth+'px,'+clipBottom[i]+'px,'+clipLeft+'px)';		
		}
	}
}

function scrollayer(layername,amt,tim,i,upDown)
{
	
	
	if (!DHTML) return;
	
	thelayer = new getObj1(layername);
	
	if (!thelayer) return;

	if(maxY[i]<70) return;
	
	amount = amt;
	theTime = tim;
	
	enter[i]=upDown;
	
	realscroll(i);
}


function realscroll(i)
{
	
	if(!enterVer[i]) {	
		stopScroll(i);	 
		reset_Variables(i);
		return;	 	
	}	
	
	if(maxY[i] > origY[i] ) {
	 if (enter[i]!='D') {
     if(topper[i] < 30 - maxY[i] + 70) {      
       return;	
	 		}					
			clipTop[i] += amount;
			clipBottom[i] += amount;
			topper[i] -= amount;	
			origY[i]=clipTop[i];
			enter[i] = 'U';				 
    
	  } else if(topper[i]!=30){
        clipTop[i] -= amount;
				clipBottom[i] -= amount;
				topper[i] += amount;					
				origY[i]=clipTop[i];
				enter[i] = 'D';				
    }		 
	}	
	else if(maxY[i]  < origY[i]) {
    
    if (enter[i]!='U' )  {	
				clipTop[i] -= amount;
				clipBottom[i] -= amount;
				topper[i] += amount;					
				origY[i]=clipTop[i];
				enter[i] = 'D';
    } else {	        
        clipTop[i] += amount;
				clipBottom[i] += amount;
				topper[i] -= amount;	
				origY[i]=clipTop[i];
				enter[i] = 'U';	
    }
	}
	else {		 	 
			 enterVer[i]=false;
	}
	
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop[i]+'px,'+clipWidth+'px,'+clipBottom[i]+'px,'+clipLeft+'px)';
		
		thelayer.style.clip = clipstring;
		
		thelayer.style.top = topper[i] + 'px';
		
	}
	else if (document.layers)
	{
	  thelayer.style.clip.top = clipTop[i];
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.clip.left = clipLeft1
		thelayer.style.clip.right = clipWidth;
		
	}		
	time[i] = setTimeout('realscroll('+i+')',theTime);
}

function getObj1(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
   
    this.style = document.getElementById(name).style;
    
  }
  else if (document.all)
  {
    this.obj = document.all[name];
    this.style = document.all[name].style;
  }
}

function reset_Variables(i){

	

	enterVer[i]=true; 
	clipWidth= 428; 
	clipBottom[i] = clipTop[i] + 70; 

}

function stopScroll(i) {
	
	if (time[i]) clearTimeout(time[i]);

}