function goRespond(obj){

/* traverse the HTML dom to locate and capture the needed information */
var el1 = obj.parentNode;
var el2 = el1.previousSibling;
var el3 = el2.childNodes[0].nodeValue; // this is the subject string
var el4 = el1.nextSibling;
var el5 = el4.getElementsByTagName('p')[0];
var el6 = el5.firstChild.nodeValue; // this is the submitter string

/* manipulate the captured information string to required word extracts */
var subj = el3.substring(9); // this is the subject title
var myArray = new Array();
myArray = el6.split(':');
var submitter = myArray[1]; // this is the name of the submitter being replied to
var greet = 'Hi' + submitter + ',' + ' ' + 'TYPE HERE';

/* This makes scroll to form and inserts into it relevant words to get started */
var respForm = document.getElementById('msgPostForm');
respForm.scrollIntoView(true);
respForm.submitter.focus();
respForm.title.value = subj;
respForm.message.value = greet;

/* This changes the form into a response form IF this has not already been done */
    var hiddenFile = document.getElementById('fileName'); // Gets hold of hidden file with post info for script
    if (hiddenFile.value.indexOf('_') == -1) {
	switchForm();
    }
}

/* A lot of checks are made in this function to ensure all aspects of the form remain in sync */
function switchForm(){
    var hiddenFile = document.getElementById('fileName'); // Gets hold of hidden file with post info for script
    if (hiddenFile.value.indexOf('_') != -1) {
	var myArray = new Array();
	myArray = hiddenFile.value.split('_');
	var postFile = myArray[0];
	}
    else {
	var postFile = hiddenFile.value;
    }
    var respondFile = postFile + '_response';

    var infoSpan = document.getElementById('formType'); // Gets hold of span with user info word 
    var eventImg = document.getElementById('msgPostForm').getElementsByTagName('img')[0]; // Gets hold of element

    if (infoSpan.firstChild.nodeValue == 'message' && hiddenFile.value == respondFile) {
	hiddenFile.value = postFile;
    }

    if (infoSpan.firstChild.nodeValue == 'response' && hiddenFile.value == postFile) {
	hiddenFile.value = respondFile;
    }
    {
    hiddenFile.value = (hiddenFile.value == postFile)?respondFile:postFile; // changes value of hidden file

    infoSpan.firstChild.nodeValue = (infoSpan.firstChild.nodeValue == 'message')?'response':'message'; // changes form title

    eventImg.title = (eventImg.title == 'Switch to response form')?'Switch to post message form':'Switch to response form';
    }
}

/* This function resets the value of fileName correctly after a page reload following a response posting/attempt. */
function resetFormValues(){
    var infoSpan = document.getElementById('formType'); // Gets hold of span with user info word 
    var hiddenFile = document.getElementById('fileName'); // Gets hold of hidden file with post info for script

    if ((infoSpan.firstChild.nodeValue == 'message') && (hiddenFile.value.indexOf('_') != -1)){
	alert('This is the condition now!');
	switchForm();
	}
}