function getHTTPObject() {
	var http = false;
	//Use IE's ActiveX items to load the file.
	if(typeof ActiveXObject != 'undefined') {
		try {http = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {http = new ActiveXObject("Microsoft.XMLHTTP");}
			catch (E) {http = false;}
		}
	//If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document.
	} else if (XMLHttpRequest) {
		try {http = new XMLHttpRequest();}
		catch (e) {http = false;}
	}
       
	return http;
}
var http = getHTTPObject();
var params = "";



function handler() {//Call a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
		document.getElementById("reviewscripts").innerHTML = http.responseText;               
	}
}


function postMethod(category, value) {
        var http = getHTTPObject();
	http.open("POST", "/includes/public/ratingValues.php", true);
        params = "category="+category+"&value="+value;

       
	//Send the proper header infomation along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = handler;

        

	http.send(params);
}

function submitReview() {
        document.getElementById("submitbutton").disabled=true;
        reviewSubmitted();
       
        var http2 = getHTTPObject();
        http2.open("POST", "/includes/public/submitReview.php", true);
        params = "submitter="+document.forms["submitterdetails"].elements["submitter"].value;
        params += "&pros="+document.forms["submitterdetails"].elements["pros"].value;
        params += "&cons="+document.forms["submitterdetails"].elements["cons"].value;
        params += "&otherThoughts="+document.forms["submitterdetails"].elements["otherthoughts"].value;

        //Send the proper header infomation along with the request
	http2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http2.setRequestHeader("Content-length", params.length);
	http2.setRequestHeader("Connection", "close");
	http2.onreadystatechange = handler;


	http2.send(params);
}

function reviewSubmitted() {
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();



	}
	else {
		if (window.ActiveXObject) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) { }
		}
	}

	if (xhr)
        {
                    xhr.onreadystatechange = reviewSubmittedContent;
                    xhr.open("GET", "/includes/public/reviewJustSubmitted.php", true);
                    xhr.send(null);
        }
   	else
        {
                    document.getElementById("postareviewcontent").innerHTML = "Sorry, but I couldn't create an XMLHttpRequest";
	}
}

function reviewSubmittedContent() {
	if (xhr.readyState == 4) {
		if (xhr.status == 200) {
			var outMsg = xhr.responseText;

		}
		else {
			var outMsg = "There was a problem with the request " + xhr.status;
                         redrawAll();
		}

                    document.getElementById("postareviewcontent").innerHTML = outMsg;

                   

	}

}



