var xmlhttp;

function funcimg(rid)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }

	var url="setimage.php";
	url=url+"?q="+rid;
	//alert(url);
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged500;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

}



function stateChanged500()
{
if (xmlhttp.readyState==4)
{
	image();
}

//var a = document.getElementById("dt").value;
if(xmlhttp.readyState == 0)
			{
					document.getElementById("savewait").innerHTML = "<img src='images/loading.gif' />";
			}
			if(xmlhttp.readyState == 1)
			{
					document.getElementById("savewait").innerHTML = "<img src='images/loading.gif' />";
			}
			if(xmlhttp.readyState == 2)
			{ 
					document.getElementById("savewait").innerHTML = "<img src='images/loading.gif' />";
			}
			if(xmlhttp.readyState == 3)
			{ 
					document.getElementById("savewait").innerHTML = "<img src='images/loading.gif' />";
			}

}

function image()
{
	//alert(xmlhttp.responseText);
	document.getElementById("savewait").innerHTML = "";
	document.getElementById("txtImg").innerHTML=xmlhttp.responseText;
}


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;




}




