var xmlhttp;
function getImage(which,gallaryid)
{ 
var w;
var id;
loadXMLDoc();
	if(which=='prev')
	{
		w='prev';
	}
	else if(which=='next')
	{
		w='next';
	}
	id=document.getElementById('gallary'+gallaryid).value;
	var url="wp-content/themes/vyom/ajax/getImage.php?id="+id+"&action="+w+"&gallary="+gallaryid;
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		 {
			ret=xmlhttp.responseText;
			if(ret==0)
		 	{
				return;
			}
			arr=ret.split('##');
			imagepath=arr[1];
			imageid=arr[0];
		  document.getElementById('gallary'+gallaryid).value=imageid;
		  if(gallaryid==1)
		  {
			document.getElementById('slide1').src='wp-content/gallery/showcase-art/thumbs/thumbs_'+imagepath;
		  	document.getElementById('thick1').href='wp-content/gallery/showcase-art/'+imagepath;  
			a=imagepath.split(".");
			foliopath=a[0];
		  	document.getElementById('imgthick1').href='folio-detail/showcase-art/'+foliopath;
			document.getElementById('thick11').href='folio-detail/showcase-art/'+foliopath;
			document.getElementById('thick12').href='folio-detail/showcase-art/'+foliopath;
			document.getElementById('thick13').href='folio-detail/showcase-art/'+foliopath;
			
		  }
		  else if(gallaryid==4)
		  {
			  document.getElementById('slide4').src='wp-content/gallery/digitalworks/thumbs/thumbs_'+imagepath;
			  document.getElementById('thick4').href='wp-content/gallery/digitalworks/'+imagepath;  
				a=imagepath.split(".");
				foliopath=a[0];
				document.getElementById('imgthick4').href='wp-content/gallery/digitalworks/'+imagepath;
		  }
		  else if(gallaryid==5)
		  {
			  document.getElementById('slide5').src='wp-content/gallery/retrospectives/thumbs/thumbs_'+imagepath;
			  document.getElementById('thick5').href='wp-content/gallery/retrospectives/'+imagepath;  
				a=imagepath.split(".");
				foliopath=a[0];
				document.getElementById('imgthick5').href='wp-content/gallery/retrospectives/'+imagepath;
		  }
		  
		  }
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function loadXMLDoc()
{
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
}
