function onTxtNav(type,myID){
	var content=document.getElementById(myID);
	var container=content.parentNode;
	var offTop = content.offsetTop;
	var contentHeight=content.offsetHeight
	var containerHeight=container.offsetHeight;
	var marg=100;
	if(type=="down"){
		if((offTop+contentHeight+marg) > containerHeight){
			content.style.top= (offTop-20)+"px";
		}
	}else if(type=="up"){
		if(contentHeight > containerHeight){
			if(offTop < 0){
				content.style.top= (offTop+20)+"px";
			}
		}
	}
}

this.iniscroll=function(){
	this.scroll_up=false;
	this.scroll_down=false;
	this.scroll_timer=-1;
	this.contId="txtContent";
	this.marg=20;
	//this.scroll_timer=setInterval("scroll()",1000);
} 

this.stopTimer=function(){
	clearInterval(this.scroll_timer);
	this.scroll_timer=-1;
}

this.onScrollActivate=function(direction,contID){
	this.contId=contID;
	if(direction=="up"){
		this.scroll_up=true;
		this.scroll_down=false;
	}else if(direction=="down"){
		this.scroll_up=false;
		this.scroll_down=true;
	}
	if(this.scroll_up || this.scroll_down){
		if(this.scroll_timer==-1){
			this.scroll_timer=setInterval("scroll()",20);
		}
	}
}

this.onScrollDeactivate=function(){
	if(this.scroll_timer!=-1){
		clearInterval(this.scroll_timer);
		this.scroll_timer=-1;
	}
}

this.scroll=function(){
	var content=document.getElementById(this.contId);
	var container=content.parentNode;
	var offTop = content.offsetTop;
	var contentHeight=content.offsetHeight;
	var containerHeight=container.offsetHeight;
	
	if(this.scroll_down){
		if((offTop+contentHeight+this.marg) > containerHeight){
			content.style.top= (offTop-5)+"px";
		}else{
			this.stopTimer();
		}
	}else if(this.scroll_up){
		if((contentHeight+this.marg) > containerHeight){
			if(offTop < 0){
				content.style.top= (offTop+5)+"px";
			}else{
				this.stopTimer();
			}
		}else{
			this.stopTimer();
		}
	}
}


