
		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;
		}
		
		///////////////////////////////////////////////////////////////////////////////////////// general ajx function
		//declare winner now.
		function serwinner(phppage,qrylst,divid)
		{
			//alert(qrylst);
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			if (confirm('Sure to declare as winner.')) 
			{
				var url=phppage;
				url=url+"?"+qrylst;
				//alert(url);
				//url=url+"&sid="+Math.random();
				
				xmlHttp.open('GET',url,true);
	
				xmlHttp.onreadystatechange=function(){ onstateChangedwon(divid); }
	
				xmlHttp.send(null);
			}
		}
		
		function onstateChangedwon(ctrlname) 
		{ 
			//alert(ctrlname);
			if(xmlHttp.readyState==4)
			{ 
				 var rslt = xmlHttp.responseText;
				//alert(rslt);
				document.getElementById(ctrlname).innerHTML = rslt;			
			}		
		}
		
		
		//set rating now.
		function serate(phppage,qrylst,divid)
		{
			//alert(qrylst);
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			var url=phppage;
			url=url+"?"+qrylst;
			alert(url);
			//url=url+"&sid="+Math.random();
			
			xmlHttp.open('GET',url,true);

			xmlHttp.onreadystatechange=function(){ onstateChangedrate(divid); }

			xmlHttp.send(null);
		}
		
		function onstateChangedrate(ctrlname) 
		{ 
			//alert(ctrlname);
			if(xmlHttp.readyState==4)
			{ 
				 var rslt = xmlHttp.responseText;
				//alert(rslt);
				document.getElementById(ctrlname).innerHTML = rslt;			
			}		
		}
		
		
		function OtherCtntMe(phppage,qrylst,divid)
		{
			//alert(qrylst);
			document.getElementById('loadingimg').style.display = "inline";
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			var url=phppage;
			url=url+"?"+qrylst;
			//alert(url);
			//url=url+"&sid="+Math.random();
			
			xmlHttp.open('GET',url,true);

			xmlHttp.onreadystatechange=function(){ onstateChanged7(divid); }

			xmlHttp.send(null);
		}
		
		function onstateChanged7(ctrlname) 
		{ 
			//alert(ctrlname);
			if(xmlHttp.readyState==4)
			{ 
				var rslt = xmlHttp.responseText;
				//alert(rslt);
				document.getElementById(ctrlname).innerHTML = rslt;
				//document.getElementById('loading').style.display = "none";
				document.getElementById('loadingimg').style.display = "none";

			}
		
		}
		
		/*gallery menu bakc filter*/
		function GalleryFilter(phppage,qrylst,divid)
		{
			//alert(qrylst);
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			//document.getElementById(divid).style.display = "none";
			document.getElementById('loading').style.display = "inline";
			var fl=document.getElementById('FilterByLatest').value;
			var fc=document.getElementById('FilterByCat').value;
			var fy=document.getElementById('FilterByYear').value;
			
			//alert(fl);
			
			if(fl != 0)
			{
				fl="&fl=" + fl;
			}
			else
			{
				fl="";	
			}
			
			if(fc != 0)
			{
				fc="&fc=" + fc;
			}
			else
			{
				fc="";	
			}
			
			if(fy != 0)
			{
				fy="&fy=" + fy;
			}
			else
			{
				fy="";	
			}
			
			var url=phppage;
			url=url+"?"+qrylst+fl+fc+fy;
			//alert(url);
			//url=url+"&sid="+Math.random();
			
			xmlHttp.open('GET',url,true);

			xmlHttp.onreadystatechange=function(){ onstateChangedFLT(divid); }

			xmlHttp.send(null);
		}
		
		function onstateChangedFLT(ctrlname) 
		{ 
			//alert(ctrlname);
			if(xmlHttp.readyState==4)
			{ 
				var rslt = xmlHttp.responseText;
				//alert(rslt);
				document.getElementById(ctrlname).style.display = "inline";
				document.getElementById('loading').style.display = "none";
				document.getElementById(ctrlname).innerHTML = rslt;
			}
		
		}
		
		//desing contest details page
		function DesignPaging(phppage,qrylst,divid)
		{
			//alert(qrylst);
			document.getElementById(divid).style.display = "none";
			document.getElementById('loading').style.display = "inline";
			var ordby=document.getElementById('OrderBy').value;
			var OtherSrc=document.getElementById('OtherSrc').value;
			var UserComment=document.getElementById('user_comment').value;
			//alert(UserComment);
			
			if(ordby != 0)
			{
				odrsdn="&sortby=" + ordby;
			}
			else
			{
				odrsdn="";	
			}
			
			if(OtherSrc != "")
			{
				sodrsdn="&otby=" + OtherSrc;
			}
			else
			{
				sodrsdn="";	
			}
			
			if(UserComment != "")
			{
				ucomsdn="&uc=" + UserComment;
			}
			else
			{
				ucomsdn="";	
			}
			
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			var url=phppage;
			url=url+"?"+qrylst+odrsdn+sodrsdn+ucomsdn;
			//alert(url);
			//url=url+"&sid="+Math.random();
			
			xmlHttp.open('GET',url,true);

			xmlHttp.onreadystatechange=function(){ onstateChangedDES(divid); }

			xmlHttp.send(null);
		}
		
		function onstateChangedDES(ctrlname) 
		{ 
			//alert(ctrlname);
			if(xmlHttp.readyState==4)
			{ 
				 var rslt = xmlHttp.responseText;
				
				//alert(rslt);
				document.getElementById(ctrlname).style.display = "inline";
				document.getElementById('loading').style.display = "none";
				document.getElementById(ctrlname).innerHTML = rslt;
			}
		
		}
		
		
		function ajaxCtntMecc(phppage,qrylst,divid,titid)
		{
			//alert(qrylst);
			//return false;
			var sdn;
			var st=document.getElementById('search_term').value;
			var EndDate=document.getElementById('EndDate').value;
			var Prize=document.getElementById('Prize').value;
			var catid=document.getElementById('cid').value;
			document.getElementById('tit'+titid).style.color="#eb42fb";
			
			if(catid != "")
			{
				sdn="catid=" + catid+"&";
			}
			else
			{
				sdn="";	
			}
			
			if(st != "Search terms...")
			{
				var stdtx="st=" + st  ;	
			}
			else
			{
				var stdtx="st=0";	
			}
			//alert(stdtx);
			
			if(EndDate != "")
			{
				var enddtx="endt=" + EndDate ;	
			}
			else
			{
				var enddtx="endt=0";	
			}
			//alert(enddtx);
			
			if(Prize != "e.g. 100")
			{
				var Prizedtx="prdt=" + Prize ;	
			}
			else
			{
				var Prizedtx="prdt=0";	
			}
			//alert(Prizedtx);
			
			document.getElementById(divid).style.display = "none";
			document.getElementById('loading').style.display = "inline";
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			var url=phppage;
			url=url+"?"+sdn+qrylst+"&"+stdtx+"&"+enddtx+"&"+Prizedtx;
			//alert(url);
			//url=url+"&sid="+Math.random();
			
			xmlHttp.open('GET',url,true);

			xmlHttp.onreadystatechange=function(){ onstateChanged(divid); }

			xmlHttp.send(null);
		}
		
		function ajaxCtntMe(phppage,qrylst,divid)
		{
			//alert(qrylst);
			//return false;
			var cat=document.getElementById('cat').value;
			var typ=document.getElementById('typ').value;
			
			if(cat != "")
			{
				cats="cat=" + cat;
			}
			else
			{
				cats="";	
			}
			
			if(typ != "")
			{
				typs="typ=" + typ;
			}
			else
			{
				typs="";	
			}
			//alert(cats);
			//alert(typs);
			
			document.getElementById(divid).style.display = "none";
			document.getElementById('loading').style.display = "inline";
			xmlHttp=GetXmlHttpObject();
			
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			}
			
			var url=phppage;
			url=url+"?"+cats+"&"+typs;
			//alert(url);
			//url=url+"&sid="+Math.random();
			
			xmlHttp.open('GET',url,true);

			xmlHttp.onreadystatechange=function(){ onstateChanged(divid); }

			xmlHttp.send(null);
		}
		
		function onstateChanged(ctrlname) 
		{ 
			//alert(ctrlname);
			if(xmlHttp.readyState==4)
			{ 
				 var rslt = xmlHttp.responseText;
				
				//alert(rslt);
				document.getElementById(ctrlname).style.display = "inline";
				document.getElementById('loading').style.display = "none";
				document.getElementById(ctrlname).innerHTML = rslt;
				
			}
		
		}
		
		
		
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		
		function GetSelectedItem()
		{

		var len = document.form1.bloglist.length
		var i = 0
		var chosen = ""
		
			for (i = 0; i < len; i++)
			{
				if (document.form1.bloglist[i].selected)
				{
				chosen = chosen + ", " + document.form1.bloglist[i].value;
				}
			}
		chosen = chosen.substring(1);
		
		ajaxContMe(chosen,document.getElementById('userlist').value)
		
		}
		
		////////////////////////////////////FOR SELECT ALL VALUE OF MULTIPLE SELECT //////////////////////////////////
		
		function selectAllOptions(th,obj)
		{
			if(th.checked==true)
			{
				for (var i=0; i<obj.options.length; i++) 
				{
					obj.options[i].selected = true;
				}
			}
		}
		
		function testalert(phppage)
		{
			alert("This js is working" + phppage);
			return false;
		}
	
		
	
	function multiple_checkbox(theForm)
	{
		var z = 0,ischk = 0, DeleteItms = '0';
	 	for(z=0; z<theForm.length;z++)
		{
			  //alert(theForm[z].name);
			  if(theForm[z].type == 'checkbox' && theForm[z].name == 'deleterecord[]' && (!theForm[z].disabled) && (theForm[z].checked))
				{
					ischk = 1;
					DeleteItms = DeleteItms + ',' + theForm[z].value;
					//alert(DeleteItms);
				}
		}
		
		 if(ischk == 0)
		 {
			 alert("Select atleast 1 Item !");
			 return false;
		 }
		return DeleteItms.substr(2);
	}
		
		function DelMulti_cart_items(theForm,thpage)
		{	
			var delitem1 = multiple_checkbox(theForm);
			if(delitem1!=false)
			document.location.href='remove_cart_items.php?ids='+delitem1;
		}
		
		function DelMulti(thpage,theForm,divid,qrystr)
		{	
			
			var delitem = multiple_checkbox(theForm);
			if (delitem != "") 
			{
				if (confirm('Are you sure you wish to remove this crowd?')) 
				{
					OtherCtntMe(thpage,qrystr+'&del=1&delrec='+delitem,divid);
				}
			}
		}
		
		function ActiveMulti(path,theForm,thpage)
		{
			var activeitem = multiple_checkbox(theForm);
			ajaxCtntMe(path + 'admin/general/statechange.php','pag='+thpage+'&act=7&ids='+activeitem,'righttd');
		}
		
		function inActiveMulti(path,theForm,thpage)
		{
			
			var inactiveitem = multiple_checkbox(theForm);
			ajaxCtntMe(path + 'admin/general/statechange.php','pag='+thpage+'&act=8&ids='+inactiveitem,'righttd');
		}
		function fr(path,theForm,thpage)
		{
			
			var featured = multiple_checkbox(theForm);
			ajaxCtntMe(path + 'admin/general/statechange.php','pag='+thpage+'&act=9&ids='+featured,'righttd');
		}
		function wee(path,theForm,thpage)
		{
			var week = multiple_checkbox(theForm);
			ajaxCtntMe(path + 'admin/general/statechange.php','pag='+thpage+'&act=10&ids='+week,'righttd');
		}
		
		function mo(path,theForm,thpage)
		{
			var month = multiple_checkbox(theForm);
			ajaxCtntMe(path + 'admin/general/statechange.php','pag='+thpage+'&act=11&ids='+month,'righttd');
		}
		function ho(path,theForm,thpage)
		{
			var hot = multiple_checkbox(theForm);
			ajaxCtntMe(path + 'admin/general/statechange.php','pag='+thpage+'&act=12&ids='+hot,'righttd');
		}
		
				function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }
	function showhidediv(divnm,mid)
{		
	//alert(mid);
	if(mid==0)
	{
		//alert(divnm);
		document.getElementById(divnm).style.display = "none";
		document.getElementById('fade').style.display='none';	
		document.getElementById('dropdownbox').style.display = "inline";
	}
	else
	{
		//alert(divnm);
		document.getElementById(divnm).style.display = "inline";
		document.getElementById('fade').style.display='block';	
		document.getElementById('dropdownbox').style.display = "none";
	}
}

