var xmlHttp;

function showResult(str) {
	if (str.length<=2) { 
		document.getElementById("livesearch_oben").
		innerHTML="";
		document.getElementById("livesearch_oben").
		style.border="0px";

		if (blend_in == "ja") {
			$('div.livesearch_oben').css('opacity',0);
			var blend_in = "nein";
		}

		return;
	} 

	var blend_in = "ja";
	$('div.livesearch_oben').css('opacity',0);
	$('div.livesearch_oben').fadeTo(prettyPhoto.options['animationSpeed'],1, function(){
		$('div.livesearch_oben').fadeTo(prettyPhoto.options['animationSpeed'],1,function(){
			// To fix an IE bug
			$('div.livesearch_oben').attr('style','left:'+$('div.livesearch_oben').css('left')+';top:'+$('div.livesearch_oben').css('top')+';');
		});
	});


	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	} 


	var url="../search/livesearch_oben.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("livesearch_oben").
		innerHTML=xmlHttp.responseText;
		document.getElementById("livesearch_oben").
		style.border="0px";
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
