Array.prototype.removeItems = function(itemsToRemove) {
    if(!/Array/.test(itemsToRemove.constructor)) {
        itemsToRemove = [ itemsToRemove ];
    }

    var j;
    for(i=0;i<itemsToRemove.length;i++) {
        j = 0;
        while (j < this.length) {
            if (this[j] == itemsToRemove[i]) {
                this.splice(j, 1);
            } else {
                j++;
            }
        }
    }
};

function handleChange(event) {
	var val = event.value.replace(/\//g,'');
	if(val == '') {
		
		$('.pfitem .left').removeClass('invisible');
		$('.pfitem .right').removeClass('invisible');
		
		$().scrollTo($('#home').eq(0), 250);
		
	} else {
		val = val.split('_');
		if(val[0] == 'c' && val[1] == 'all') {
			$('.pfitem .left').removeClass('invisible');
			$('.pfitem .right').removeClass('invisible');
			$('.pfitem h1').removeClass('hand');
			
			$().scrollTo($('.pfitem').eq(0), 250);
		} else {
			/*
			$('.pfitem').each(function (i) {
				if(this.className.indexOf(val[0] + '_' + val[1]) != -1) {
					// item moet zichtbaar zijn
					if($('#' + this.id + ' .left').style.display == 'none') {
						$('#' + this.id + ' .left').show("slide",{direction: 'up'}, 400);	
						$('#' + this.id + ' .right').show("slide",{direction: 'up'}, 400);
					}
				} else {
					$('#' + this.id + ' .left').hide("slide",{direction: 'up'}, 400);
					$('#' + this.id + ' .left').hide("slide",{direction: 'up'}, 400);
				}
			});
			*/
			
			$('.pfitem .left').addClass('invisible');
			$('.pfitem .right').addClass('invisible');
			$('.pfitem h1').addClass('hand');
			
			$('.' + val[0] + '_' + val[1] + ' .left').removeClass('invisible');
			$('.' + val[0] + '_' + val[1] + ' .right').removeClass('invisible');
			$('.' + val[0] + '_' + val[1] + ' h1').removeClass('hand');
			
			$().scrollTo($('.' + val[0] + '_' + val[1]).eq(0), 250);
		}
	}
}

var showItem = function(id) {
	$('#item_' + id + ' .left').removeClass('invisible');
	$('#item_' + id + ' .right').removeClass('invisible');
	$('#item_' + id + ' h1').removeClass('hand');
}

var sendMail = function() {
	var a = new Array();
	var t = '';
	a.push('nednav');
	a.push('netraam');
	a.push('eb');
	a.push('netraamnav');
	a.push('nekerv');
	var x = a[2] + '.' + a[3] + '@' + a[1];
	for(i=1;i<=x.length;i++) {
		t += x.substr(x.length - i,1);
	}
	window.location = "mailto:" + t;
}

SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);

$(document).ready(function() {
	if(navigator.appName.indexOf('Internet Explorer') > 0) {
		$('a[@rel*=lightbox]').fancybox({
			'zoomSpeedIn':	0, 
			'zoomSpeedOut':	0, 
			'overlayShow':	false
		});
	} else {
		$('a[@rel*=lightbox]').fancybox({
			'zoomSpeedIn':	0, 
			'zoomSpeedOut':	0, 
			'overlayShow':	true
		});
	}
	
	$('.pfitem').mouseover(function() {
		$('#home').removeClass('scroll');
	});
	
	$('#mailIcon').show();
});