/* 
Create the new window 
*/ 
function openInNewWindow() 
{ 
	// Change "_blank" to something like "newWindow" to load all links in the same new window 
	var newWindow = window.open(this.getAttribute('href'), '_blank'); 
	newWindow.focus(this.getAttribute('href')); 
	return false; 
} 
function openInNewWindowMapLayer()
{
	// Change "_blank" to something like "newWindow" to load all links in the same new window 
	showMapLayer(this.getAttribute('href'));
	return false; 
}

/* 
Add the openInNewWindow function to the onclick event of links with a class name of "non-html" 
*/ 
function getNewWindowLinksNetWriter() { 
    LanguageIdLocal=1
    try
    {
    LanguageIdLocal=languageId;
    }
    catch(e)
    {
    }
	// Check that the browser is DOM compliant 
	if (window.document.getElementById	&& window.document.createElement && window.document.appendChild) 
	{ 

		// Change this to the text you want	to use to alert	the	user that a	new	window will	be opened 
		var	strNewWindowAlertBlank =	" (opent in een nieuw venster)";	
		if (LanguageIdLocal)
		{
			if(LanguageIdLocal==2)
			{
				strNewWindowAlertBlank =	" (opens in a new window)";	
			}
		}
		var	strNewWindowAlertPopup=	" (opent als popup)";	
		if (LanguageIdLocal)
		{
			if(LanguageIdLocal==2)
			{
				strNewWindowAlertPopup =	" (opens as popup)";	
			}
		}
		
		// Find	all	links 
		var	objWarningText;	
		var	strWarningText;	
		var strClassName
		var	link; 
		var	links =	window.document.getElementsByTagName('a');	
		for	(var i = 0;	i <	links.length; i++) { 
			link = links[i]; 
			
			// Find	all	links with a class name	of "non-html" 
			
			if (link.className.indexOf("nwbeh-newwnd")>-1 || link.className.indexOf("nwbeh-mappopup")>-1){
			
			// Create an em	element.
			objWarningText = document.createElement("em"); 
			//Add a class to the em element which will give it an backgroundimage indicating the popup or new window.
			//Add the new window warning text to the element and insert it after the linktext 
			if (link.className.indexOf("nwbeh-newwnd")>-1) 
			{
				strWarningText = document.createTextNode(strNewWindowAlertBlank);
				strClassName = " widow_icon";
			}
			else
			{
				strWarningText = document.createTextNode(strNewWindowAlertPopup);
				strClassName = " popup_icon";
			}
			objWarningText.className = strClassName;
			objWarningText.appendChild(strWarningText);
			link.appendChild(objWarningText);
			if (link.className.indexOf("nwbeh-newwnd")>-1)
			{
				link.onclick = openInNewWindow;
			}
			else
			{
					link.onclick = openInNewWindowMapLayer;
			}
			
		} 
	}	 
		objWarningText = null; 
	}	 
} 
getNewWindowLinksNetWriter();
