// $Id: zeit.js,v 1.1 2000/10/18 17:26:36 thomas Exp $
// xipolis.net GmbH & Co. KG 
// Klick & Search with Mr. Check - a xipolis.net-Feature
// maintained by Thomas Nitsche <thomas.nitsche@xipolis.net>
// Copyright (c) 2000 by xipolis.net 

// use:
// <script language="JavaScript1.2" src="http://mr-check.xipolis.net/clients/zeit.js"></script>

// This is a generated file!  Do not edit.

var mrCheckPattern = "";
var mrCheckUrl = "http://mr-check.xipolis.net/Mrcheck.php";
var mrCheckClient = "zeit";
var mrCheckClientLogo = "http://mr-check.xipolis.net/pic/mrcheck_xt.gif";
var mrCheckClientLogoProps = 'width="63" height="67"';
var mrCheckCheck = 0;
var mrCheckTitle = "mrCheckAtZeit";
var mrCheckWin;

// mrCheck only with Browsers Version 4 and above
if (((navigator.appName == "Microsoft Internet Explorer")
     || navigator.appName == "Netscape") 
     && parseInt(navigator.appVersion) >= 4) {

   mrCheckCheck = 1;
   var mrCheckWhitespace = new RegExp('([ \\n\\t\\v\\r\\f]|%0D|%0A|%20)+', 'g');
}

// parse all browser windows for a text selection.
function mrCheckFindSelection (w)
{
   var pattern;
   var TextRange;
   if (navigator.appName == "Netscape") {
      pattern = escape(w.document.getSelection());
      pattern = pattern.replace (mrCheckWhitespace,"%20");
   } else if ( navigator.appName == "Microsoft Internet Explorer") {
      if (navigator.platform == "MacPPC"){
         pattern = w.document.getSelection();
      } else if (w.document.selection.type == "Text") {
         TextRange = w.document.selection.createRange();
         pattern = TextRange.text;
      }
   }
   if (pattern) { 
      return (pattern);
   }
//   for (var i=0; i<w.frames.length; i++) {
 //     pattern = mrCheckFindSelection (w.frames[i]);
//      if (pattern) { 
//         return (pattern);
//      }
//   }
   return "";
}

function mrCheckGetSelection()
{
	mrCheckPattern = mrCheckFindSelection(window.top);
	if (mrCheckPattern.length > 0) {
		window.top.status = 'Status: click the button to search "' + unescape(mrCheckPattern) + '"';
	} else {
		window.top.status = 'Status: Mr. Check is waiting ...';
	}
	return true;
}

// onMouseOut-Message
function mrCheckOnOut() {
	window.top.status = "Status: Mr. Check is ready";
	return true;
}

// run Query against Database and start a new window
function mrCheckStartQuery() 
{	
	if (mrCheckPattern.length > 0) {
		url = mrCheckUrl + '?SP=' + mrCheckPattern + '&CL=' + mrCheckClient;
		if (!mrCheckWin || mrCheckWin.closed) {
			mrCheckWin = window.open (url,mrCheckTitle,'height=320,width=270,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0');
		}
		else {
			mrCheckWin.location.href = url;
			mrCheckWin.focus();
		}
	} else {
		alert ("Sie m"+"\u00FC"+"ssen zuerst ein Wort markieren und\nanschlie"+"\u00DF"+"end den Mr.-Check-Button anklicken.\nWeitere Infos unter www.mrcheck.de");
	}
	return false;
}

// Print mrCheck-Button
if (mrCheckCheck) {
   document.write ('<a href="' + mrCheckUrl + '" onMouseOver="return mrCheckGetSelection();" onMouseOut="return mrCheckOnOut();" onClick="return mrCheckStartQuery();"><img src="' + mrCheckClientLogo + '" ' + mrCheckClientLogoProps +' border="0" alt="Mr. Check"></a>');
}

