var WIB = new Class_WIB()

	function changeMain(thisSrc){
	//popup grotere foto
	src1 = thisSrc.src;
	src_orginal = src1.replace('width=190&height=300','width=800&height=600');
	window.open(src_orginal,'foto','width=800,height=600');
	
	}
function Class_WIB()
{
	this.stap = 0
	this.steps = 40
	this.delay = 2
	this.Pagina = 1
	this.bMoving = false
	this.Interval = false
	this.arrObjects = new Array()
	this.BeweegBreedte = 400
	this.nAantalObjecten = 0
	if ( navigator.userAgent.indexOf('Firefox') > -1 ) this.steps = Math.ceil(this.steps/2)
	this.steps *= 2
	this.nFactor = new Array()
	var x = 0
	var v = 0
	var a = 1
	for(var i=0; i<=this.steps; i++)
	{
		if (i == this.steps/2) a = 0
		if (i > this.steps/2) a = -1
		v+=a
		x+=v
		this.nFactor[i] = x
	}
	for(i=0; i<=this.steps; i++)
	{
		this.nFactor[i] /= x
	}
	
	this.Class_WibObject = function(nummer, Guid, Foto, Plaats)
	{
		this.Nummer = nummer
		this.Guid = Guid
		this.Foto = Foto
		this.Plaats = Plaats
		this.ImageLoaded = false
		this.LoadImage = function()
		{
			if ( this.ImageLoaded == false )
			{
				document.getElementById('Image' + this.Nummer).src = this.Foto
				this.ImageLoaded = true
			}
		}
		
		this.GetStatRegStr = function()
		{
			{
				return ''
			}
		}
		
		this.getHTML = function()
		{
			var sPlaatsTemp = ( this.Plaats.length > 20 ? this.Plaats.substring(0,18) + '...' : this.Plaats )
			var s = ''
			sEnter = '\n'
			if ( navigator.userAgent.indexOf('Firefox') > -1 ) sEnter = ' '

			s += '<div class="wib-object" style="left:' + (WIB.BeweegBreedte/2)*this.Nummer + 'px;">'
			s += '<a rel="lytebox[vacation]" href="' + Foto.replace('width=190&height=300','width=800&height=600') +'"><img id="Image' + this.Nummer + '" '
			if ( this.Nummer < 10 )
			{
				s += 'src="' + this.Foto + '"'
				this.ImageLoaded = true
			}
			else
			{
				s += 'src="/images/spacer.gif"'
			}
			s += ' height="120" alt="Foto" class="thumb"  title="' + sEnter
			' '
			s += this.Plaats + '" /></a>'
			s += '</div>'

			return s
		}
	}	
	<!-- onclick="changeMain(this)" -->
	
	this.AddObject = function(Guid, Foto, Plaats)
	{
		var nummer = this.arrObjects.length
		this.arrObjects[nummer] = new this.Class_WibObject(nummer, Guid, Foto, Plaats)
	}

	this.Start = function()
	{
		this.nAantalObjecten = this.arrObjects.length
		this.xMax = 0
		this.AantalPaginas = Math.ceil(this.nAantalObjecten / 2)
		this.xMin = - (this.AantalPaginas-1) * (this.BeweegBreedte)
		var s = ''
		for ( var i=0; i<this.nAantalObjecten; i++ )
		{
			 s += this.arrObjects[i].getHTML(i)
		}
		document.getElementById('wib-inner').innerHTML = s
		this.SetButtons()
	}
	
	this.SetButtons = function()
	{
		if ( this.nAantalObjecten > 2 )
		{
			document.getElementById('Wib-arrow-r').style.display = ( this.Pagina < this.AantalPaginas ? 'block' : 'none' )
			document.getElementById('Wib-arrow-l').style.display = ( this.Pagina > 1 ? 'block' : 'none' )
		}
		else
		{
			document.getElementById('Wib-arrow-r').style.display = 'none'
			document.getElementById('Wib-arrow-l').style.display = 'none'
		}
	}


	this.Click = function(ax)
	{
		if ( this.bMoving == false )
		{
			var paginaVorige = this.Pagina
			this.Pagina += ax
			if ( this.Pagina > this.AantalPaginas ) this.Pagina = this.AantalPaginas
			if ( this.Pagina < 1 ) this.Pagina = 1
			if ( paginaVorige == this.Pagina ) return
			this.bMoving = true
			
			sStats = ''
			for ( var i=0; i<2; i++ )
			{
				xTemp2 = (this.Pagina * 2 ) + i - 2
				if ( xTemp2 < this.nAantalObjecten )
				{
					this.arrObjects[xTemp2].LoadImage()
					s = this.arrObjects[xTemp2].GetStatRegStr()
					sStats += s + ( s == '' ? '' : ',' )
				}
			}
			if ( !this.Moving ) this.Move(0, ax)
			this.bMoving = true
		}
	}
	
	this.Move = function(stap, direction)
	{
		this.x = this.nFactor[stap] * direction * this.BeweegBreedte + (this.Pagina - direction - 1) * this.BeweegBreedte

		this.xLocation = Math.round(this.x)
		if ( this.x > this.xMax ) this.x = this.xMax
		if ( this.x < this.xMin ) this.x = this.xMin
		
		document.getElementById('wib-inner').style.left = -this.xLocation + 'px'
		if ( stap == this.steps )
		{
			this.bTurned = false
			this.a = 0
			clearInterval(this.Interval)
			this.bMoving = false
			this.Interval = false
			this.SetButtons()
			this.PaginaStap = 1
		}
		else
		{
			stap ++
			setTimeout('WIB.Move(' + stap + ', ' + direction + ')',12)
		}
	}
}
