function submitSimpleComments(theForm, callBackFunction)
{
	inputs = theForm.getElementsByTagName('input');

    path = theForm.action;
    path += "?simplecomment_action=submit";
	
    for (i = 0; i < inputs.length; i++)
    {
        path += "&" + inputs[i].name + "=" + inputs[i].value;
    }
	
    textarea = theForm.getElementsByTagName('textarea');
    path += "&" + textarea[0].name + "=" + textarea[0].value
		
	xmlHTTPRequest.open("GET", path, true);
	xmlHTTPRequest.onreadystatechange=simpleCommentsCallBackFunction;
	xmlHTTPRequest.send(null);
	return false;
}



function simpleCommentsCallBackFunction()
{
	if(xmlHTTPRequest.readyState == 4)
	{
			
		//var str = xmlHTTPRequest.responseText.replace(/^\s+|\s+$/g, '') ;
		var json = eval('(' + xmlHTTPRequest.responseText + ')');
		switch(json['case'])
		{
		
			case '':
			
			
			document.getElementById(json['category'] + 'simple-comments-form').innerHTML="<div id='simple-comments-dislay'>"
				+ "<div id='simple-comments-name'>Name: " + json['name'] + "</div>"
				+ "<div id='simple-comments-email'>E-mail: " + json['email'] + "</div>"
				+ "<div id='simple-comments-comment'>Comment: " + json['comment'] + "</div>"
				+ "</div>";
			break;
			
			case 'name':
			document.getElementById(json['category'] +'simple-comments-form').innerHTML="Please enter a name";
			break;
			
			case 'email':
			document.getElementById(json['category'] +'simple-comments-form').innerHTML="Please enter a valid e-mail";
			break;
			
			case 'comment':
			document.getElementById(json['category'] +'simple-comments-form').innerHTML="Please enter a comment";
			break;
			
			default:
			location.href=json['case'];
			break;
		}
		
	} 
	
}

function getHTTPObject()
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

xmlHTTPRequest = new getHTTPObject();