<!-- Javascript Aware bib -->
function popup(url,features) {
	window.open(url,'newwin','status=yes,scrollbars=yes,'+features);
}

var viewerPostion 		= 0;

function toon(n)
{
	var n = document.getElementById(n);
	Ta = n.style.display;	
	switch(Ta)
	{
		case "block": 
			n.style.display = "none"; 			
			break;
		case "": 
			n.style.display = "none"; 			
			break;
		default: 
			n.style.display = "block";			
			break;
	}
}

function viewerNext(viewerImageId)
{	
	var vi 					= document.getElementById(viewerImageId);

	if(vi != null)
	{
		viewerPostion 	= (viewerPostion == viewerImages.length-1 ? 0 : viewerPostion + 1);
		vi.src 			= imagesFolder + viewerImages[viewerPostion];
	}
}

function viewerPrevious(viewerImageId)
{
	var vi 					= document.getElementById(viewerImageId);
	
	if(vi != null)
	{
		viewerPostion 	= (viewerPostion == 0 ? viewerImages.length-1 : viewerPostion - 1);
		vi.src 			= imagesFolder + viewerImages[viewerPostion];
	}
}

//function for setting height of div wrapper, otherwise we have a grey area
function adaptWrapperHeight()
{
	var wrapper = document.getElementById('wrapper');
	var extra = document.getElementById('extra');
	
	if(wrapper.offsetHeight < extra.offsetHeight)
	{
		wrapper.style.height = extra.offsetHeight + "px";
	}
}

function KeyValue( key, value )
{
    this.key = key;
    this.value = value;
}

//Map functionality
function Map()
{
    this.array = new Array();
}

Map.prototype.put = function( key, value )
{
    if( ( typeof key != "undefined" ) && ( typeof value != "undefined" ) )
    {
        this.array[this.array.length] = new KeyValue( key, value );
    }
}

Map.prototype.get = function( key )
{
    for( var k = 0 ; k < this.array.length ; k++ )
    {
        if( this.array[k].key == key ) {
            return this.array[k].value;
        }
    }
    return "";
}

Map.prototype.getKey = function( index )
{
	if(index < this.array.length)
	{
		return this.array[index].key;
	}
    
  return "";
}

Map.prototype.getValue = function( index )
{
	if(index < this.array.length)
	{
		return this.array[index].value;
	}
    
  return "";
}

Map.prototype.length = function()
{
    return this.array.length;
}

function changeSearchField()
{
	var el = document.getElementById("txtSearch");
	if (el)
	{
		if (el.value)
		{
			if (el.value == "zoeken" || el.value == "search")
			{
				el.value = "";
			}
		}		
	}
}

function resetSearchField()
{
	var el = document.getElementById("txtSearch");
	var el2 = document.getElementById("langSearch");	
	
	if (el2.value == "NL")
	{
		if (!el.value)
		{
			el.value = "zoeken";
		}
	}
	else
	{
		if (!el.value)
		{
			el.value = "search";
		}
	}
}
