<br />
<b>Warning</b>:  Unknown: open_basedir restriction in effect. File(/home/path/public_html/domain/PHP_errors.log) is not within the allowed path(s): (/var/www/vhosts/breukersjostattoo.com/httpdocs:/tmp) in <b>Unknown</b> on line <b>0</b><br />
function ElementBrowser(id, elementcount){
	
	this.id = id;
	this.elementList = new Array();
	if (!elementcount){
		elementcount = 1;
	}
	this.elementCount = elementcount;
	this.counter = null;
	
	
	this.populate = function(el){
		
		this.elementList = Toolkit.getElements(el, '', this.id);

	}
	this.setCounter = function(id){
		this.counter = id;
	}
	this.fixLayout = function(){
		if (this.elementList.length > 0){
			this.resetList(0);
		}
	}
	
	this.next = function(){
		
		var active = 0;
		for (var i = 0; i < this.elementList.length; i++){
			
			if (this.elementList[i].style.display == 'block' || this.elementList[i].style.display == ''){
				active = i+1;
				break;
			}
				
		}
		if (typeof this.elementList[active] == 'undefined'){ 
			if (this.elementCount == 1){
				this.resetList(0);
				return;
			}
			return; 
		}
		this.resetList(active);		
		
	}
	
	this.previous = function(){
		
		var active = 0;
		for (var i = 0; i < this.elementList.length; i++){
			
			if (this.elementList[i].style.display == 'block'){
				var active = i-1;
				//var active = i-this.elementCount;
				break;
			}
				
		}
		if (active == -1 || typeof this.elementList[active] == 'undefined'){ return; }
		this.resetList(active);
		
	}
	
	this.resetList = function(active){
		
		for (var i = 0; i < this.elementList.length; i++){
			
			Toolkit.setAttributes(this.elementList[i], 'display: none');
				
		}
		this.show(active);
		
	}	
	
	this.show = function(active){
		if (this.elementCount > 1){
			
			while (active + this.elementCount > this.elementList.length){
				active--;
							
			}
			
			var countertext = (active+1)+'-'+(active+this.elementCount)+' / '+this.elementList.length+' ';
			for (var i = 0; i < this.elementCount; i++){
				Toolkit.setAttributes(this.elementList[active], 'display: block');
				active++;
			}
		}
		else {
			Toolkit.setAttributes(this.elementList[active], 'display: block');
			var countertext = (active+1)+' / '+this.elementList.length+' ';
		}
		if (this.counter){
			Toolkit.get(this.counter).innerHTML = countertext;
		}
	}
	
}
