﻿//Global vars to hold connection to web pages
var xmlHttp3

function showInputs(str) {
	//Function that gets called
	//Currently we only call one other sub, but this could change
	ShowComments(str)
}

function ShowComments(str) {
	//This sub will populate a table with all the states and get the
	//pagination built

	//Make the AJAX connection for both the navigation and content
	xmlHttp3=GetXmlHttpObject1()
	//If we cant do the request error out
	if (xmlHttp3==null ) {
	 	alert ("Browser does not support HTTP Request")
	 	return
	}


	//Build the url to call
	//Pass variables through the url
	var url= phpCommentName
	url=url+"&p="+str
	url=url+"&t=con"
	url=url+"&sid="+Math.random()

	//Once the page finished loading put it into the div
	xmlHttp3.onreadystatechange=CommentChange

	//Get the php page
	xmlHttp3.open("GET",url,true)
	xmlHttp3.send(null)
}


function CommentChange() {
	//IF this is getting called when the page is done loading the states then output the div
	if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete") {
	 	//Update the Div tag with the outputted text
	 	document.getElementById("pgComments").innerHTML=xmlHttp3.responseText
	}
}

function GetXmlHttpObject1() {
	//Determine what browser we are on and make a httprequest connection for ajax
	var xmlHttp3=null;

	try {
	 	// Firefox, Opera 8.0+, Safari
	 	xmlHttp3=new XMLHttpRequest();
	}
	catch (e) {
	 	//Internet Explorer
	 	try {
	  		xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
	  	}
	 	catch (e) {
	  		xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	}

	return xmlHttp3;
}



//Onload start the user off on page one
window.onload = showInputs("1");