// JavaScript Document
// JavaScript Document
var xmlhttp;
function ajaxcreate(){
     if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
}
function delpic(id,userid,pic){
	alert("trade/delpic.php?userid="+userid+"&proid="+id+"&pic="+pic+"&rnd="+Math.random())
   if(confirm("确认删除本图片吗")){
		picdiv=document.getElementById("oldpicture")
		picdiv.value=picdiv.value.replace(pic+";","")
		ajaxcreate(); 
		 var url="trade/delpic.php?userid="+userid+"&proid="+id+"&pic="+pic+"&rnd="+Math.random();
   		xmlhttp.onreadystatechange=statechange;
   		xmlhttp.open("GET",url,true);
  		xmlhttp.send(null);
	}  
}

function statechange(){
  if(xmlhttp.readyState==4){	    
   if(xmlhttp.status==200){
      if(xmlhttp.responseText){
		  show=document.getElementById("piclist")
		  list=show.getElementsByTagName("li")
		  for(i=0;i<list.length;i++){
			  if(list[i].innerHTML.indexOf(xmlhttp.responseText)!=-1){		
				  show.removeChild(list[i]);
				  alert("删除成功")  
				  break;
				  }
			  } 		
		
		  } 
	  }
   }
}

