	function to_char(str) {
		res = "";
		nummer = "";
		replace = false;

		for (i = 0; i < str.length; i++) {
			if (str.charAt(i) == '|' && str.charAt(i+1) == '|') {
				if (replace) { replace = false; } else { replace = true; }
				if (nummer.length > 0) {
					res += String.fromCharCode(nummer);
				}
				nummer = "";
				i+=2;
			}
			if (replace) {
				if (str.charAt(i) != '|') {
					nummer += str.charAt(i);
				} else {
					res += String.fromCharCode(nummer);
					nummer = "";
				}
			} else {
				res += str.charAt(i);
			}
		}

		return res;
	}

	subject_id = '';
	function handleHttpResponse() {
		if (http.readyState == 4) {
			if (subject_id != '') {
				document.getElementById(subject_id).innerHTML = to_char(http.responseText);
				if (http.responseText != "")
					box('1');
				else
					box('0');
			}
		}
	}
	function getHTTPObject() {
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (E) {
					xmlhttp = false;
				}
			}
		@else
		xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}
	var http = getHTTPObject(); // We create the HTTP Object

	function getScriptPage(div_id,content_id)
	{
		subject_id = div_id;
		content = document.getElementById(content_id).value;
		http.open("GET", "script_page.php?content=" + escape(content), true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);
		//if(content.length>0)
		//	box('1');
		//else
		//	box('0');

	}	

	function highlight(action,id)
	{
	  if(action)	
		document.getElementById('word'+id).bgColor = "#C2B8F5";
	  else
		document.getElementById('word'+id).bgColor = "#F8F8F8";
	}
	function display(word)
	{
		document.getElementById('text_content').value = word;
		document.getElementById('box').style.display = 'none';
		document.getElementById('text_content').focus();
	}
	function box(act)
	{
	  if(act=='0')	
	  {
		document.getElementById('box').style.display = 'none';

	  }
	  else {
		document.getElementById('box').style.display = '';
		aryPosition = ObjectPosition(document.getElementById('zoekstring'));
		document.getElementById('box').style.width = 175;
		document.getElementById('box').style.left = aryPosition[0]-30;
		document.getElementById('box').style.top = aryPosition[1]+30;
	  }
	}
	
	function ObjectPosition(obj) {
    var curleft = 0;
      var curtop = 0;
      if (obj.offsetParent) {
            do {
                  curleft += obj.offsetLeft;
                  curtop += obj.offsetTop;
            } while (obj = obj.offsetParent);
      }
      return [curleft,curtop];
    }

    function lw_closeAllLayers() {
       box('0');
    }

    document.onclick = lw_closeAllLayers;
