
if (window.Event)
   document.captureEvents(Event.MOUSEUP);
document.onmouseup = checkdb;
var query = "";
var lastquery = "";
var ok = 0;
var bildurl = "";
function checkdb(e)
{
  if (window.getSelection) {
    query = window.getSelection();
      ok = 1;
  } else if (document.getSelection) {
    query = document.getSelection();
      ok = 1;
  } else if (document.selection) {
    query = document.selection.createRange().text;
      ok = 1;
  }
	query = "" + query + "";
	while(query.substring(query.length-1, query.length) == ' ')
	{
		query = query.substring(0, query.length-1);
	}
	while(query.substring(0, 1) == ' ')
	{
		query = query.substring(1, query.length);
	}
//      query = query.replace(/[ ]{1,}$/,"").replace(/^[ ]{1,}/,"");
      if(query.length < 2)
      {
      	window.status = 'Suchwörter haben eine Minimallänge von 2 Zeichen.';
      	setTimeout("window.status=''", 10000);
      	ok = 0;      	
      }
      if(query.length >= 50)
      {
      	window.status = 'Sie haben zuviel Text für unser Lexikon markiert.';
      	setTimeout("window.status=''", 10000);
      	ok = 0;      	
      }
      if(query != "" && query != lastquery && ok == 1)
      {
        lastquery = query;
        bildurl = "http://www.leximed.de/med/checkdb.pl?sid=995621Ev0ZdH&query="+query;
	document.getElementById('senda').src=bildurl;
	window.status = "Suche...";
      }
      else
      {
      if(query == lastquery){lastquery = "";}
      }
}

function timeout()
{
	setTimeout("window.status=''", 5000);
}

function zeigeintrag()
{
var newWin = "";
window.status = "";
if(query != "")
{
var url = "http://www.leximed.de/med/printdb.pl?tpl=2&sid=995621Ev0ZdH&query="+escape(query);
newWin = self.window.open(url,"Lexikon","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height=380,width=460,top=15,left=300");
}
}
self.document.writeln("<img src=\"http://www.leximed.de/med/ja.gif\" onload=\"zeigeintrag()\" onerror=\"window.status='Es konnte leider keine Beschreibung für Ihren Suchbegriff gefunden werden.';timeout();\" onabort=\"window.status='Abgebrochen'\" id=\"senda\" height=\"1\" width=\"1\" >");
var str = '';
// var str = ''; from jan
var str='';

if (window.XMLHttpRequest) {str= '<div id="dictionary" style="position:fixed; left:870px; bottom:0px; z-index:20;">';}
else {str= '<div id="dictionary" style="position:absolute; top:-200; left:-200; diplay:none; z-index:20">';}

str+='<a onmouseover="showhelp();" onmouseout="hidehelp();"><img src="http://www.leximed.de/med/templates/sbw/lex.gif" border="0" width="21" height="21"></a></div>';

if (window.XMLHttpRequest) {str+= '<div id="lexhelp" style="position:fixed; left:640px; bottom:20px; display:none; z-index:19;">';}
else {str+= '<div id="lexhelp" style="position:absolute; display:none; z-index:19">';}

str+='<table border="1" width="230" bgcolor="red"><tr><td><div style="text-align:center; vertical-align:middle; font-family:Arial,Helvetica,sans-serif; font-size:15px; font-weight:bold;">Sodbrennen-<img src="http://www.leximed.de/med/templates/hpw/lex.gif" border="0" width="21" height="21" style="vertical-align:middle">exikon</div><span style="font-family:arial,helvetica,sans-serif; font-size:13px;">Diese Website hat ein "unsichtbares" Lexikon. Verwendung: Entweder <b>doppelklicken</b> Sie auf ein Einzel-Wort oder Sie markieren Begriffe aus mehreren Wörtern mit der Maus durch <b>Anklicken und Ziehen der Maus bei gedrückt gehaltener Maustaste</b>. Ist eine Erklärung vorhanden, öffnet sich ein neues Fenster.</span></td></tr></table></div>';

document.write(str);
if (!window.XMLHttpRequest) {setInterval('IEXCorrectPosition()',50); document.all.dictionary.style.display="block";}

function showhelp(){document.getElementById('lexhelp').style.display="block";}

function hidehelp(){document.getElementById('lexhelp').style.display="none";}

function IEXCorrectPosition(){
    document.all.dictionary.style.left=870;
    document.all.dictionary.style.top=document.documentElement.offsetHeight+document.documentElement.scrollTop-24;
    document.all.lexhelp.style.left=640;
    document.all.lexhelp.style.top=document.documentElement.offsetHeight+document.documentElement.scrollTop-210;
}
