var editMode = false;

function openHelp(name, item, type, edit)
{
	if (isHelpServletAvailable)
	{
	 	if(helpidname != "-1") name = helpidname;
	 	if(edit==true)editMode=true;
	 	var url = fixURL("/" + CONTEXTNAME + "/HelpServlet?action=0&type="+type);
		if(name!=""){url += "&naam="+name;}
		if(item!=null){url += "&veld="+item.id}
		//if(item!=null){try{url += "&veld="+document.getElementById("l"+item.id).innerHTML;}catch(e){}}
		url += "&editMode="+edit;
		processXMLDoc(url, "openHelpWindow", true);
	}
	return false;
}

function openHelpWindow(xmlDoc)
{

	var modeTag		= getTag("mode",xmlDoc);
	var modeHelp	= modeTag.firstChild.nodeValue;

	var posLeftTag 	= getTag("posLeft",xmlDoc);
	var posTopTag 	= getTag("posTop",xmlDoc);
	var posLeft 	= parseInt(posLeftTag.firstChild.nodeValue);
	var posTop 		= parseInt(posTopTag.firstChild.nodeValue);

	var heightTag 	= getTag("height",xmlDoc);
	var widthTag 	= getTag("width",xmlDoc);
	var height 		= parseInt(heightTag.firstChild.nodeValue);
	var width 		= parseInt(widthTag.firstChild.nodeValue);

	var typeTag 	= getTag("type",xmlDoc);
	var naamTag 	= getTag("naam", xmlDoc);
	var veldTag		= getTag("veld", xmlDoc);

	if(typeTag.firstChild)
	var type		= typeTag.firstChild.nodeValue;
	else var type	= "";

	if(naamTag.firstChild)
	var naam		= naamTag.firstChild.nodeValue;
	else var naam	= "";

	if(veldTag.firstChild)
	var veld		= veldTag.firstChild.nodeValue;
	else var veld	= "";

	var pathTag		= getTag("pad", xmlDoc);
	var path		= pathTag.firstChild.nodeValue;
	var adminTag		= getTag("admin", xmlDoc);
	var admin		= adminTag.firstChild.nodeValue;

	var vArguments 	= [];

	var parentLeft 	= window.screenLeft;
	var parentTop 	= window.screenTop;
	var top 		= parentTop + posTop;
	var left 		= parentLeft + posLeft;
	vArguments[0]  	= window;
	vArguments[1]  	= modeHelp;
	vArguments[2]  	= top;
	vArguments[3]  	= "HelpServlet";
	vArguments[4]  	= height;
	vArguments[5]  	= width;
	vArguments[6]  	= parentTop;
	vArguments[7]  	= parentLeft;
	vArguments[8]  	= type;
	vArguments[9]  	= naam;
	vArguments[10] 	= veld;
	vArguments[11] 	= editMode;
	vArguments[12] 	= path;
	vArguments[13] 	= document.body.clientHeight+50;
	vArguments[14] 	= document.body.clientWidth+10;
	vArguments[15] 	= left;

	var resize 		= "no";
	if(admin=="true")
	resize = "yes";
		
	try
	{
		window.showModalDialog(fixURL("/" + CONTEXTNAME + "/jsp/atsc/UIHelp_dialog.jsp"), vArguments,"edge: Raised; center: no; help: No; resizable: "+resize+"; status: No; scroll: No; dialogWidth:"+width+"px; dialogHeight:"+ height+ "px; dialogTop:"+top+"px; dialogLeft:"+left+ "px; ");
	}
	catch (e) {alert("Een popup-blocker blokkeert het helpscherm");}
	
	
}