var xmlhttp;
var xmlhttp2;

function showHint(user,img_name,cat_name,pos)
{
	window.idName = pos;
	str = user;
	if (str.length==0)
	{
	  document.getElementById("txtHint").innerHTML="";
	  return;
	}
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	{
	  alert ("Your browser does not support XMLHTTP!");
	  return;
	}
	var url="http://www.darylstock.com/AddToLightBox.php";
	url=url+"?user="+user+"&cat_name="+cat_name+"&img_name="+img_name;
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function stateChanged()
{
	if (xmlhttp.readyState==4)
	{
	  document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
	  //alert(window.idName);
	  document.getElementById(window.idName).style.display = 'none';
	  //window.location.reload();
	  //document.getElementById("galryitems").innerHTML.reload();
	}
}

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }	
return null;
}



function removeFromLightbox(user,img_name,cat_name,pos)
{
	window.idName = pos;
	str = user;
	if (str.length==0)
	{
	  document.getElementById("txtHint").innerHTML="";
	  return;
	}
	xmlhttp2=GetXmlHttpObject2();
	if (xmlhttp2==null)
	{
	  alert ("Your browser does not support XMLHTTP!");
	  return;
	}
	var url="http://www.darylstock.com/RemoveFromLightBox.php";
	url=url+"?user="+user+"&cat_name="+cat_name+"&img_name="+img_name;
	xmlhttp2.onreadystatechange=stateChanged2;
	xmlhttp2.open("GET",url,true);
	xmlhttp2.send(null);
}

function stateChanged2()
{
	if (xmlhttp2.readyState==4)
	{
	  document.getElementById("txtHint").innerHTML=xmlhttp2.responseText;
	  //alert(window.idName);
	  //document.getElementById(window.idName).style.display = 'none';
	  window.location.reload();
	  //document.getElementById("galryitems").innerHTML.reload();
	}
}

function GetXmlHttpObject2()
{
	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }	
return null;
}