/*
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Bitflux GmbH                                      |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the "License");      |
// | you may not use this file except in compliance with the License.     |
// | You may obtain a copy of the License at                              |
// | http://www.apache.org/licenses/LICENSE-2.0                           |
// | Unless required by applicable law or agreed to in writing, software  |
// | distributed under the License is distributed on an "AS IS" BASIS,    |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      |
// | implied. See the License for the specific language governing         |
// | permissions and limitations under the License.                       |
// +----------------------------------------------------------------------+
// | Author: Bitflux GmbH <devel@bitflux.ch>                              |
// +----------------------------------------------------------------------+

*/

//Änderungen zum Original: stark gekürzt

var liveSearchReq = false;
var t = null;
var liveSearchLast = "";
function liveSearchStartExt() { liveSearchStart()};


function liveSearchHideDelayed() {
  window.setTimeout("liveSearchHide()",400);
}

function liveSearchHide() {
	document.getElementById("LSResult").style.display = "none";
	var hm = document.getElementById("hidemely1");
	if (hm != null) {hm.style.visibility = "visible"};
	var hm = document.getElementById("cgiad");
	if (hm != null) {hm.style.visibility = "visible"};
}

function liveSearchStart() {
        if (t) {
		window.clearTimeout(t);
	}
	t = window.setTimeout("liveSearchDoSearch()",0); // vorher 200
}

function liveSearchDoSearch() {
        if (liveSearchLast != document.forms.megasuche.search.value) {
	if (liveSearchReq && liveSearchReq.readyState < 4) {
		liveSearchReq.abort();
	}
	if ( document.forms.megasuche.search.value == "") {
		liveSearchHide();
		return false;
	}
//	if (window.XMLHttpRequest) {
//	// branch for IE/Windows ActiveX version
//	  liveSearchReq = new XMLHttpRequest();
//	} else if (window.ActiveXObject) {
//          liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
//	}

  try{
    liveSearchReq=new ActiveXObject("Msxml2.XMLHTTP")
  }catch(e){
    try{
      liveSearchReq=new ActiveXObject("Microsoft.XMLHTTP")
    } catch(oc){
      liveSearchReq=null
    }
  }
  if(!liveSearchReq && typeof XMLHttpRequest != "undefined") {
    liveSearchReq=new XMLHttpRequest()
  }
  if(!liveSearchReq) {return}

		var  res = document.getElementById("LSResult");
                var search = escape(document.forms.megasuche.search.value);
                search = search.replace(/\+/g, "%2b");
		res.style.display = "block";
		res.innerHTML = '<iframe frameborder="0" height=290 src="http://boersede.ariva.de/parts/livesearch.m?searchname=' + search +'"></iframe>'

}
}

function liveSearchProcessReqChange() {

	if (liveSearchReq.readyState == 4) {
	        var hm = document.getElementById("hidemely1");
		if (hm != null) {hm.style.visibility = "hidden"};
	        var hm = document.getElementById("cgiad");
		if (hm != null) {hm.style.visibility = "hidden"};
		var  res = document.getElementById("LSResult");
		res.style.display = "block";
		res.innerHTML = '<table border="0" cellspacing="0" cellpadding="0" bgcolor="#eeeeee"><tr><td class="arhead" colspan="2"><b>Suchhilfe</b></td></tr>' + liveSearchReq.responseText;
		window.status = "Fertig";
	}
}

