function replaceUmlaute(string, index)
	{
	var anArray = new Array(2);
	anArray[0] = new Array("Ö", "ö", "Ä", "ä", "Ü", "ü", "ß");
	anArray[1] = new Array("Oe", "oe", "Ae", "ae", "Ue", "ue", "sz");
		    
	for (var i=0; i<anArray[index].length; i++)
		{
		myRegExp = new RegExp(anArray[index][i],"g");
		string = string.replace(myRegExp, anArray[(index==0?1:0)][i]);
		}
	return string;
	}

function showStatus()
	{
	document.getElementById("itemsShop").innerHTML='<div class="dbox" style="min-height: 35em; font-size: 13px; text-align: center;"><br /><br /><br /><br /><br /><br /><br /><img src="imgz/ajax-loader.gif"><br />Produkte werden geladen</div>';	
	}

function processQuery(query, startPos)
	{
		
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
			{
			showStatus();

                        query=query.replace(/&/g, 'amper23');
			query=replaceUmlaute(query,0);
                        query=encodeURI(query,0);
			xmlHttp.open("GET", "newItems.php?query=" + query+"&start="+startPos, true);
			xmlHttp.onreadystatechange = handleServerResponse;
			xmlHttp.send(null);
			}
		else
			{
			setTimeout('processQuery()',100);
			}
		
	}
	
	
	
function handleServerResponse()	{
			
	if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 200)
				{
				xmlResponse = xmlHttp.responseXML;
				xmlMother=xmlResponse.getElementsByTagName("mother");
				
				mother = new Array;
					for (var loop = 0; loop < xmlMother.length; loop++) 
						{
						xmlFirst=xmlMother[loop];
						mother[loop]=xmlFirst.firstChild.nodeValue;
						} 
									
				document.getElementById("itemsShop").innerHTML = mother[0]; 
				}
			else
				{
				alert("Problem accessing Server: " + xmlHttp.statusText);
				}
		}
	}
	

