function add_input(id) {
	var element = document.getElementById(id);
	var elementNew = element.cloneNode(false);
	elementNew.value = "";
	element.parentNode.appendChild(elementNew);
}

function getAjaxConn() {
	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;
}

function ratePresentation(id,rating) {
	var xmlHttp = getAjaxConn();
	xmlHttp.onreadystatechange=function() 	{
		if(xmlHttp.readyState==4) 		{
			document.getElementById("ratingBox").innerHTML = xmlHttp.responseText;
		}
	}	
	var url = 'ratePresentation.php';
	var param = "id=" + id + "&rating=" + rating;
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", param.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(param);
}

function pageComments(id,page) {
	var xmlHttp = getAjaxConn();	
	
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById("comments").innerHTML = xmlHttp.responseText;
		}
	}
	
	var url = 'pageComments.php';
	var param = "?id=" + id + "&page=" + page;
	xmlHttp.open("GET", url+param, true);
	xmlHttp.send(null);
}