var modelessPopup;
var nowOpen			=null;
var nowOpenStatus	=null;
var ttype=null;
function openNode(num,normal,t)
{
	focusNode(num);
	if(nowOpen==num){
		document.all("img"+num).src="images/close_"+nowOpenStatus+".gif";
		document.all("div"+num).style.display="none";
		nowOpen			=null;
		nowOpenStatus	=null;
		return;
	}
	if(nowOpen!=null){
		document.all("img"+nowOpen).src="images/close_"+nowOpenStatus+".gif";
		document.all("div"+nowOpen).style.display="none";			
	}
	document.all("img"+num).src="images/open_"+normal+".gif";
	document.all("div"+num).style.display="inline";
	nowOpen			=num;
	nowOpenStatus	=normal;
	if(document.all("div"+num).innerHTML==""){
		document.all("div"+num).innerHTML="<img align='absmiddle' src='images/line_v.gif'><b class='blank'></b><img align='absmiddle' src='images/none_end.gif'><font color=red style='font-size:9pt'> Loading...</font><br>";
	}
	
}

var nowFocus=null;
function SetRichLink(obj){
	try{
		obj.style.borderWidth="1px";
		obj.style.borderStyle="solid";
		obj.style.borderColor="#efefef";
		obj.style.backgroundColor="silver";
		obj.blur();
	}catch(e){}
}
function ClearRichLink(obj){
	try{
		obj.style.borderWidth="0px";
		obj.style.backgroundColor="";
	}catch(e){}
}
function focusNode(num)
{
	if(document.all("link"+nowFocus))
	{
		ClearRichLink(document.all("link"+nowFocus));
	}
	nowFocus=num;
	SetRichLink(document.all("link"+num));
}	

function popup(url,width,height)
{
	var centered;
	x = (screen.availWidth - width) / 2;
	y = (screen.availHeight - height) / 2;
	centered =',width=' + width + ',height=' + height + ',left=' + x + ',top=' + y + ',scrollbars=yes,resizable=yes,status=yes';
	var popup = window.open(url, '_blank', centered);
    	if (!popup.opener) popup.opener = self;
	popup.focus();
}

function showModelessPopup(url, width, height)
{
	var centered;
	x = (screen.availWidth - width) / 2;
	y = (screen.availHeight - height) / 2;
	centered =',width=' + width + ',height=' + height + ',left=' + x + ',top=' + y + ',scrollbars=yes,resizable=yes,status=yes';
	modelessPopup = window.open(url, 'modelessPopup', centered);
	
	window.onfocus=focusModelessPopup;
	
    if (!modelessPopup.opener) modelessPopup.opener = self;    
	modelessPopup.focus();
}

 function focusModelessPopup()
 {
  	if(eval(modelessPopup))
  	{
  		modelessPopup.focus();
  	}
  }

function confirm_action(url, message)
{
	if (confirm(message))
	{
		window.location=url
	}
}

function get_object(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name);
 	}
 	else if (document.all)
	{
  		return document.all[name];
 	}
 	else if (document.layers)
	{
  		return document.layers[name];
	}
	return false;
}

function check_checkbox(id)
{
	if(check_box = get_object(id))
	{
		if (!check_box.disabled)
		{
			check_box.checked = !check_box.checked;
			if (check_box.onclick)
			{
				check_box.onclick();
			}
		}
	}
}

function select_radio(id)
{
	if(radio_but = get_object(id))
	{
		radio_but.checked = true;
		if (radio_but.onclick)
		{
			radio_but.onclick();
		}
	}
}


function getSelected(opt) 
{
	var selected = new Array();
	var index = 0;
	for (var i=0; i<opt.length;i++) 
	{
		if ((opt[i].selected) || (opt[i].checked)) 
		{
			index = selected.length;
			selected[index] = new Object;
			selected[index].value = opt[i].value;
			selected[index].index = i;
		}
	}
	return selected;
}


function copy_clip(copytext)
{

 	 if (window.clipboardData) 
   {
   
   // the IE-manier
   window.clipboardData.setData("Text", copytext);
   
   // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
   // het is mij echter onbekend vanaf welke versie dit precies werkt:
   }
   else if (window.netscape) 
   { 
   
   // dit is belangrijk maar staat nergens duidelijk vermeld:
   // you have to sign the code to enable this, or see notes below 
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
   
   // maak een interface naar het clipboard
   var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
   if (!clip) return;
   
   // maak een transferable
   var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
   if (!trans) return;
   
   // specificeer wat voor soort data we op willen halen; text in dit geval
   trans.addDataFlavor('text/unicode');
   
   // om de data uit de transferable te halen hebben we 2 nieuwe objecten nodig   om het in op te slaan
   var str = new Object();
   var len = new Object();
   
   var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
   
   var copytext=copytext;
   
   str.data=copytext;
   
   trans.setTransferData("text/unicode",str,copytext.length*2);
   
   var clipid=Components.interfaces.nsIClipboard;
   
   if (!clip) return false;
   
   clip.setData(trans,null,clipid.kGlobalClipboard);
   
   }
   return false;
}