function nextSlide()
{    
    if(this.position < this.items.length-1) {
        this.position = this.position + 1;	
    } else {
    	this.position = 0;
    }
    this.showActivePosition();
}

function prevSlide()
{    
    if(this.position > 0) {
        this.position = this.position - 1;	
    } else {
    	this.position = this.items.length -1;
    }
    this.showActivePosition();
}

function showActivePosition()
{
	for(var i=0; i<this.items.length; i++) {
		this.items[i].style.display = 'none';
	}
	this.items[this.position].style.display = 'block';
}

function Slides(parent_id)
{
 this.position = 0;
 this.parent_id = parent_id;
 this.parent = document.getElementById(parent_id);
 this.items = this.parent.getElementsByTagName('li');
 this.activeNode = this.parent.childNodes[0];
 this.nextSlide = nextSlide;	  
 this.showActivePosition = showActivePosition;
 this.prevSlide = prevSlide;	
 this.showActivePosition();
}

function initSlides(name)
{
   slides = new Slides(name);
}
