var NS6 = false;
var IE4 = (document.all)? true:false
var NS4 = (document.layers)? true:false
var NS6 = (document.getElementById)? true:false

var moveit = false;
var scrolldir = 0;
var interval = 50;

function rollOver(imgname,action){
	if	((NS4&&!NS6)&(imgname.indexOf("scrollb")==0)){
		document.layers.scrollbutton.document.images[imgname].src = "http://www.katesiber.com/images/" + imgname + "-" + action + ".gif"; }
	else { document.images[imgname].src = "http://www.katesiber.com/images/" + imgname + action + ".gif"; } 
}

function reDo() {
   if (innerWidth != origWidth || innerHeight != origHeight) 
     location.reload();
}

function prepare(xw){
	if (NS4&&!NS6) var height = document.layers.textframe.document.layers.textblock.document.height
	else if (IE4) var height = document.all.textblock.scrollHeight
	else if (NS6) var height = document.getElementById("textblock").offsetHeight

	if (height>290) {
		newclip = "rect(0," + xw + ",290,0)"
		if (NS4&&!NS6) {
			document.layers.textframe.clip.bottom = "290";		
			document.layers.scrollbutton.visibility = "visible";	
			document.layers.textframe.layers.textblock.width = xw
		 }
		else if (IE4) {
			document.all.textframe.style.clip = newclip;
			document.all.scrollbutton.style.visibility = "visible";
			document.all.textblock.style.width = xw + "px"
			}
		else if (NS6) {
			document.getElementById("textframe").style.clip = newclip;
			document.getElementById("scrollbutton").style.visibility = "visible";
			document.getElementById("textblock").style.width = xw + "px"
		}
		
	}
	
	scroller();
}

function scroller(){
	
	if (NS4&&!NS6) var height = document.layers.textframe.document.layers.textblock.document.height
	else if (IE4) var height = document.all.textblock.scrollHeight
	else if (NS6) var height = document.getElementById("textblock").offsetHeight

	height = (height*-1) + 290; 
	      if (moveit){
		   		if (NS6) {
		   			var thelayer = document.getElementById("textblock")
	                      y1 = parseInt(thelayer.style.top);
	                      y1 = y1 + scrolldir;
					if (y1>1){y1=0;}
					if (y1<height){y1=height}
					ny = y1 + "px"
	                      thelayer.style.top = ny;
	                     }
	             if (NS4&&!NS6) {
	                      y1 = parseInt(document.textframe.document.textblock.top);
	                      y1 = y1 + scrolldir;
	                      if (y1>1){y1=0;}
						  if (y1<height){y1=height}
	                      document.textframe.document.textblock.top = y1;
	                      }
	             if (IE4) {
	                      y1=parseInt(textblock.style.top);
	                      y1 = y1 + scrolldir;
	                      if (y1>1){y1=0;}
						  
					if (y1<height){y1=height;}
	                      textblock.style.top = y1;
	                     }
					
	      }
		  
	    setTimeout("scroller()",interval);
}
