// JavaScript Document

var Slides = Class.create(
{
   initialize: function()
   {
	this.images = Array();
	
	//amount of images
	this.imageCount = 0;
	
	//	counter which image is active
	this.active = 0;
	//this.containerImg = $('slideImg');
   },
   
   addImage: function(image,title)
   {
	//	create new image object
	var newImage = new Slide();
	newImage.image = image;
	newImage.title = title;
	
	//	add image to slideshow
	this.imageCount = this.images.push(newImage);
   },
   setDirectory: function(dirname)
   {
	this.dirname = dirname;
   },
   nextImg: function()
   {
	if(this.active < (this.imageCount - 1))
	{
	   this.active = this.active + 1;

	   this.loadNewImage();
	}
	else if(this.active == (this.imageCount - 1))
	{
	   this.active = 0;

	   this.loadNewImage();
	}
   },
   prevImg: function()
   {
	if(this.active > 0)
	{
	   this.active = this.active - 1;

	   this.loadNewImage();
	}
	else if(this.active == 0)
	{
	   this.active = this.imageCount - 1;

	   this.loadNewImage();
	}
   },
   loadNewImage: function()
   {
	   newUrl 	= this.dirname + this.images[this.active].image;
	   newTitle = this.images[this.active].title;
	   
	   $('slideImg').src = newUrl;
	   $('slideImg').alt = newTitle;
	   $('slideImg').title = newTitle;
	   $('caption').innerHTML = newTitle;
   }
   
  
  
});

//	on window load -> start map navigation
//Event.observe(window, 'load', function() {

  var slides = new Slides();

var Slide = Class.create(
{
   initialize: function()
   {
	this.image = '';
	this.title = '';
   }  
});
//});

Event.observe(window, 'load', function() {
  
 // nothing yet on window load
});
