var ajax = new sack();

function showList(id)
{
	if (document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "block";
	else
		document.getElementById(id).style.display = "none";
}

function build_inv()
{
	document.getElementById("investigation_list").innerHTML = "";
	var lilist = document.getElementById("investigation_list");
	var list = new Array();
	eval(ajax.response);
	var ul = document.createElement("UL");
	lilist.appendChild(ul);
	var inp,li,t;
	for (i=0; i<list.length; i++)
	{
		inp = document.createElement("input");
		inp.type = "checkbox";
		inp.name = "investigatie[]";
		inp.value = list[i][0];
		
		t = document.createTextNode(list[i][1]);
		
		li =document.createElement("li");
		ul.appendChild(li);
		li.appendChild(inp);
		li.appendChild(t);
	}
}

function build_serv()
{
	var s_serv = document.getElementById("subservice");
	var list = new Array();
	//alert(ajax.response);
	eval(ajax.response);
	for (i=0; i<list.length; i++)
	{
		var o = document.createElement("option");
		o.value = list[i][0];
		o.text = list[i][1];
		 try {
			s_serv.add(o, null); // standards compliant; doesn't work in IE
		  }
		  catch(ex) {
			s_serv.add(o); // IE only
		  };
	}
}

function centerchange(obj)
{
	if (obj.selectedIndex != 0)
	{
		ajax.requestFile = 'ajax.php?mode=getinv&id='+obj[obj.selectedIndex].value;
		ajax.onCompletion = build_inv;
		ajax.runAJAX();	
	}
	else
	{
		document.getElementById("investigation_list").innerHTML = "-";
	}
}




// bookmark
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

