var http;
var box_id='';
var js_fieldname='';
var isWorking;
function handleDeleteResponse() 
{
	//alert(state_name);
	if (http.readyState == 4) 
	{
		//alert(http.responseText);
      	//isWorking = false;
    	if (http.responseText.indexOf('invalid') == -1) 
		{
			//alert(http.responseText);
			var xmlDocument = http.responseXML; 
			mode = xmlDocument.getElementsByTagName('Mode').item(0).firstChild.data;
			msg = xmlDocument.getElementsByTagName('Message').item(0).firstChild.data;
			if(mode=="Success"){
				alert(msg);
				document.getElementById(box_id).style.visibility='hidden';
				if(document.getElementById(js_fieldname+'_old'))
				{
					document.getElementById(js_fieldname+'_old').value='';
				}
			}
			else
			{
				alert(msg);
			}
		}
  	}
}
function deleteFile(id, module, field_name, bid) 
{
	http = getHTTPObject();
	box_id = bid;
	js_fieldname = field_name;
	if(confirm("Sure to Delete?")){
		
		var url = admin_url+"includes/delete_file.php?module="+module+"&id="+id+"&field_name="+field_name;
		//alert(url);
		var isWorking = false;
		if (!isWorking)
		{
			isWorking = true;
			//alert(url);
			http.open("GET",url, true);
			http.onreadystatechange=handleDeleteResponse
			http.send(null)
	  	}
	}
}

//http://192.168.32.4/outsource/cellphonesmarket/includes/
	// SITE_URL.D_SITE_INCLUDES;
	

