
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
if(document.layers){str='<LAYER ID=Dictionary VISIBILITY=hide top=-100 left=-100><A HREF="#" ID=Nada onMouseOver="showhelp()" onMouseOut="hidehelp()"><IMG SRC="http://www.leximed.de/med/templates/notfall-verhuetung/lex.gif" BORDER=0 WIDTH=21 HEIGHT=21></A></LAYER>'}
else if(document.all){str='<DIV ID=Dictionary STYLE="position:absolute;top:-200;left:-100;visibility:hidden"><A ID=Nada onMouseOver="showhelp()" onMouseOut="hidehelp()"><IMG SRC="http://www.leximed.de/med/templates/notfall-verhuetung/lex.gif" BORDER=0 WIDTH=21 HEIGHT=21></A></DIV>'}

if(document.layers){str+='<LAYER ID=lexhelp VISIBILITY=hide><TABLE BORDER=1 WIDTH=230 BGCOLOR=#ff9933><TR><TD><SPAN STYLE="font-family:Arial,Helvetica,sans-serif; font-size:11pt; font-weight:bold; color:white;">Lexikon Notfall-Verh&uuml;tung</SPAN><BR><SPAN STYLE="font-family:Arial,Helvetica,sans-serif; font-size:9pt; color:#666666;">Diese Website hat ein "unsichtbares" Lexikon. Verwendung: Entweder <B>doppelklicken</B> Sie auf ein Einzel-Wort oder Sie markieren Begriffe aus mehreren W&ouml;rtern mit der Maus durch <B>Anklicken und Ziehen der Maus bei gedr&uuml;ckt gehaltener Maustaste</B>. Ist eine Erkl&auml;rung vorhanden, &ouml;ffnet sich ein neues Fenster.</SPAN></TD></TR></TABLE></LAYER>'}
else if(document.all){str+='<DIV ID=lexhelp STYLE="position:absolute;visibility:hidden"><TABLE BORDER=1 WIDTH=230 BGCOLOR=#ff9933><TR><TD><SPAN STYLE="font-family:Arial,Helvetica,sans-serif; font-size:11pt; font-weight:bold; color:white;">Lexikon Notfall-Verh&uuml;tung</SPAN><BR><SPAN STYLE="font-family:Arial,Helvetica,sans-serif; font-size:9pt; color:#666666;">Diese Website hat ein "unsichtbares" Lexikon. Verwendung: Entweder <B>doppelklicken</B> Sie auf ein Einzel-Wort oder Sie markieren Begriffe aus mehreren W&ouml;rtern mit der Maus durch <B>Anklicken und Ziehen der Maus bei gedr&uuml;ckt gehaltener Maustaste</B>. Ist eine Erkl&auml;rung vorhanden, &ouml;ffnet sich ein neues Fenster.</SPAN></TD></TR></TABLE></DIV>'}

document.write(str);
setInterval('NachFuehren()',100);
if(document.layers){document.layers['Dictionary'].visibility="show"}
else if(document.all){document.all['Dictionary'].style.visibility="visible"}

function showhelp(){
  if(document.layers){document.layers['lexhelp'].visibility="show"}
  else if(document.all){document.all['lexhelp'].style.visibility="visible"}}

function hidehelp(){
  if(document.layers){document.layers['lexhelp'].visibility="hide"}
  else if(document.all){document.all['lexhelp'].style.visibility="hidden"}}

function NachFuehren(){
  if(document.layers){
    document.layers['Dictionary'].left=window.innerWidth+pageXOffset-42;
    document.layers['Dictionary'].top=window.innerHeight+pageYOffset-26;
    document.layers['lexhelp'].left=window.innerWidth+pageXOffset-280;
    document.layers['lexhelp'].top=window.innerHeight+pageYOffset-196;}
  else if(document.all && document.all.Dictionary.style){
    document.all.Dictionary.style.left=document.body.offsetWidth+document.body.scrollLeft-42;
    document.all.Dictionary.style.top=document.body.offsetHeight+document.body.scrollTop-26;
    document.all.lexhelp.style.left=document.body.offsetWidth+document.body.scrollLeft-280;
    document.all.lexhelp.style.top=document.body.offsetHeight+document.body.scrollTop-196;}
}

