
//the file name and wrapper div, need to be renamed here according to the details on the form
function addFileInput(inputName)
{
	var new_file = document.createElement("input");
	var new_break = document.createElement("br");

	new_file.setAttribute("name", inputName + number_of_files);
	new_file.setAttribute("type", "file");
	new_file.setAttribute("size", "60");

	document.getElementById("files").appendChild(new_break);
	document.getElementById("files").appendChild(new_break);
	document.getElementById("files").appendChild(new_file);

	document.getElementById("number_of_files").value = number_of_files;
	number_of_files++;
}// end addFileInput

function executeXHR(callback, url)
{
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
		req.onreadystatechange = callback;
		req.open("GET", url, true);
		req.send(null);
	} // branch for IE/Windows ActiveX version
	else if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req)
		{
			req.onreadystatechange = callback;
			req.open("GET", url, true);
			req.send();
		}// end if
	}// end else if
}// end executeXHR

function processAjaxResponse()
{
	// only if req shows "loaded"
	if (req.readyState == 4)
	{
		// only if "OK"
		if (req.status == 200)
		{
			toBlock = document.getElementById('files');
			toBlock.innerHTML = req.responseText;
		}// end if
		else
		{
			alert("There was a problem retrieving the files:\n" +
			req.statusText);
		}// end else
	}// end if
}// end processAjaxResponse

function processDeleteResponse()
{
	// only if req shows "loaded"
	if (req.readyState == 4)
	{
		// only if "OK"
		if (req.status == 200)
		{
			toBlock = document.getElementById('image_thumbs');
			toBlock.innerHTML = req.responseText;
		}// end if
		else
		{
			alert("There was a problem deleting the file:\n" +
			req.statusText);
		}// end else
	}// end if
}// end processDeleteResponse

function processDeletePDFResponse()
{
	// only if req shows "loaded"
	if (req.readyState == 4)
	{
		// only if "OK"
		if (req.status == 200)
		{
			toBlock = document.getElementById('PDFs');
			toBlock.innerHTML = req.responseText;
		}// end if
		else
		{
			alert("There was a problem deleting the file:\n" +
			req.statusText);
		}// end else
	}// end if
}// end processDeleteResponse

/*

function processDeleteResponse()
{
	// only if req shows "loaded"
	if (req.readyState == 4)
	{
		// only if "OK"
		if (req.status == 200)
		{
			toBlock = document.getElementById('image_thumbs');
			toBlock.innerHTML = req.responseText;
		}// end if
		else
		{
			alert("There was a problem deleting the image:\n" +
			req.statusText);
		}// end else
	}// end if
}// end processDeleteResponse
*/
