var xmlHttp

function FeatureImg(ImgId,imgfeature)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="js/updateimg.php"
	url=url+"?imgid="+ImgId+"&type=feature&sid="+Math.random()
	
	
	//xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)				
	
	var elmid2 = ImgId+'star'
	var elmid = ImgId+'priv'
	
	if(imgfeature == 1)
	{
		document.getElementById(elmid2).innerHTML  ='<a href=\"javascript:FeatureImg(\''+ImgId+'\',0)\">Featured</a>'
		document.getElementById(elmid).innerHTML  ='<a href=\"javascript:PrivateImg(\''+ImgId+'\',1)\">Public</a>'
	}
	else
	{
		document.getElementById(elmid2).innerHTML  ='<a href=\"javascript:FeatureImg(\''+ImgId+'\',0)\">Not Featured</a>'
	}
}

function PrivateImg(ImgId,imgprivate)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="js/updateimg.php"
	url=url+"?imgid="+ImgId+"&type=private&sid="+Math.random()
	
	//xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)				
	
	var elmid = ImgId+'priv'
	var elmid2 = ImgId+'star'
	
	if(imgprivate == 1)
	{
		document.getElementById(elmid).innerHTML  ='<a href=\"javascript:PrivateImg(\''+ImgId+'\',0)\">Private</a>'
		document.getElementById(elmid2).innerHTML  ='<a href=\"javascript:FeatureImg(\''+ImgId+'\',1)\">Not Featured</a>'
	}
	else
	{
		document.getElementById(elmid).innerHTML  ='<a href=\"javascript:PrivateImg(\''+ImgId+'\',1)\">Public</a>'
	}
}



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;
}