function fvr3_init() {
	document.write("<IMG SRC="+this.base+"1"+this.ext+" HEIGHT="+this.height+" WIDTH="+this.width+" NAME="+this.name+">");
   onLoadManager.add(this);
   this.images=new Array(this.n);
   this.imgsrc=new Array(this.n);
};

function fvr3_onload() {
   var i;
	for(i=1;i<=this.n;i++) {
 		this.images[i]=new Image()
		this.images[i].src=this.imgname(i);
      this.imgsrc[i]=this.imgname(i);
   };

   this.panright(1);

	FVR3.catchevents()
};

function FVR3_catchevents_nav() {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=FVR3.mousedown;
	document.onmousemove=FVR3.mousemove; 
	document.onmouseup=FVR3.mouseup; 
};

function FVR3_catchevents_ie() {
	document.onmousedown=FVR3.mousedown;
	document.onmousemove=FVR3.mousemove; 
	document.onmouseup=FVR3.mouseup; 
};

function fvr3_panright(by) {
    this.frame=this.frame+by;
    while (this.frame<1)
        this.frame=this.frame+this.n;

	 while (this.frame>this.n)
        this.frame=this.frame-this.n;
 
    this.draw();
};

function fvr3_draw() {
    document[this.name].src=this.imgsrc[this.frame];
};


function fvr3_imgname(num) {
   return this.base+num+this.ext;
};

function fvr3_mousedown(evt) {
   this.oldx=(is_ie4up) ? evt.clientX : evt.pageX;
   this.oldy=evt.pageY;
   this.zone=0;
   FVR3.grab=this;
}  

function FVR3_mousedown_nav(evt) {
	var hit=FVR3[evt.target.name]
	if (hit != undefined) {
		hit.mousedown(evt);
	   document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
		return true;
	} else
		return document.routeEvent(evt);
};

function FVR3_mousedown_ie() {
        var hit=FVR3[event.srcElement.name];
        window.status="mousedown!";
        if (hit != null) {
		hit.mousedown(event);
        };
        return false;
};

function FVR3_mousemove_nav(evt) {
    FVR3.grab.mousemove(evt);
};

function FVR3_mousemove_ie() {
    if (FVR3.grab!=null) {
        window.status="dragging";
    	FVR3.grab.mousemove(event);
        return false;
    }
};

function fvr3_mousemove(evt) {
    fud=(evt.x-this.oldx)/this.dragPixels;
    this.newzone=Math.floor(fud);
    if (this.newzone != this.zone) {
     	this.panright(this.newzone-this.zone);
	   this.zone=this.newzone;
    }
}

function FVR3_mouseup_nav(evt) {
    FVR3.grab=null;
    document.releaseEvents(Event.MOUSEMOVE);
} 

function FVR3_mouseup_ie(evt) {
    FVR3.grab=null;
    return true;
} 

function fvr3(name) {

   // initialization

   this.name=name;
   this.width=0;
   this.height=0;
   this.n=0;
   this.base="";
   this.ext="";
   this.dragPixels=10;
   this.newzone=0;
   this.zone=0;
   this.frame=1;
	FVR3[name]=this;

   // methods

   this.init=fvr3_init;
   this.imgname=fvr3_imgname;
   this.onload=fvr3_onload;
   this.mousemove=fvr3_mousemove;
   this.mousedown=fvr3_mousedown;
//   this.mouseup=fvr3_mouseup;
   this.panright=fvr3_panright;
   this.draw=fvr3_draw;
};

// static object

FVR3=new Array();
FVR3.grab=null;

if (is_nav4up) {
	FVR3.catchevents=FVR3_catchevents_nav
	FVR3.mousedown=FVR3_mousedown_nav
	FVR3.mousemove=FVR3_mousemove_nav
	FVR3.mouseup=FVR3_mouseup_nav
};

if (is_ie4up) {
	FVR3.catchevents=FVR3_catchevents_ie
	FVR3.mousedown=FVR3_mousedown_ie
	FVR3.mousemove=FVR3_mousemove_ie
	FVR3.mouseup=FVR3_mouseup_ie
}
