/**************************
/* [resizewin.js] v1.01
/* 11/15/02 1:59 AM
/* 
/* 
/* 
/* 
/* 
/* 
/* 
/***/

function resizeWin(objName,maxX,maxY,speed,delay,win){
	
	/*<Methods>*/
		this.initWin =    rw_initWin;
		this.resizeMe =   rw_resizeMe;
		this.showCoords = rw_showCoords;
		this.updateMe =   rw_updateMe;
		this.write =      rw_write;
		this.getX =       rw_getX;
		this.getY =       rw_getY;
		this.onResize =   rw_onResize;
	/*</Methods>*/
	
	/*<Properties>*/
		if (!objName) this.objName = "rwin"; else this.objName = objName;
		if (!win)     this.win = self;    else this.win = win;
		if (!maxX)    this.maxX = 400;    else this.maxX = maxX;
		if (!maxY)    this.maxY = 300;    else this.maxY = maxY;
		if (!speed)   this.speed = 1/6;   else this.speed = 1/speed;
		if (!delay)   this.delay = 30;    else this.delay = delay;
		this.layer = "coords";
	/*</Properties>*/
}

function rw_onResize(){
	if (document.all){
		if (!this.resizing) this.resizeMe();
		}
}

function rw_initWin(){
	if (document.all){
		this.resizeMe();
		}
	else {
		this.win.resizeTo(this.maxX + 10, this.maxY - 20);
		}
	
}

function rw_resizeMe(){
	this.win.focus();
	this.updateMe();
	}

function rw_showCoords(extra){
	if (this.layer){
		var text = '(' + this.getX() + ',' + this.getY() + ')' + extra;		
		this.write(text)
		}
}

function rw_updateMe(){

	this.resizing = true;
	var x; var y;
	this.showCoords('');
	x = Math.ceil((this.maxX - this.getX()) * this.speed);
	y = Math.ceil((this.maxY - this.getY()) * this.speed);
	if (x == 0 && this.getX() != this.maxX) {
		if (this.getX() > this.maxX) x = -1;
		else  x = 1;
		}
	if (y == 0 && this.getY() != this.maxY){
		if (this.getY() > this.maxY) y = -1;
		else y = 1;
		}
	if (x == 0 && y == 0) {
		this.resizing = false;
    		}
	else {
		resizeBy(parseInt(x),parseInt(y))
		setTimeout(this.objName + '.updateMe()',this.delay)
		}
}

function rw_myCeil(temp){
	if (temp == parseInt(temp)) return temp;
	if (temp > 0)
 		return parseInt(temp + .5);
	else return parseInt(temp - .5);
}

function rw_write(text){
	if (document.all && this.win.document.all["coords"]) this.win.document.all["coords"].innerHTML = text
}

function rw_getX(){
	if (document.all) return (this.win.document.body.clientWidth + 10)
	else return this.win.outerWidth - 12
}

function rw_getY(){
	if (document.all) return (this.win.document.body.clientHeight + 29)
	else return this.win.outerHeight - 31 
}

