// JavaScript Document
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;
}

function removeImage() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		msg=trimString(xmlHttp.responseText);
		//alert(msg);
		if(msg=="y")
		{
			if(image_no=="3")
			{
				obj1="show3";
				obj2="show4";
			}
			else if(image_no=="2" || image_no=="4")
			{
				obj1="show1_"+iso_no;
				obj2="show2_"+iso_no;
			}
			else
			{
				obj1="show1";
				obj2="show2";
			}
			
			var show1=document.getElementById(obj1);
			var show2=document.getElementById(obj2);
			alert("File is removed.");
			show1.style.display="";
			show2.style.display="none";
		}
		else
		{
			alert("Error in file deletion");
		}
	}
}
var image_no
var item_id
var iso_no
function removeImg(str1,str2,str3)
{
	if(!confirm("Do you want to remove file?"))
	{
		return;
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	image_no=str1;
	item_id=str2;
	iso_no=str3
	var url="remove_img.php";
	url=url+"?id="+str1;
	url=url+"&img="+str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=removeImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


