function dynObj(id,x,y,w,h) {
	this.el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (!this.el) return null;
	this.doc = (document.layers)? this.el.document: this.el;
	this.css = (this.el.style)? this.el.style: this.el;
	var px = (document.layers||window.opera)? "": "px";
	this.x = x || 0;	if (x) this.css.left = this.x+px;
	this.y = y || 0;	if (y) this.css.top = this.y+px;
	this.width = w? w: (this.el.offsetWidth)? this.el.offsetWidth: (this.css.clip.width)? this.css.clip.width: 0;
	this.height = h? h: (this.el.offsetHeight)? this.el.offsetHeight: (this.css.clip.height)? this.css.clip.height: 0;
	if (w){ (document.layers)? this.css.clip.width=w+px: this.css.width=w+px;}
	if (h){ (document.layers)? this.css.clip.height=h+px: this.css.height=h+px;}
	this.obj = id + "dynObj"; 	eval(this.obj + "=this");
}

function dw_show() { this.css.visibility = "visible"; }
function dw_hide() { this.css.visibility = "hidden"; }

function dw_shiftTo(x,y) {
	if (x!=null) this.x=x; if (y!=null) this.y=y;	
	if (this.css.moveTo) { 
		this.css.moveTo(Math.round(this.x),Math.round(this.y)); 
	} else { 
		this.css.left=Math.round(this.x)+"px"; 
		this.css.top=Math.round(this.y)+"px"; 
	}
}

function dw_shiftBy(x,y) {
	this.shiftTo(this.x+x,this.y+y);
}

dynObj.prototype.show = dw_show;
dynObj.prototype.hide = dw_hide;
dynObj.prototype.shiftBy = dw_shiftBy;
dynObj.prototype.shiftTo = dw_shiftTo;

var scrTimer = 20; 

function stopScroll(num) {
  if (pgLoaded && wndo[num]) {
  	clearTimeout(wndo[num].scrTmId);
  	wndo[num].scrTmId = 0;
  }
}

function loadScrLyr(num,lyr,id) {
	if (!pgLoaded) return; 
	if (typeof wndo[num].cnt != "undefined") wndo[num].cnt.hide();
  wndo[num].scrTmId = 0;
	wndo[num].cnt = new dynObj(lyr);
  if (id && document.getElementById) 
    //wndo[num].cnt.width = document.getElementById(id).offsetWidth;
    wndo[num].cnt.width = document.getElementById(id).offsetHeight;
	wndo[num].cnt.show();
	wndo[num].cnt.shiftTo(0,0);	// restore top/left to 0 
	wndo[num].maxX = wndo[num].cnt.width - wndo[num].width;
	wndo[num].maxY = wndo[num].cnt.height - wndo[num].height
} 

function inchBottom(num,inc) {
	if (!pgLoaded||!wndo[num]) return;
	if (wndo[num].scrTmId) clearTimeout(wndo[num].scrTmId);
	var y = parseInt(wndo[num].cnt.css.top);	
	if (y>-wndo[num].maxY) { 
    if ((y-inc)>(-wndo[num].maxY)) wndo[num].cnt.shiftBy(0,-inc);
		else wndo[num].cnt.shiftBy(0,-(wndo[num].maxY-Math.abs(y)));
		wndo[num].scrTmId = setTimeout("inchBottom("+num+","+inc+")",scrTimer);	
	}
}

function inchTop(num,inc) {
	if (!pgLoaded||!wndo[num]) return;
	if (wndo[num].scrTmId) clearTimeout(wndo[num].scrTmId);
	var y = parseInt(wndo[num].cnt.css.top);
	if (y<0) { 
    	if ((y+inc)<=0) wndo[num].cnt.shiftBy(0, inc); 
		else wndo[num].cnt.shiftBy(0,-y); 
		wndo[num].scrTmId = setTimeout("inchTop("+num+","+inc+")",scrTimer);
  	}
}

function inchCicle(num,inc) {
	if (!pgLoaded||!wndo[num]) return;
	if (wndo[num].scrTmId) clearTimeout(wndo[num].scrTmId);
	var y = parseInt(wndo[num].cnt.css.top);
	if (y>-wndo[num].maxY) { 
	    if ((y-inc)>(-wndo[num].maxY)) wndo[num].cnt.shiftBy(0,-inc);
		else wndo[num].cnt.shiftBy(0,-(wndo[num].maxY-Math.abs(y)));
	}
	else wndo[num].cnt.shiftBy(0,-y); 
	wndo[num].scrTmId = setTimeout("inchCicle("+num+","+inc+")",scrTimer);	
}
