function initXmlHttp()
{
	var xmlHttp=null;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function loadData($query, $target)
{
	var xmlHttp = initXmlHttp();
	xmlHttp.open('POST', '/modules/text_dictionary/dictionary_serverside.php', true);
	xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlHttp.send($query);
	if($list = true)
	{
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4)
			{
				window.document.getElementById($target).innerHTML = xmlHttp.responseText;
			}
		}
	}
}

function markText()
{
	for($pass = 1; $pass < window.document.getElementsByTagName('div').length; $pass++)
	{
		if(window.document.getElementsByTagName('div')[$pass].className == 'text_dic')
		{ window.document.getElementsByTagName('div')[$pass].className = 'text_dic_marked'; }
	}
	window.document.getElementById('dictionaryfunctions').innerHTML = '<a onclick=\"unMarkText();\">D&ouml;lj ord med f&ouml;rklaring</a>';
}

function unMarkText()
{
	for($pass = 1; $pass < window.document.getElementsByTagName('div').length; $pass++)
	{
		if(window.document.getElementsByTagName('div')[$pass].className == 'text_dic_marked')
		{ window.document.getElementsByTagName('div')[$pass].className = 'text_dic'; }
	}
	window.document.getElementById('dictionaryfunctions').innerHTML = '<a onclick=\"markText();\">Visa ord med f&ouml;rklaring</a>';
}