function displaypic(url, id){
   var xmlHttp = GetXmlHttpObject();
  if (xmlHttp==null){
    alert ("Browser does not support HTTP Request")
    return
  }
  
  xmlHttp.onreadystatechange=function(){
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
    	if(xmlHttp.responseText) exist = 1;
    	if(id){
			var imgnode = document.createElement('img');
			imgnode.setAttribute("src", "files/thumbnails/"+xmlHttp.responseText);
			imgnode.setAttribute("style", "margin:10px;");
    		document.getElementById(id).appendChild(imgnode);
    	}
    }
  }
  url = decodeURIComponent(url);
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function deletePhoto(name){
  var xmlHttp = GetXmlHttpObject();
  if (xmlHttp==null){
    alert ("Browser does not support HTTP Request")
    return
  }
  
  xmlHttp.onreadystatechange=function(){
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
    	document.getElementById('message').innerHTML = 'photodeleted';
    }
  }
  
  url= "testupload.php?del=1&name="+name;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}


function execute_request(url, id){
	url = url.replace("&amp;", "&");
   var xmlHttp = GetXmlHttpObject();
  if (xmlHttp==null){
    alert ("Browser does not support HTTP Request")
    return
  }

  xmlHttp.onreadystatechange=function(){
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
    	if(id)
         document.getElementById(id).innerHTML= xmlHttp.responseText;
    }
  }
  url = decodeURIComponent(url);
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);

}

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;
}