
/** 
 * instanciates the XMLHTTP - Request Object in the specific Browser
 */

var req;
var url;
var request;
	
function loadXMLDoc(request) 
{
	req = false;
	url = "image_url.php";
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
		// branch for IE/Windows ActiveX version
	}
	else if (window.ActiveXObject)
	{
		try 
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req = false;
			}
		}
	}

	if (req)
	{	
		req.onreadystatechange = processReqChange;
		req.open("GET", url+"?params="+request, true);
		req.send("");
	}
}



/**
 * function to resolve the response from Server and act 
 * according to the requested action  
 */
function processReqChange() 
{
    // only if req shows "loaded"
    if (req.readyState == 4) 
    {
        // only if "OK"
        if (req.status == 200) 
        {
		displayResponse(req.responseXML);
        }
    }
}

function displayResponse(xmldoc)
{
	 // XML-Daten auslesen
      image_obj = xmldoc.getElementsByTagName("image");
      if(image_obj && image_obj.length>0) image = image_obj.item(0).firstChild.nodeValue;
      else image = "";
      
       document.getElementById("image_big").setAttribute ("src" , image);
      
}
