function ErrorHandler(e){
	alert(e);
	return true;
}
var expandedcats = new Array();
var cmd = null;

function init(){
	cmd = document.getElementById('cmd');
	document.title="Lokaalnieuws.net";
}




try{




function ToggleDisplay(butt,items,cid) {
	
	
	var oButton = document.getElementById(butt);
	var oItems = document.getElementById(items);
	if (!oButton || !oItems){ return 0;}

	if (oItems.style.display == "none") {
		
		if (cid){
			if (cid >=0){
				if (cmd){
					cmd.src= '/navinfo.php?act=cat&item='+cid+'&exp=1&time='+randNum(10000);
				}
				
				//var t = expandedcats.length;
				//t++;
				//expandedcats[t] = cid;
			}
		}
		
		//alert(expandedcats[0]);
		oItems.style.display = "";
		oButton.src = "/tree/minus.gif";

		
	}else {
		
		if (cid){
			if (cid >=0){
				if (cmd){
					cmd.src= '/navinfo.php?act=cat&item='+cid+'&exp=0&time='+randNum(10000);
				}
				
				/*
				var tmp = new Array();
				var t = 0;
				//alert('close');
				for (tel=0; tel < expandedcats.length; tel++){
					if (parseInt(expandedcats[tel]) != parseInt(cid)){
						//alert(expandedcats[tel])
						//alert(cid);
						if (!isNaN(expandedcats[tel])){
							
							tmp[t] = expandedcats[tel];
							//alert(tmp[t] + '\n' + t);
							t++;
						}
						
					}
	
				}
				expandedcats = new Array();
				expandedcats = tmp;
				*/
			}
		}
		
		oItems.style.display = "none";
		oButton.src = "/tree/plus.gif";
	}
	

	
	

	return false;
}

function setFeed(chbox){
	//alert(chbox.value);
	if (chbox.checked){
		openFeed(chbox.value,0);
	}else{
		closeFeed(chbox.value,0);
	}
}

function closeFeed(fid,where){
	if (where == 1){
		var chk = document.getElementById("chkfeed" + fid);
		if (chk){chk.checked = false;}
		
		
	}
	
	var tmp = "feedtable" + fid;
	var table = document.getElementById(tmp);
	if (table){
		HideDisplay(table);
	}
	//alert(fid);
	//return false;
	if (cmd){
		cmd.src = '/navinfo.php?act=feed&item='+fid+'&hide=1&time='+randNum(10000);
	}
}

function openFeed(fid,where){
	var tmp = "feedtable" + fid;
	var table = document.getElementById(tmp);
	if (table){
		ShowDisplay(table);
	}
	
	if (cmd){

		
		cmd.src = '/navinfo.php?act=feed&item='+fid+'&hide=0&time='+randNum(10000);
	}
}



function HideDisplay(oItems) {
	oItems.style.display = "none";

}

function ShowDisplay(oItems) {
	oItems.style.display = "";
}

function getExpanded(obj){

	var str = "";

	for (tel=0; tel < expandedcats.length; tel++){
		if (parseInt(expandedcats[tel]) >=0){
			if(str!=''){str += ';'}
				str += expandedcats[tel];
			}

		}

		obj.href += '?exp='+ str;
	
}

   function randNum (num) {
    var now = new Date();                                
    var rand = Math.round(num * Math.cos(now.getTime())); 
    if (rand < 0) rand = - rand; if (rand == 0) rand++;      
    return rand;                                          
    }



}catch(e){
	//alert(e);
}