var xmlHttp

function showPreview(str)
{ 
//alert(str);exit;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="javascript/gallery.php";
url=url+"?p_id="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=imageChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function imageChanged() 
{ 
if(xmlHttp.readyState==1)
{	//alert("bikash");
document.getElementById("big_image").innerHTML="<img src=./images/loader.gif />&nbsp;&nbsp;<label class='red_bold'>Loading....please wait...  </label>"; exit;
 }else 	   
    if (xmlHttp.readyState==4)
    { 
	    if(xmlHttp.status==200)
			{ 
			   document.getElementById("big_image").innerHTML="";
              //document.getElementById("reg_process").innerHTML=xmlHttp.responseText;
			   document.getElementById("big_image").innerHTML=xmlHttp.responseText;			   
			}else if(xmlHttp.status==404)
				document.getElementById("reg_process").innerHTML = "Page Dose not Exist";
			else	//for other error
					document.getElementById("reg_process").innerHTML = "Error:".xmlHttp.status; 
	     
      //alert("bikash");
       }
   }

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;
}