xmlhttp_dup=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
	xmlhttp_dup=new XMLHttpRequest()
}
// code for IE
else if (window.ActiveXObject)
{
	xmlhttp_dup=new ActiveXObject("Microsoft.XMLHTTP")
}
function createDuplicate(tid, post)
{
	if(xmlhttp_dup)
	{ 
		xmlhttp_dup.open("GET", "xmlhttp.php?action=createdup&tid="+tid+"&post_code="+post, true);
  		xmlhttp_dup.onreadystatechange= function()
  		{
  			if(xmlhttp_dup.readyState==4)
 			{	
				if(xmlhttp_dup.responseText.match(/<error>([^<]*)<\/error>/))
				{
					message = xmlhttp_dup.responseText.match(/<error>([^<]*)<\/error>/);
					if(!message[1])
					{
						message[1] = "An unknown error occurred.";
					}
					alert(message[1]);
				}
				else
				{
					document.getElementById("createdup_note").innerHTML = xmlhttp_dup.responseText;
					window.setTimeout("hide('dup_"+tid+"')", 5000);
				}	
			}
 		}
		xmlhttp_dup.send(null)
 	}
}

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