//  Check for NS4 or IE4
NS = (document.layers) ? 1:0
IE = (document.all) ? 1:0
NOWEBTV = (navigator.userAgent.indexOf("WebTV") == -1)
DHTML = ((NS || IE) && NOWEBTV);

//  Netscape Bug Resize Fix

var NS_oldX = window.innerWidth; var NS_oldY = window.innerHeight;
function NS4refresh() { 
        if (document.layers) // dhtml ns4
        {       if ((NS_oldX != window.innerWidth) || (NS_oldY !=window.innerHeight)) 
                        window.location=window.location;
                NS_oldX = window.innerWidth; NS_oldY = window.innerHeight;
        }
}

//  Set up Drag Variables

var dragactive=0;
var dragname="";

// DHTMLObject : Creates a New DHTML Object

function DHTMLObject(id,nestid) {	
	if (NS) {
		if (nestid) {
			this.obj = eval("document."+nestid+".document."+id); }
		else {
			this.obj = eval("document."+id); }
			this.css = this.obj;
	}
	if (IE) {
		this.obj = document;
		this.css = document.all[id].style; 
	}		
this.name = id+"Object";
eval(this.name+"=this");
this.xpos = (NS) ? this.css.left : this.css.pixelLeft;
this.ypos = (NS) ? this.css.top  : this.css.pixelTop;
this.visibility = this.css.visibility;
this.w = (NS)? this.obj.clip.width : this.css.pixelWidth;
this.h = (NS)? this.obj.clip.height : this.css.pixelHeight;
this.moveby=moveObjectBy;
this.moveto=moveObjectTo;
this.show=showObject;
this.hide=hideObject;
this.slideon=0;
this.slidepause=0;
this.slide=slideObject;
this.slideto=slideTo;
this.slideby=slideBy;

}

function moveObjectBy(x,y) {
	this.xpos+=x;
	this.css.left=this.xpos;
	this.ypos+=y;
	this.css.top=this.ypos; }
	
// moveObject : Moves object to x,y
	
function moveObjectTo(x,y) {
	this.xpos=x;
	this.css.left=this.xpos;
	this.ypos=y;
	this.css.top=this.ypos; }

function showObject() {
	this.css.visibility = (NS) ? "show" : "visible"; 
	this.visibility = this.css.visibility;}

function hideObject() {
	this.css.visibility = (NS) ? "hide" : "hidden";
	this.visibility = this.css.visibility; }	
	
function slideObject(stepx,stepy,destx,desty,speed,fx) {
	if (!fx) fx=null;
	xcurr=Math.floor(Math.abs(stepx));
	xstop=Math.floor(Math.abs(destx-this.xpos));	
	ycurr=Math.floor(Math.abs(stepy));
	ystop=Math.floor(Math.abs(desty-this.ypos));
	if (this.slideon && ((xcurr<xstop) || (ycurr<ystop))){
		this.moveby(stepx,stepy)
	setTimeout(this.name+".slide("+stepx+","+stepy+","+destx+","+desty+","+speed+",\""+fx+"\")",speed);
	}
	else if (this.slidepause==0){
		this.slideon=0;
		this.slidepause=0;
		this.moveto(destx,desty);
		eval(fx); 
	}
}

function slideTo(destx,desty,step,speed,fx) {
	if (!this.slideon) {
		this.slideon=1;
		this.destx=destx;
		this.desty=desty;
		this.step=step;
		this.speed=speed;
		this.fx=fx;
		a=destx-this.xpos;
		b=desty-this.ypos;
		c=Math.sqrt(Math.pow(a,2) + Math.pow(b,2))/step;
		this.slide(a/c,b/c,destx,desty,speed,fx);
	}
}

function slideBy(a,b,step,speed,fx) {
	if (!this.slideon) {
		this.slideon=1;
		destx=a+this.xpos;
		desty=b+this.ypos;
		this.destx=destx;
		this.desty=desty;
		this.step=step;
		this.speed=speed;
		this.fx=fx;
		c=Math.sqrt(Math.pow(a,2) + Math.pow(b,2))/step;
		this.slide(a/c,b/c,destx,desty,speed,fx);
	}
}




