// JavaScript Document
var theApp = navigator.appName.toLowerCase();
var UA = navigator.userAgent.toLowerCase();
var isIE = (UA.indexOf('msie') >= 0) ? true : false;
var isNS = (UA.indexOf('mozilla') >= 0) ? true : false;
var isOP = (UA.indexOf('opera') >= 0) ? true : false;
var isSAF = (UA.indexOf('safari') >= 0) ? true : false;
if (UA.indexOf('compatible')>0){
isNS = false;
}

function insertImg(imgName)
{
	parent.thisEditor.control.contentWindow.document.execCommand("insertimage", false, imgName);	
	closeDialog();
	//parent.document.thisEditor=null;
}

function popup(title, url, height, width, inline)
{
	aDiv=inline;
	if(!inline)
	{
		//if (isIE) 
		//{
		//	var features = "unadorned:yes;resizable: no;scroll: no;status:no;center:yes;help:no;dialogWidth:"
		//		+ width + "px;dialogHeight:" + height + "px;";
		//	window.showModalDialog(url, window, features);
		//} 
		//else 
		//{
			modal = "no";
			
			var win = window.open(url, "impPopup", "top=100,left=100,scrollbars=no,dialog=no,minimizable=no,modal=no,width=" + width + ",height=" + height + ",resizable=no");
			if (win == null) 
			{
				alert("Uw browser is ingesteld om GEEN popups weer te geven.");
				return;
			}
			eval('try { win.resizeTo(width, height); } catch(e) { }');
			win.focus();
		//} 
	}
	else 
	{
		var div = document.createElement("div");
		var id = "impPopup";
		height += 30;
		div.id = id;
		div.className = "dialog";
		div.style.width = width + "px";
		div.style.height = height + "px";
		var html = '<div class="dialogHeader"><div class="dialogTitle">'+title+'</div><div class="dialogClose"><a href="javascript:closeDialog();"></a></div></div>';
		html += '<div id="' + id + 'IFrameWrapper" class="dialogIFrameWrapper"><iframe border="0" marginwidth="0" marginheight="0" frameborder="0" hspace="0" vspace="0" src="' + url + '" width="' + width + '" height="' + height + '"></iframe></div>';
		div.innerHTML = html;
		document.body.appendChild(div);
	}
}

function closeDialog()
{
		var div = parent.document.getElementById("impPopup");
		if (div)
			div.parentNode.removeChild(div);
	    else
		{
				window.close();
		}
}