<!--
function ajaxObj()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
catch (e)
  {
  try
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
  catch (e)
	{
	alert("Your browser does not support AJAX!");
	return false;
	}
  }
}
return xmlHttp;
}// end function

function ajaxUpdate(obj,ref) {
	// AJAX
	var htmlObj = document.getElementById(obj);
	var xmlHttp = ajaxObj();
	var params = '';
	if (typeof(xmlHttp) != undefined) {
		xmlHttp.onreadystatechange=function()
		  {
		  if(xmlHttp.readyState==4)
			{
				var rval = xmlHttp.responseText;
				htmlObj.innerHTML = rval;
		  }
		}
		xmlHttp.open("post",ref,true);
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(params);
	} // end if
}

function ajaxGemAddToChest(gem, act, linkpath, imgid) {
		if (document.getElementById('tcr').innerHTML < 10) {
			var ref = linkpath+"plan_a_route_ajax/"+gem+"/"+act+".html";
			var xmlHttp = ajaxObj();
			var params = '';
			if (typeof(xmlHttp) != undefined) {
				xmlHttp.onreadystatechange=function()
					{	
					if(xmlHttp.readyState==4)
					{
						var htmlObj = document.getElementById('tcr');
						var rval = xmlHttp.responseText;
						htmlObj.innerHTML = rval;
						change(imgid, 'disappear');
					}
				}
				xmlHttp.open("post",ref,true);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				xmlHttp.send(params);
			} // end if
		} else {
			alert("A maximum of 10 gems can be entered into the chest");
		}
} // end function
//-->