// JavaScript Document

var heights=new Array();
var isOpen=new Array();
var ids=new Array();
var beelden=new Array();

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
//loop through the array and hide each element by id
for (var i=0;i<ids.length;i++){
	hidediv(ids[i]);
}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		} else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function grow(id) {
	target=document.getElementById(id);
	s=(heights[id]-target.clientHeight)/10;
	if (s<1) s=1;
	target.style.height=(target.clientHeight+s)+'px';
	if (target.clientHeight<heights[id]) {
		if (isOpen[id]!=1)
			setTimeout("grow('"+id+"')",10);
	} else {
		isOpen[id]=1;
		target.style.height='';
	}
}

function shrink(id) {
	target=document.getElementById(id);
	s=target.clientHeight/10;
	if (s<1) s=1;
	target.style.height=(target.clientHeight-s)+'px';
	if (target.clientHeight>0)
		setTimeout("shrink('"+id+"')",10);
	else {
		isOpen[id]=0;
		target.style.display="none";
		target.style.height='';
	}
}
	
  
function showhide(id) {
	target=document.getElementById(id);
	if (target.style.display=="none") {
		if (beelden[id]>0) 
//			alert(id);
			startFade(id,beelden[id]);
		target.style.display="";
		if (heights[id]==undefined) 
			heights[id]=target.clientHeight;
		target.style.height='0px';
		isOpen[id]=0;
		grow(id);
		for (i=1; i<100; i++)
			if (isOpen['item_'+i]==2)
				shrink('item_'+i);
	} else {
		isOpen[id]=1;
		shrink(id);
	}
}	
	
function fadein(id,a) {
	if (a>100) a=100;
	setAlpha(id,a);
	if (a<100) {
		a=a+5;
		setTimeout("fadein('"+id+"',"+a+")",10);
	}
}
	
function setAlpha(id,a) {
//	alert(id);
	t=document.getElementById(id);
	t.style.opacity = a/100;
	t.style.filter = 'alpha(opacity='+a+')';
}
	
function startFade(id,c) {
	for (i=1; i<=c; i++) {
		//setAlpha("b"+id+"_"+i,0);
		setAlpha(id,0);
		//setTimeout("fadein('b"+id+"_"+i+"',0)",500*i);
		setTimeout("fadein('"+id+"',0)",500*i);
	}
}