var useBSNnsNieuw;

if (useBSNnsNieuw) {
	if (typeof(bsnNieuw) == "undefined")
		bsnNieuw = {}
	var _bsnNieuw = bsnNieuw;
} else {
	var _bsnNieuw = this;
}


_bsnNieuw.afbeeldingenVervangenNieuw = function (divs, fadetijd, vertraging ) {	
	this.nActNieuw = -1;
	this.aDivsNieuw = divs;
	
	for (var i=0;i<divs.length;i++)
	{
		document.getElementById(divs[i]).style.opacity = 0;
		document.getElementById(divs[i]).style.position = "absolute";
		document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
		document.getElementById(divs[i]).style.visibility = "hidden";
	}
	
	this.nDurNieuw = fadetijd;
	this.nVertragingNieuw = vertraging;
		
	this._nieuwNieuw();
}


_bsnNieuw.afbeeldingenVervangenNieuw.prototype._nieuwNieuw = function() {
	if (this.nID1)
		clearInterval(this.nID1);
	
	this.nOldActNieuw = this.nActNieuw;
	this.nActNieuw++;
	if (!this.aDivsNieuw[this.nActNieuw])	this.nActNieuw = 0;
	document.getElementById( this.aDivsNieuw[this.nActNieuw] ).style.visibility = "visible";
	
	this.nIntNieuw = 50;
	this.nTijdNieuw = 0;
	
	var p=this;
	this.nID2Nieuw = setInterval(function() { p._vervaagNieuw() }, this.nIntNieuw);
}


_bsnNieuw.afbeeldingenVervangenNieuw.prototype._vervaagNieuw = function() {
	this.nTijdNieuw += this.nIntNieuw;
	
	var op = this._maakSoepel(this.nTijdNieuw, 0, 1, this.nDurNieuw);
	var ieop = op*100;
	document.getElementById( this.aDivsNieuw[this.nActNieuw] ).style.opacity = op;
	document.getElementById( this.aDivsNieuw[this.nActNieuw] ).style.filter = "alpha(opacity="+ieop+")";
	
	if (this.nOldActNieuw > -1) {
		document.getElementById( this.aDivsNieuw[this.nOldActNieuw] ).style.opacity = 1 - op;
		document.getElementById( this.aDivsNieuw[this.nOldActNieuw] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
	}
	
	if (this.nTijdNieuw == this.nDurNieuw) {
		clearInterval( this.nID2Nieuw );
		
		if (this.nOldActNieuw > -1)
			document.getElementById( this.aDivsNieuw[this.nOldActNieuw] ).style.visibility = "hidden";	
		
		var p=this;
		this.nID1 = setInterval(function() { p._nieuwNieuw() }, this.nVertragingNieuw);
	}
}



_bsnNieuw.afbeeldingenVervangenNieuw.prototype._maakSoepel = function(t,b,c,d) {
	return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}





var useBSNnsVerkocht;

if (useBSNnsVerkocht) {
	if (typeof(bsnVerkocht) == "undefined")
		bsnVerkocht = {}
	var _bsnVerkocht = bsnVerkocht;
} else {
	var _bsnVerkocht = this;
}


_bsnVerkocht.afbeeldingenVervangenVerkocht = function (divs, fadetijd, vertraging ) {	
	this.nActVerkocht = -1;
	this.aDivsVerkocht = divs;
	
	for (var i=0;i<divs.length;i++)
	{
		document.getElementById(divs[i]).style.opacity = 0;
		document.getElementById(divs[i]).style.position = "absolute";
		document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
		document.getElementById(divs[i]).style.visibility = "hidden";
	}
	
	this.nDurVerkocht = fadetijd;
	this.nVertragingVerkocht = vertraging;
		
	this._nieuwVerkocht();
}


_bsnVerkocht.afbeeldingenVervangenVerkocht.prototype._nieuwVerkocht = function() {
	if (this.nID1)
		clearInterval(this.nID1);
	
	this.nOldActVerkocht = this.nActVerkocht;
	this.nActVerkocht++;
	if (!this.aDivsVerkocht[this.nActVerkocht])	this.nActVerkocht = 0;
	document.getElementById( this.aDivsVerkocht[this.nActVerkocht] ).style.visibility = "visible";
	
	this.nIntVerkocht = 50;
	this.nTijdVerkocht = 0;
	
	var p=this;
	this.nID2Verkocht = setInterval(function() { p._vervaagVerkocht() }, this.nIntVerkocht);
}


_bsnVerkocht.afbeeldingenVervangenVerkocht.prototype._vervaagVerkocht = function() {
	this.nTijdVerkocht += this.nIntVerkocht;
	
	var op = this._maakSoepel(this.nTijdVerkocht, 0, 1, this.nDurVerkocht);
	var ieop = op*100;
	document.getElementById( this.aDivsVerkocht[this.nActVerkocht] ).style.opacity = op;
	document.getElementById( this.aDivsVerkocht[this.nActVerkocht] ).style.filter = "alpha(opacity="+ieop+")";
	
	if (this.nOldActVerkocht > -1) {
		document.getElementById( this.aDivsVerkocht[this.nOldActVerkocht] ).style.opacity = 1 - op;
		document.getElementById( this.aDivsVerkocht[this.nOldActVerkocht] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
	}
	
	if (this.nTijdVerkocht == this.nDurVerkocht) {
		clearInterval( this.nID2Verkocht );
		
		if (this.nOldActVerkocht > -1)
			document.getElementById( this.aDivsVerkocht[this.nOldActVerkocht] ).style.visibility = "hidden";	
		
		var p=this;
		this.nID1 = setInterval(function() { p._nieuwVerkocht() }, this.nVertragingVerkocht);
	}
}



_bsnVerkocht.afbeeldingenVervangenVerkocht.prototype._maakSoepel = function(t,b,c,d) {
	return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}
