function showToolTip(e,text){
	if(document.all)e = event;
	
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = text;
	obj.style.display = 'block';
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = e.clientX - 100;
	if(leftPos<0)leftPos = 0;
	obj.style.left = leftPos + 'px';
	obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
}	

function hideToolTip()
{
	document.getElementById('bubble_tooltip').style.display = 'none';
	
}


	function toggledisplay (id){
	  if (document.getElementById) {
		var mydiv = document.getElementById(id);
		mydiv.style.display = (mydiv.style.display=='block'?'none':'block');
	  }
	}
	
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

var xmlHttp = null;
var global_search_words = "";
var global_suggestion = "";

// XMLHTTPRequest-Object instanzieren
function getSuggestion(search_words) {
	search_words = search_words.replace(/ü/, "unduuml");
	search_words = search_words.replace(/Ü/, "unduuml");
	search_words = search_words.replace(/ä/, "undauml");
	search_words = search_words.replace(/Ä/, "undauml");
	search_words = search_words.replace(/ö/, "undouml");
	search_words = search_words.replace(/Ö/, "undouml");
	search_words = search_words.replace(/ß/, "undszet");
	search_words = escape(search_words);
				

	if (search_words.length	< 3){
		document.getElementById('sug_output').style.visibility = "hidden"; 
	}

	if (search_words.length	>= 3){
		global_search_words = search_words;
		document.suchwort.sug_keywords.focus();
		if (window.ActiveXObject) {
			try {
				// für die neueren IE Browser
				xmlHttp= new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
				// für die älteren IE Browser
					xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
				}
			}
		} else if (window.XMLHttpRequest) {
			try {
				// für alle anderen Browser
				xmlHttp= new XMLHttpRequest();
			} catch (e) {
			}
		}
		// falls AJAX unterstützt wird
		if (xmlHttp) {
			// Senden des Suchbegriffs an die PHP-Datei
			xmlHttp.open('GET', './suggest.php5?q=' + search_words , true);
			xmlHttp.onreadystatechange = doSuggest;
			xmlHttp.send(null);
		}
	}
}
var suggest_text = '';
var suggest_array = new Array();

function doSuggest() {
	var decoded = "";
	// readyState == 4 -> Kommunikation mit Server abgeschlossen
	if (xmlHttp.readyState == 4) {
		suggest_text = xmlHttp.responseText;
		global_suggestion = suggest_text;
		
//		suggest_text = decode_utf8( suggest_text );
		
		if (suggest_text != "") {
			decoded += "&nbsp;<i>Suchvorschläge:</i>";
			decoded += "<br><br>";
			decoded += suggest_text;
			decoded += "&nbsp;";			
			document.getElementById('sug_output').innerHTML = decoded;
		}
		if (decoded != "") {
			document.getElementById('sug_output').style.visibility = "visible";
		} else {
			document.getElementById('sug_output').style.visibility = "hidden";        
		}
	}
}
function hideSuggestion(){
	document.getElementById('sug_output').style.visibility = 'hidden';
}
function showSuggestion(SearchValue){
	if (SearchValue.length	>= 3 && global_suggestion != ""){
		document.getElementById('sug_output').style.visibility = 'visible';
	}
}
