var http = null;
if(window.XMLHttpRequest)
{
	http = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
	try
	{
		http = new ActiveXObject('Msxml2.XMLHTTP.5.0');
	}
	catch(ex)
	{
		try
		{
			http = new ActiveXObject('Microsoft.XMLHTTP');
		}
		catch(ex)
		{
			alert('Anderen Browser als IE benutzen. Sonst kein AJAX!');
		}
	}
}
else
{
	alert('ActiveX zulassen. Sonst kein AJAX!');
}
/*
@description:	sends an asynchron request to the server without refreshing the page
@return: 		void
*/
function changeStreet()	{
	try	{
		var plzId = this.document.forms['shop'].elements['plz'][this.document.forms['shop'].elements['plz'].selectedIndex].value;
		http.open('get', './php/changeStreet.php?plz=' + plzId);
		// get delegate from function and not invoking it with "()"
		http.onreadystatechange = getResponseStreet;
		http.send(null);
	} catch(ex)	{
		alert('Error in function changeStreet(): '
			+ '\nmessage: ' + ex.message 
			+ '\nname: ' + ex.name 
			+ '\nnumber: ' + ex.number
			+ '\ndescription: ' + ex.description);
	}
} // end function changeRegion()

/*
@description:	checks for the return result from the server call from function changeStreet(), changes a div-elements innerHTML 
@return: 		void
*/
function getResponseStreet()	{
	try	{
		var result = '';
		var myAlert = '';
		if(http.readyState == 4)	{
			//alert('Test: ' + http.responseText);
			result = http.responseText;
			// alert(document.getElementById('strasse').innerHTML);
			document.getElementById('strasse').innerHTML = result;
			// alert(document.getElementById('strasse').innerHTML);
		}
	} catch(ex)	{
		alert('Error in function getResponseStreet()' 
			+ '\nmessage: ' + ex.message 
			+ '\nname: ' + ex.name 
			+ '\nnumber: ' + ex.number
			+ '\ndescription: ' + ex.description);
	}
} // end function getResponseRegion()