function showhidedivimg(divnm,mid,gid,giid,galimg,galtit)
{		
	//alert(mid);
	if(mid==0)
	{
		//alert(divnm);
		document.getElementById(divnm).style.display = "none";
		document.getElementById('fade').style.display='none';		
	}
	else
	{
		
		//alert(galimg)
		document.getElementById('galtit').value=galtit
		document.getElementById('imgtoedit').src="gallery/"+gid+"/Thumb/"+galimg
		document.getElementById('giid').value=giid;
		document.getElementById(divnm).style.display = "inline";
		document.getElementById('fade').style.display='block';		
	}
}

function showload()
	{
		document.getElementById("loadingimg").style.display="inline";
	}

/*edit descrptio nof gallery*/
var http_request = false;
function makePOSTRequestG(url, parameters) {
 // http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
  }
  http_request.onreadystatechange = alertContentsG;
  http_request.open('POST', url, true);
  document.getElementById('loading').style.display = "inline";
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}

function alertContentsG() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		//alert(http_request.responseText);
		result = http_request.responseText;
		document.getElementById('loading').style.display = "none";
		document.getElementById('galdesc').style.display = "none";
		document.getElementById('fade').style.display = "none";
		document.getElementById('viewimg').innerHTML = result;
		 
	 } else {
		alert('There was a problem with the request.');
	 }
  }
}
function getgal(obj) {
 	
	//alert(obj);	
	if(document.frmgaldesc.gallerydesc.value=="" || document.frmgaldesc.gallerydesc.value=="Your Description" )
	{
		alert("Please Enter Description");
		document.frmgaldesc.gallerydesc.focus();
		return false();		
	}	
	else
	{  
		var poststr ="giid=" + encodeURI( document.frmgaldesc.giid.value ) + "&gid=" + encodeURI( document.frmgaldesc.gid.value ) + "&gallerydesc=" + encodeURI( document.frmgaldesc.gallerydesc.value );
		//alert(poststr);
		makePOSTRequestG('gallery_back.php', poststr);
	}
}



