	var pid=0;
	var totrec=0;
	var prevrec=0;
	var gName,imgName,shortDesc,cyc;
	function chkbrowser()
	{
		var xmlHttp;
		try
		{   
			//for mozilla,firefox,netscape
			xmlHttp=new XMLHttpRequest();    
		}
		catch(e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e)
				{
					alert("Your browser doesnot support ajax");
					return false;
				}
			}
		}
		return xmlHttp;
	}
	function ajax()
	{
		var xmlHttp;
		var catlist;
		xmlHttp=chkbrowser();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				catlist=xmlHttp.responseText;
				catlistarr=catlist.split(',');
				for(i=0;i<catlistarr.length;i++)
				{
					percatlistarr=catlistarr[i].split('=');
					var option0 = new Option(percatlistarr[1],percatlistarr[0])
					document.frmgal.selcat.options[i]=option0;
				}
				document.frmgal.selcat.options[0].selected=true;
				ajax1();
			}
		}
		xmlHttp.open("GET","pgal.php?catId="+document.frmgal.selcat.value,true);
		xmlHttp.send(null);
	}
	
	function ajax1()
	{
		
		var xmlHttp;
		var catlist;
		xmlHttp=chkbrowser();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				galinfo=xmlHttp.responseText;
				galinfoarr=galinfo.split("=rahul=");
				varli="li"+pid;
				if(varli!="li0")
				{
					document.getElementById(varli).style.borderColor='#CCCCCC';
				}
				
				pid=galinfoarr[0];
				
				gName=galinfoarr[1];
				imgName=galinfoarr[2];
				imgWidth=galinfoarr[3];
				imgHeight=galinfoarr[4];
				shortDesc=galinfoarr[5];
				totrec=galinfoarr[6];
				var varimgsrc;
				varimgsrc="img"+pid;
				document.getElementById('galName').innerHTML=gName;
				
				document.getElementById('bigImg').src=document.getElementById(varimgsrc).src;
				document.getElementById('bigImg').width=imgWidth;
				document.getElementById('bigImg').height=imgHeight;
				//alert(document.getElementById('bigImg').width);
				varli="li"+pid;
				document.getElementById(varli).style.borderColor='#D07617';
				document.getElementById(varli).style.borderWidth='1px';
				document.getElementById('shortDesc').innerHTML=shortDesc
				//document.getElementById('bigImg').src=imgName;
				
			}
		}
		
		xmlHttp.open("GET","photocyclic.php?photo=cyc&catId="+document.frmgal.selcat.value+"&pid="+pid+"&recno="+totrec,true);
		xmlHttp.send(null);
		
		cyc=setTimeout("ajax1()",2000);
	}
	
	function prev()
	{
		clearTimeout(cyc);
		var xmlHttp;
		var catlist;
		xmlHttp=chkbrowser();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				galinfo=xmlHttp.responseText;
				galinfoarr=galinfo.split("=rahul=");
				varli="li"+pid;
				if(varli!="li0")
				{
					document.getElementById(varli).style.borderColor='#CCCCCC';
				}
				pid=galinfoarr[0];
				gName=galinfoarr[1];
				imgName=galinfoarr[2];
				imgWidth=galinfoarr[3];
				imgHeight=galinfoarr[4];
				shortDesc=galinfoarr[5];
				totrec=galinfoarr[6];
				document.getElementById('galName').innerHTML=gName;
				document.getElementById('bigImg').src="dynamicdata/galleryImg/"+imgName;
				document.getElementById('bigImg').width=imgWidth;
				document.getElementById('bigImg').height=imgHeight;
				varli="li"+pid;
				document.getElementById(varli).style.borderColor='#D07617';
				document.getElementById('shortDesc').innerHTML=shortDesc
				//document.getElementById('bigImg').src=imgName;
			}
		}
		totrec=totrec-2;
		xmlHttp.open("GET","photocyclic.php?photo=prev&catId="+document.frmgal.selcat.value+"&pid="+pid+"&recno="+totrec,true);
		xmlHttp.send(null);
		//cyc=setTimeout("ajax1()",2000);
	}
	
	function next()
	{
		clearTimeout(cyc);
		var xmlHttp;
		var catlist;
		xmlHttp=chkbrowser();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				galinfo=xmlHttp.responseText;
				galinfoarr=galinfo.split("=rahul=");
				varli="li"+pid;
				if(varli!="li0")
				{
					document.getElementById(varli).style.borderColor='#CCCCCC';
				}
				pid=galinfoarr[0];
				gName=galinfoarr[1];
				imgName=galinfoarr[2];
				imgWidth=galinfoarr[3];
				imgHeight=galinfoarr[4];
				shortDesc=galinfoarr[5];
				totrec=galinfoarr[6];
				document.getElementById('galName').innerHTML=gName;
				document.getElementById('bigImg').src="dynamicdata/galleryImg/"+imgName;
				document.getElementById('bigImg').width=imgWidth;
				document.getElementById('bigImg').height=imgHeight;
				varli="li"+pid;
				document.getElementById(varli).style.borderColor='#D07617';
				document.getElementById('shortDesc').innerHTML=shortDesc;
				//document.getElementById('bigImg').src=imgName;
			}
		}
		
		xmlHttp.open("GET","photocyclic.php?photo=next&catId="+document.frmgal.selcat.value+"&pid="+pid+"&recno="+totrec,true);
		xmlHttp.send(null);
	}

	var pp="pause";
	var btnclick="No";
	function pauseplay()
	{
		
		
		if(pp=="play")
		{
			cyc=setTimeout("ajax1()",2000);
			document.getElementById('sp').innerHTML=" Pause";
			pp="pause";
			btnclick="No";
		}
		else
		{
			clearTimeout(cyc);
			btnclick="yes";
			document.getElementById('sp').innerHTML=" Play";
			pp="play";
		}
	}
	
	var i=0;
	var j=0;
	var start="0";
	var end="1";
	var me,me1;
	moz=document.getElementById&&document.all;
	function imgbig(divid,imgid,imgwidth,imgheight)
	{
		clearTimeout(cyc);
		start="1";
		var dividObj=document.getElementById(divid);
		var imgidObj=document.getElementById(imgid);
		var bimgObj=document.getElementById('bigimage');
		dividObj.style.position='absolute';
		dividObj.style.zIndex='999999';
		if(parseInt(document.getElementById(imgid).width)<=100)
		{
			dividObj.style.left=parseInt(dividObj.style.left)-2;
			dividObj.style.top=parseInt(dividObj.style.top)-2;
			imgidObj.width=parseInt(imgidObj.width)+4;
			bimgObj.style.borderColor='transparent';
			imgidObj.height=parseInt(imgidObj.height)+4;
			param="imgbig('"+divid+"','"+imgid+"','"+imgwidth+"','"+imgheight+"')";
			me=window.setTimeout(param,10);
		}
		else
		{
			document.getElementById('bigImg').src=imgidObj.src;
			document.getElementById('bigImg').width=imgwidth;
			document.getElementById('bigImg').height=imgheight;
			bimgObj.style.borderColor='#ccc';
			window.clearTimeout(me);
		}		
	}
	function imgsmall(divid,imgid,imgwidth,imgheight)
	{
		clearTimeout(me);
		var dividObj=document.getElementById(divid);
		var imgidObj=document.getElementById(imgid);
		document.getElementById(divid).style.position='absolute';
		document.getElementById(divid).style.zIndex='1';
		if(parseInt(document.getElementById(imgid).width)>40)
		{
			dividObj.style.left=parseInt(dividObj.style.left)+2;
			dividObj.style.top=parseInt(dividObj.style.top)+2;
			imgidObj.width=parseInt(imgidObj.width)-4;
			imgidObj.height=parseInt(imgidObj.height)-4;
			param="imgsmall('"+divid+"','"+imgid+"','"+imgwidth+"','"+imgheight+"')";
			me1=window.setTimeout(param,10);
		}
		else
		{
			imgidObj.width=40
			imgidObj.height=40
			window.clearTimeout(me1);
			clearTimeout(cyc);
			if(btnclick=="No")
			{
				cyc=setTimeout("ajax1()",2000);
			}
		}
	}
	function showcat()
	{
		window.clearTimeout(me);
		window.clearTimeout(me1);
		var obj;
		if(document.all)
		{
			obj=document.all.tags('div');
		}
		else if(document.getElementsByTagName)
		{
			obj=document.getElementsByTagName('div');
		}
		else if(document.layers)
		{
			obj=document.layers['div'];
		}
		else
		{
			alert("Your browser doesnot support our main navigation system");
		}
		for(i=0;i<obj.length;i++)
		{
			if(obj[i].className=="pgal")
			{
				document.getElementById(obj[i].id).style.visibility='hidden';
				document.getElementById(obj[i].id).style.display='none';
				if(obj[i].id==document.getElementById('selcat').value)
				{
					document.getElementById(obj[i].id).style.visibility='visible';
					document.getElementById(obj[i].id).style.display='block';
				}
			}
		}
	}