xmlhttp_mark=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
	xmlhttp_mark=new XMLHttpRequest()
}
// code for IE
else if (window.ActiveXObject)
{
	xmlhttp_mark=new ActiveXObject("Microsoft.XMLHTTP")
}
function MyMarkasInstalled(tid, installed)
{
	if(xmlhttp_mark)
	{ 
		xmlhttp_mark.open("GET", "xmlhttp.php?action=markasinstall&tid="+tid+"&installed="+installed, true);
  		xmlhttp_mark.onreadystatechange= function()
  		{
  			if(xmlhttp_mark.readyState==4)
 			{	
				var themelang = document.getElementById("themelang").value;
				if(xmlhttp_mark.responseText.match(/<error>([^<]*)<\/error>/))
				{
					message = xmlhttp_mark.responseText.match(/<error>([^<]*)<\/error>/);
					if(!message[1])
					{
						message[1] = "An unknown error occurred.";
					}
					alert(message[1]);
				}
				else
				{
					if(xmlhttp_mark.responseText.match(/<success>([^<]*)<\/success>/))
					{
						success = xmlhttp_mark.responseText.match(/<success>([^<]*)<\/success>/);
						if(success[1])
						{
							document.getElementById("installed_"+tid).style.visibility = "visible";
							document.getElementById("installed_"+tid).style.display = "block";
							document.getElementById("installed_"+tid).innerHTML = success[1];
						}
					}
					if(xmlhttp_mark.responseText.match(/<image>(.*?)<\/image>/))
					{
						image = xmlhttp_mark.responseText.match(/<image>(.*?)<\/image>/);
					}
					if(xmlhttp_mark.responseText.match(/<installs>(.*?)<\/installs>/))
					{
						installs = xmlhttp_mark.responseText.match(/<installs>(.*?)<\/installs>/);
					}
					if(installed == 0)
					{
						document.getElementById("a_"+tid).href = "javascript:MyMarkasInstalled("+tid+", 1);";
						document.getElementById("a_"+tid).title = image[1];
						document.getElementById("img_"+tid).src = "./"+themelang+"/install.gif";
					}
					else if(installed == 1)
					{
						document.getElementById("a_"+tid).href = "javascript:MyMarkasInstalled("+tid+", 0);";
						document.getElementById("a_"+tid).title = image[1];
						document.getElementById("img_"+tid).src = "./"+themelang+"/uninstall.gif";
					}
					document.getElementById("installs_"+tid).innerHTML = installs[1];
					window.setTimeout("hide('installed_"+tid+"')", 5000);
				}	
			}
 		}
		xmlhttp_mark.send(null)
 	}
}

function MyMarkasInstalledNotify(tid)
{
	if(xmlhttp_mark)
	{ 
		xmlhttp_mark.open("GET", "xmlhttp.php?action=markasinstall&type=notify&tid="+tid, true);
  		xmlhttp_mark.onreadystatechange= function()
  		{
  			if(xmlhttp_mark.readyState==4)
 			{
				if(xmlhttp_mark.responseText.match(/<error>([^<]*)<\/error>/))
				{
					message = xmlhttp_mark.responseText.match(/<error>([^<]*)<\/error>/);
					if(!message[1])
					{
						message[1] = "An unknown error occurred.";
					}
					alert(message[1]);
				}
				else
				{
					if(xmlhttp_mark.responseText.match(/<success>([^<]*)<\/success>/))
					{
						success = xmlhttp_mark.responseText.match(/<success>([^<]*)<\/success>/);
						if(success[1])
						{
							document.getElementById("installed_"+tid).style.visibility = "visible";
							document.getElementById("installed_"+tid).style.display = "block";
							document.getElementById("installed_"+tid).innerHTML = success[1];
						}
					}
					if(xmlhttp_mark.responseText.match(/<image>(.*?)<\/image>/))
					{
						image = xmlhttp_mark.responseText.match(/<image>(.*?)<\/image>/);
					}
					document.getElementById("ab_"+tid).href = "#";
					document.getElementById("ab_"+tid).title = image[1];
					document.getElementById("imgb_"+tid).src = "./images/lightbulb.gif";
					window.setTimeout("Element.remove('imgb_" + tid + "')", 5000);
					window.setTimeout("hide('installed_"+tid+"')", 5000);
				}
			}
 		}
		xmlhttp_mark.send(null)
 	}
}

function hide(id)
{
	document.getElementById(id).style.visibility = "hidden";
	document.getElementById(id).style.display = "none";
}