/*add description of image*/
var http_request = false;
function makePOSTRequest(url, parameters) {
 // http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
  }
  http_request.onreadystatechange = alertContents;
  http_request.open('POST', url, true);
  document.getElementById('loading').style.display = "inline";
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}

function alertContents() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		//alert(http_request.responseText);
		result = http_request.responseText;
		document.getElementById('loading').style.display = "none";
		document.getElementById('desc').style.display = "none";
		document.getElementById('fade').style.display = "none";
		document.getElementById('viewimg').innerHTML = result;
		 
	 } else {
		alert('There was a problem with the request.');
	 }
  }
}
function getd(obj) {
 	
	//alert(obj);	
	if(document.frmdesc.desc.value=="" || document.frmdesc.desc.value=="Your Description" )
	{
		alert("Please Enter Description");
		document.frmdesc.desc.focus();
		return false();		
	}	
	else
	{  
		var poststr ="giid=" + encodeURI( document.frmcomments.giid.value ) + "&gid=" + encodeURI( document.frmcomments.gid.value ) + "&desc=" + encodeURI( document.frmdesc.desc.value );
		makePOSTRequest('gallery_back.php', poststr);
	}
}


/*add comment*/
function makePOSTRequestC(url, parameters) {
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
  }
  http_request.onreadystatechange = alertContentsC;
  http_request.open('POST', url, true);
  document.getElementById('loading').style.display = "inline";
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}

