function navbar1(me)
{
	this.me = me;		// the name of the instance of the object we actually are. 
	this.images = null;	// an array of images that could be displayed
	this.id = null;		// an array of ids for those images
	this.params = null; // an array of parameters to pass on the url
	
	this.self = '';		// the name of the php file to call onClick
	this.field = '';	// the field name to use in the url
	
	this.start = 0;		// the current navigation start point
	this.ubound = 0;	// the maximum possible start point
	this.count = 0;		// the number of images to display at once
	
	this.active = false;// whether we are currently scrolling
	this.incr = 0;		// how much to move by when scrolling (+/-1)  

	this.ScrollLeft = function()
	{
		this.active=true;
		this.incr=-1;
		this.Update();
	};

	this.ScrollRight = function()
	{
		this.active=true;
		this.incr=1;
		this.Update();
	};

	this.Reset = function()
	{
		this.active=false;
	};

	this.Click = function (imageNo)
	{
		this.params.SetParam(this.field, this.ids[imageNo + this.start]);
		this.params.SetParam(this.me + 'Start', this.start);
		//alert(this.params.MakeUrl(this.self));  
		window.open(this.params.MakeUrl(this.self), '_self', '');
	};

	this.Update = function()
	{
		var lbound = 0;
		var imgCount = this.images.length;
		var start = this.start;
		if (!this.active) return;
		
		start = start + this.incr;
		
		if (start < lbound) start = lbound;
		if (start > this.ubound) start = this.ubound;
		
		if ((this.incr > 0) && (start == this.ubound)) this.active = false;
		if ((this.incr < 0) && (start == lbound)) this.active = false;
		
		//alert ('imgCount=' + imgCount + ' count=' + this.count);
		
		if (imgCount >= this.count) imgCount = this.count;
		for (i = 0; i < imgCount; i ++)
		{
			//alert('start=' + start + ' i=' + i);
			document[this.me+i].src = this.images[start+i].src;
		}
		
		if (start == lbound)
			document[this.me+'left'].src = 'images/white-button.jpg';
		else
			document[this.me+'left'].src = this.startBtn;
		
		if (start == this.ubound)
			document[this.me+'right'].src = 'images/white-button.jpg';
		else
			document[this.me+'right'].src = this.endBtn;
		
		this.start = start;
		
		setTimeout(this.me + '.Update("' + this.me + '")', 500);
	};
}

