var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

				
function callServer(year, month, pagelink) {
  var url = "calendar.php?year="+escape(year)+"&month="+escape(month)+"&link="+escape(pagelink);
	var loader = '<table border=0 width=150><tr><td height="100" valign="center" align="center"><img src="i/redstar.gif" border="0"></td></tr></table>';
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null);

	document.getElementById("resDiv").innerHTML = loader;
}

function updatePage() {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
    document.getElementById("resDiv").innerHTML = response;
  }
}

function showComments(killID) {
  var url = "showcomments.php?killID="+escape(killID);
  var loader = '<table border=0 width="325" cellpadding="3" cellspacing="2" style="border:1px #999999 solid"><tr><td height="100" valign="center" align="center"><tt style="color: gray;">Loading comments...</tt><br><img src="i/redstar.gif" border="0"></td></tr></table>';
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = commentsUpdate;
  xmlHttp.send(null);
  document.getElementById("comments").innerHTML = loader;
}

function commentsUpdate() {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
    document.getElementById("comments").innerHTML = response;
  }
}

function postComment(cform)
{
	var loader = '<table border=0 width="325" cellpadding="3" cellspacing="2" style="border:1px #999999 solid"><tr><td height="100" valign="center" align="center"><img src="i/redstar.gif" border="0"></td></tr></table>';
	var params = 'op=post&killID='+encodeURIComponent(cform.form.id.value)+'&name='+encodeURIComponent(cform.form.username.value)+'&pass='+encodeURIComponent(cform.form.pass.value)+'&comment='+encodeURIComponent(cform.form.comment.value);
	xmlHttp.open("POST","showcomments.php", true);
	xmlHttp.onreadystatechange = commentsUpdate;
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(params);
   document.getElementById("addform").innerHTML = loader;
}