function alertContentsC() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		//alert(http_request.responseText);
		result = http_request.responseText;
		document.getElementById('loading').style.display = "none";
		document.getElementById('comments').style.display = "none";
		document.getElementById('fade').style.display = "none";
		document.getElementById('viewimg').innerHTML = result;
		 
	 } else {
		alert('There was a problem with the request.');
	 }
  }
}
function get(obj) {
 	
	
	if(document.frmcomments.comments.value=="" || document.frmcomments.comments.value=="Your Comments" )
	{
		alert("Please Enter Comments");
		document.frmcomments.comments.focus();
		return false();		
	}	
	else
	{  
		var poststr ="giid=" + encodeURI( document.frmcomments.giid.value ) + "&gid=" + encodeURI( document.frmcomments.gid.value ) + "&comments=" + encodeURI( document.frmcomments.comments.value );
		
		makePOSTRequestC('gallery_back.php', poststr);
	}
}


/*add comment*/
function makePOSTRequestCE(url, parameters,cid) {
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
  }
  
  http_request.onreadystatechange = alertContentsCE;
  http_request.open('POST', url, true);
  document.getElementById('loading').style.display = "inline";
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
  
  function alertContentsCE() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		 //alert(cid);
		//var comid = "cid" + cid;
		//var cid1= document.getElementById(comid).value;
		//var texfld = "ecomments" + cid1;
		//alert(http_request.responseText);
		result = http_request.responseText;
		document.getElementById('loading').style.display = "none";
		document.getElementById(cid).style.display = "none";
		document.getElementById('fade').style.display = "none";
		document.getElementById('viewimg').innerHTML = result;
		 
	 } else {
		alert('There was a problem with the request.');
	 }
  }
}
}


function getecom(obj,cid) {
 	
	//alert(cid);
	var frmname = "frmecomments" + cid;
	var texfld = "ecommentss" + cid;
	//alert(texfld);
	var comid = "cid" + cid;
	//alert(document.getElementById(texfld).value); 
	//alert(frmname);
	
	if(document.getElementById(texfld).value=="" || document.getElementById(texfld).value=="Your Comments" )
	{
		alert("Please Enter Comments");
		document.getElementbyId(texfld).focus();
		return false();		
	}	
	else
	{  
		var poststr ="cid=" + encodeURI( document.getElementById(comid).value ) + "&giid=" + encodeURI( document.getElementById('giid').value ) + "&gid=" + encodeURI( document.getElementById('gid').value ) + "&"+texfld+"=" + encodeURI( document.getElementById(texfld).value );
		//alert(poststr);
		
		makePOSTRequestCE('gallery_back.php', poststr,comid);
	}
}