 
// This function is called when multifile.js is used to upload one or more non-image files at once.
function checkMandatoryFields( element )
{
	var error = 0;
	var message = "";
	
	// Prevent the upload of a document or video unless a title has been provided.
	if( element.name.indexOf( "person_documents" ) != -1 )
	{
		if( document.getElementById( 'person_documents~title' ).value.length == 0 )
		{
			message += "Please provide a title/description for this document. ";
			error = 1;
		}
	}
	else if( element.name.indexOf( "person_videos" ) != -1 )
	{
		if( document.getElementById( 'person_videos~title' ).value.length == 0 )
		{
			message += "Please provide a title/description for this video. ";
			error = 1;
		}
	}
	// Prevent the upload of a library document without specifying a title.
	else if( element.name.indexOf( "library" ) != -1 )
	{
		if( document.getElementById( 'library~title' ).value.length == 0 )
		{
			message += "Please provide a title/description for this document. ";
			error = 1;
		}
	}
	
	if( message.length > 0 )
		alert( message );
		
	return( error );
}

// Is also called by multifile.js when the file has been selected to make sure that the title/description of
// the non-image file is recorded with the name of the non-image file in the database.
function storeMandatoryFields( element, rowToAppendTo )
{
	if( element.name.indexOf( "person_documents" ) != -1 )
	{
		var title = document.createElement( 'input' );
		title.type = 'hidden';
		title.value = document.getElementById( 'person_documents~title' ).value;
		title.name = element.name + '_title';
		
		rowToAppendTo.appendChild( title );
		
		document.getElementById( 'person_documents~title' ).value = "";
	}
	else if( element.name.indexOf( "person_videos" ) != -1 )
	{
		var title = document.createElement( 'input' );
		title.type = 'hidden';
		title.value = document.getElementById( 'person_videos~title' ).value;
		title.name = element.name + '_title';
		
		rowToAppendTo.appendChild( title );
		
		document.getElementById( 'person_videos~title' ).value = "";
	}
	else if( element.name.indexOf( "library" ) != -1 )
	{
		var title = document.createElement( 'input' );
		title.type = 'hidden';
		title.value = document.getElementById( 'library~title' ).value;
		title.name = element.name + '_title';
		
		rowToAppendTo.appendChild( title );
		
		document.getElementById( 'library~title' ).value = "";
	}
}

// Get the next or previous set of journal entries for the specified person.
function getBlogEntries( absolutePath, webRoot, next )
{
	url = webRoot + '/includes/GetBlogEntries.php?next=' + next + '&' + 'webRoot=' + webRoot + '&' + 'absolutePath=' + 
		absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			document.getElementById( 'BlogPosts' ).innerHTML = o.responseText;
			
			CornersTable.init();
  		}
	}
		
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// This function calls the DeleteFromDatabase.php script to delete rows from the database and unlink files from
// the file system.
function deleteFile( absolutePath, webRoot, tableNameToColumnName, thingBeingRemoved, colNum, insertCell )
{	
	// If the row should be deleted.
	if( confirm( "Are you sure you want to delete this " + thingBeingRemoved + "?" ))
	{
		url = webRoot + '/libs/php/DeleteFromDatabase.php?tableNameToColumnName=' + tableNameToColumnName + 
			'&' + 'webRoot=' + webRoot + '&' + 'absolutePath=' + absolutePath;
  	
		callback = 
		{
     		success: function(o) 
			{
				temp = tableNameToColumnName.split( '~' );
				row = document.getElementById( temp[0] + temp[2] ).parentNode;
				row.deleteCell( colNum );
				row.insertCell( insertCell );
        	}
  		} 
		
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
}

// Get the next or previous set of news articles
function getNews( absolutePath, webRoot, next )
{
	url = webRoot + '/includes/GetNews.php?next=' + next + '&' + 'webRoot=' + webRoot + '&' + 'absolutePath=' + 
		absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			document.getElementById( 'T7_News' ).innerHTML = array[0];
			document.getElementById( 'T7_NewsControls' ).innerHTML = array[1];
			
			CornersTable.init();
  		}
	}
		
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Get the next or previous set of events
function getEvents( absolutePath, webRoot, next )
{
	url = webRoot + '/includes/GetEvents.php?next=' + next + '&' + 'webRoot=' + webRoot + '&' + 'absolutePath=' + 
		absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			document.getElementById( 'T7_Events' ).innerHTML = array[0];
			document.getElementById( 'T7_EventsControls' ).innerHTML = array[1];
			
			CornersTable.init();
  		}
	}
		
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Get the next or previous set of case studies
function getCaseStudies( absolutePath, webRoot, next )
{
	url = webRoot + '/includes/GetCaseStudies.php?next=' + next + '&' + 'webRoot=' + webRoot + '&' + 
		'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			document.getElementById( 'T11_PageLeft' ).innerHTML = o.responseText;
			
			CornersTable.init();
  		}
	}
		
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Get the next or previous set of feedback/testimonials.
function getFeedbackTestimonials( absolutePath, webRoot, next )
{
	url = webRoot + '/includes/GetFeedbackTestimonials.php?next=' + next + '&' + 'webRoot=' + webRoot + '&' + 
		'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			document.getElementById( 'T12_LeftCol' ).innerHTML = array[0];
			document.getElementById( 'T12_RightCol' ).innerHTML = array[1];
			document.getElementById( 'feedbackTestimonialNavigation' ).innerHTML = array[2];
  		}
	}
		
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Re-direct to login page if successful login occurs, otherwise display error message.
function login( absolutePath, webRoot )
{
	var email = document.getElementById( 'email_address' ).value;
	var password = document.getElementById( 'password' ).value;
	
	url = webRoot + '/members/Login.php?email_address=' + email + '&' + 'password=' + password + '&' + webRoot + 
		'&' + 'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			
			if( array[1] == 0 )
			{
				document.getElementById( 'message' ).innerHTML = array[0];
				document.getElementById( 'message' ).style.visibility = "visible";
			}
			else
				window.location.href = webRoot + "/members/ProfilePage.php";
  		}
	}
		
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Emails the contents of a student referral.
function studentReferral( absolutePath, webRoot )
{
	company = document.getElementById( 'company' ).value;
	referrer = document.getElementById( 'referrer' ).value;
	student = document.getElementById( 'student' ).value;
	address = document.getElementById( 'address' ).value;
	telephone = document.getElementById( 'telephone' ).value;
	mobile = document.getElementById( 'mobile' ).value;
	email = document.getElementById( 'email' ).value;
	
	error = 0;
	
	if( student.length == 0 )
		error = 1;
	
	if( telephone.length == 0 && mobile.length == 0 && error == 0 )
		error = 1;
	
	if( email.length == 0 && error == 0 )
		error = 1;
	
	if( error == 0 )
	{
		url = webRoot + '/businessArea/StudentReferral.php?student=' + student + '&' + 'email=' + email + '&' + 
			'absolutePath=' + absolutePath + '&' + 'webRoot=' + webRoot;
		
		if( company != "" )
			url += "&company=" + company;
			
		if( referrer != "" )
			url += "&referrer=" + referrer;
		
		if( address != "" )
			url += "&address=" + address;
			
		if( telephone != "" )
			url += "&telephone=" + telephone;
		
		if( mobile != "" )
			url += "&mobile=" + mobile;
		
		callback = 
		{
     		success: function(o) 
			{
				// Email successful
				message = "Thank you. Your referral has been received and will be dealt with accordingly";
				document.getElementById( 'studentReferralMessage' ).innerHTML = message;
				document.getElementById( 'sendPara' ).style.visibility = "hidden";
        	}
  		}
	
		// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
	else
	{
		message = "Please complete mandatory fields (*)";
	
		if( document.getElementById( 'studentReferralMessage' ).innerHTML.indexOf( message ) == -1 )
		{
			document.getElementById( 'studentReferralMessage' ).innerHTML = message + "<br /><br />" + 
				document.getElementById( 'studentReferralMessage' ).innerHTML;
		}
	}
}

// Emails the contents of a princes trust enquiry.
function princesTrustEnquiry( absolutePath, webRoot )
{
	name = document.getElementById( 'name' ).value;
	email = document.getElementById( 'email' ).value;
	telephone = document.getElementById( 'telephone' ).value;
	address = document.getElementById( 'address' ).value;
	query = document.getElementById( 'query' ).value;
	office = document.getElementById( 'office' ).options[document.getElementById( 'office' ).selectedIndex].value;
	
	url = webRoot + '/company/PrincesTrustForm.php?absolutePath=' + absolutePath + '&' + 
		'webRoot=' + webRoot;
		
	if( name.length > 0 )
		url += '&name=' + name;
		
	if( email.length > 0 )
		url += '&email=' + email;
			
	if( telephone.length > 0 )
		url += '&telephone=' + telephone;
		
	if( address.length > 0 )
		url += '&address=' + address;
		
	if( query.length > 0 )
		url += '&query=' + query;
		
	if( office.length > 0 )
		url += '&office=' + office;
		
	callback = 
	{
     	success: function(o) 
		{
			// Email successful
			message = "Thank you. Your enquiry has been received and will be dealt with accordingly";
			document.getElementById( 'princesTrustMessage' ).innerHTML = message;
			document.getElementById( 'princesTrustMessage' ).style.display = "";
			document.getElementById( 'sendPara' ).style.visibility = "hidden";
        }
  	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Emails contents of enquiry form to DTNE.
function sendEnquiry( absolutePath, webRoot )
{
	name = document.getElementById( 'enquiryName' ).value;
	email = document.getElementById( 'enquiryEmail' ).value;
	enquiry = document.getElementById( 'enquiryCopy' ).value;
	
	error = 0;
	
	if( name.length == 0 )
		error = 1;
	
	if( email.length == 0 && error == 0 )
		error = 1;
		
	if( enquiry.length == 0 && error == 0 )
		error = 1;
	
	if( error == 0 )
	{
		url = webRoot + '/businessArea/SendEnquiry.php?name=' + name + '&' + 'email=' + email + '&' + 'enquiry=' + 
			enquiry + '&' + 'absolutePath=' + absolutePath + '&' + 'webRoot=' + webRoot;
		
		callback = 
		{
     		success: function(o) 
			{
				document.getElementById( 'enquiryMessage' ).innerHTML = o.responseText;
        	}
  		}
		
		// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
	else
	{
		message = "Please complete mandatory fields (*)";
	
		if( document.getElementById( 'enquiryMessage' ).innerHTML.indexOf( message ) == -1 )
		{
			document.getElementById( 'enquiryMessage' ).innerHTML = message + "<br /><br />" + 
				document.getElementById( 'enquiryMessage' ).innerHTML;
		}
	}
}

// Emails feedback/testimonial(s) and updates the database.
function leaveFeedback( absolutePath, webRoot )
{
	name = document.getElementById( 'name' ).value;
	company = document.getElementById( 'company' ).value;
	email = document.getElementById( 'email' ).value;
	feedback = document.getElementById( 'feedback' ).value;
	
	error = 0;
	
	if( name.length == 0 )
		error = 1;
	
	if( feedback.length == 0 && error == 0 )
		error = 1;
	
	if( error == 0 )
	{
		url = webRoot + '/businessArea/LeaveFeedback.php?name=' + name + '&' + 'email=' + email + '&' + 'feedback=' + 
			feedback + '&' + 'absolutePath=' + absolutePath + '&' + 'webRoot=' + webRoot;
		
		if( company.length != 0 )
			url += "&company=" + company;
  	
		callback = 
		{
     		success: function(o) 
			{
				document.getElementById( 'feedbackMessage' ).innerHTML = o.responseText;
        	}
  		}
		
		// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
	else
	{
		message = "Please complete mandatory fields (*)";
	
		if( document.getElementById( 'feedbackMessage' ).innerHTML.indexOf( message ) == -1 )
		{
			document.getElementById( 'feedbackMessage' ).innerHTML = message + "<br /><br />" + 
				document.getElementById( 'feedbackMessage' ).innerHTML;
		}
	}
}

// Adds a private message to the journal.
function addToPrivateJournal( absolutePath, webRoot )
{
	title = document.getElementById( 'title' ).value;
	feedback = document.getElementById( 'message' ).value;
	
	personId = 0;
	
	if( document.getElementById( 'person_id' ) != null )
		personId = document.getElementById( 'person_id' ).value;
	
	error = 0;
	
	if( title.length == 0 )
		error = 1;
	
	if( feedback.length == 0 && error == 0 )
		error = 1;
	
	if( error == 0 )
	{
		url = webRoot + '/members/AddToPrivateJournal.php?title=' + title + '&' + 'feedback=' + feedback + '&' + 
			'absolutePath=' + absolutePath;
  	
		if( personId != 0 )
			url += '&' + 'person_id=' + personId; 
		
		callback = 
		{
     		success: function(o) 
			{
				innerHTML = document.getElementById( 'BlogPosts' ).innerHTML;
				idxEndHeader = innerHTML.toLowerCase().indexOf( '</h3>' ) + 5;
				
				document.getElementById( 'BlogPosts' ).innerHTML = innerHTML.substring( 0, idxEndHeader ) + o.responseText;
				
				CornersTable.init();
				JournalLightBox.hide();
        	}
  		}
		
		// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
	else
	{
		message = "Please complete mandatory fields (*)";
	
		document.getElementById( 'feedbackMessage' ).innerHTML = message + "<br /><br />" + 
			document.getElementById( 'feedbackMessage' ).innerHTML;
	}
}

// Adds multiple images uploaded and resized from the profile page
function photoCrop( absolutePath, webRoot, isStudent )
{
	cropDetails = document.getElementById( 'cropDetails' ).value;
	
	cropDetails = cropDetails.replace( /&amp;/g, 'zzzz' );
	
	url = webRoot + '/members/PhotoCrop.php?cropDetails=' + cropDetails + '&' + 'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			message = array[0];
			
			if( array.length == 2 )
			{
				document.getElementById( 'YourPicturesRight' ).innerHTML = array[0];
				message = array[1];
			}
			
			alert( message );
			
			if( isStudent == 1 )
				YourPhotoLightBox.hide();
			else
				YourPhotoLightBoxBlue.hide();
			
			YAHOO.util.Event.on( "person_photosUpload", 'click', uploader.carry );
  		}
	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Adds multiple images uploaded and resized from the profile page
function profilePhotoCrop( absolutePath, webRoot, isStudent )
{
	cropDetails = document.getElementById( 'cropDetails' ).value;
	
	cropDetails = cropDetails.replace( /&amp;/g, 'zzzz' );
	
	url = webRoot + '/members/ProfilePhotoCrop.php?cropDetails=' + cropDetails + '&' + 'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			
			if( array.length == 1 )
				alert( array[0] );
			else
			{
				alert( array[0] );
				document.getElementById( 'profilePic' ).src = array[1];
				document.getElementById( 'profilePic' ).alt = array[2];
			}
			
			if( isStudent == 1 )
				YourProfilePhotoLightBox.hide();
			else
				YourProfilePhotoLightBoxBlue.hide();
  		}
	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Upload a single video and video image
function videoUpload( absolutePath, webRoot, isStudent )
{
	cropDetails = document.getElementById( 'cropDetails' ).value;
	
	// Ampersands used in cropDetails to separate pieces of information are also used in the URL for Ajax.
	// Replace the ampersands in this variable to preserve the information.
	cropDetails = cropDetails.replace( /&amp;/g, 'zzzz' );
	
	url = webRoot + '/members/VideoUpload.php?cropDetails=' + cropDetails + '&' + 'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			message = array[0];
			
			if( array.length == 2 )
			{
				document.getElementById( 'PersonVideos' ).innerHTML = array[0];
				message = array[1];
			}
			
			alert( message );
			
			if( isStudent == 0 )
				YourVideoLightBox.hide();
			else
				YourVideoLightBoxBlue.hide();
			
			YAHOO.util.Event.on( "person_video_previewsUpload", 'click', uploader.carry );
			YAHOO.util.Event.on( "person_videosUpload", 'click', uploader.carry );
  		}
	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Change a user's password
function changePassword( absolutePath, webRoot, isStudent )
{
	password = document.getElementById( 'password' ).value;
	confirmPassword = document.getElementById( 'confirmPassword' ).value;
	
	url = webRoot + '/members/ChangePassword.php?absolutePath=' + absolutePath + '&password=' + password +
		'&confirmPassword=' + confirmPassword;
  	
	callback = 
	{
     	success: function(o) 
		{
			alert( o.responseText );
			
			if( isStudent == 1 )
				ChangePasswordLightBox.hide();
			else
				ChangePasswordLightBoxBlue.hide();
  		}
	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Upload a single document
function documentUpload( absolutePath, webRoot, isStudent )
{
	url = webRoot + '/members/DocumentUpload.php?title=' + document.getElementById( 'title' ).value + '&' + 
		'absolutePath=' + absolutePath;
  	
	callback = 
	{
     	success: function(o) 
		{
			array = o.responseText.split( '|' );
			
			var divs = document.getElementsByTagName( 'div' );
			
			documentDiv = "";
			
			for( i = 0; i < divs.length; i++ )
			{
				if( divs[i].className == "YourDocumentsRight" )
					divs[i].innerHTML = array[0];
			}
			
			alert( array[1] );
			
			if( isStudent == 1 )
				YourDocumentLightBox.hide();
			else	
				YourDocumentLightBoxBlue.hide();
			
			YAHOO.util.Event.on( "person_documentsUpload", 'click', uploader.carry );
  		}
	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

function privateJournalDelete( absolutePath, webRoot, messageId )
{
	div = document.getElementById( 'startBlogEntry' + messageId );
	div.parentNode.removeChild( div );
	
	div = document.getElementById( 'endBlogEntry' + messageId );
	div.parentNode.removeChild( div );
	
	tableNameToColumnName = "person_messaging~message_id~" + messageId;
	
	url = webRoot + '/libs/php/DeleteFromDatabase.php?tableNameToColumnName=' + tableNameToColumnName + 
		'&' + 'webRoot=' + webRoot + '&' + 'absolutePath=' + absolutePath;
	
	callback = 
	{
     	success: function(o) 
		{
			alert( 'Deleted message from the database' );
        }
  	}
	
	// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
	transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}

// Invokes PHP script to reset password with md5 hash - if account exists - otherwise message is displayed if
// account does not exist or email address not supplied. Providing that account exists password is reset and
// emailed and success message is displayed.

function forgottenPassword( absolutePath, webRoot )
{
	email = document.getElementById( 'email_address' ).value;
	
	var message = "";
	
	if( email.length == 0 )
	{
		message = "Please specify the email address";
		document.getElementById( 'message' ).innerHTML = message;
		document.getElementById( 'message' ).style.visibility = "visible";
	}
	
	if( message.length == 0 )
	{
		url = webRoot + '/members/ForgottenPassword.php?email_address=' + email + '&' + 'absolutePath=' + 
			absolutePath;
		
		callback = 
		{
     		success: function(o) 
			{
				document.getElementById( 'message' ).innerHTML = o.responseText;
				document.getElementById( 'message' ).style.visibility = "visible";
        	}
  		}
	
		// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
}

function addToStaffJournal( absolutePath, webRoot )
{
	groups = document.getElementsByName( 'groups[]' );
	staff = document.getElementsByName( 'staff[]' );
	students = document.getElementsByName( 'students[]' );
	
	allGroups = new Array();
	selectedGroups = new Array();
	sendToAllGroups = 0;
	
	allStaff = new Array();
	selectedStaff = new Array();
	sendToAllStaff = 0;
	
	allStudents = new Array();
	selectedStudents = new Array();
	sendToAllStudents = 0;
	
	for( i = 0; i < groups.length; i++ )
	{
		if( groups[i].checked )
		{
			if( groups[i].value == "-1" )
				sendToAllGroups = 1;
				
			selectedGroups.push( groups[i].value );
		}
		
		allGroups.push( groups[i].value );
	}
	
	if( sendToAllGroups == 1 )
		selectedGroups = allGroups;
	
	for( i = 0; i < staff.length; i++ )
	{
		if( staff[i].checked )
		{
			if( staff[i].value == "-1" )
				sendToAllStaff = 1;
				
			selectedStaff.push( staff[i].value );
		}
		
		allStaff.push( staff[i].value );
	}
	
	if( sendToAllStaff == 1 )
		selectedStaff = allStaff;
		
	for( i = 0; i < students.length; i++ )
	{
		if( students[i].checked )
		{
			if( students[i].value == "-1" )
				sendToAllStudents = 1;
				
			selectedStudents.push( students[i].value );
		}
		
		allStudents.push( students[i].value );
	}
	
	if( sendToAllStudents == 1 )
		selectedStudents = allStudents;
	
	var message = "";
	
	if( selectedGroups.length == 0 && selectedStaff.length == 0 && selectedStudents.length == 0 )
	{
		message = "Please choose at least one recipient";
		document.getElementById( 'message' ).innerHTML = "<br /><br /><font color='red'>" + message + "</font>";
		document.getElementById( 'message' ).style.visibility = "visible";
	}
	
	if( message.length == 0 )
	{
		url = webRoot + '/members/AddToStaffJournal.php?groups=' + selectedGroups.join( "," ) + '&' + 'staff=' +
			selectedStaff.join( "," ) + '&' + 'students=' + selectedStudents.join( "," ) + '&' + 'absolutePath=' + 
			absolutePath;
		
		if( document.getElementById( 'title' ).value.length != 0 )
			url += '&' + 'title=' + document.getElementById( 'title' ).value;
		
		if( document.getElementById( 'feedback' ).value.length != 0 )
			url += '&' + 'feedback=' + document.getElementById( 'feedback' ).value;
			
		callback = 
		{
     		success: function(o) 
			{
				document.getElementById( 'messageToList' ).style.display = "none";
				document.getElementById( 'messageTitle' ).style.display = "";
				document.getElementById( 'messageCopy' ).style.display = "";
				document.getElementById( 'sendLink' ).innerHTML = "Send Message";
				
				if( document.getElementById( 'feedback' ).value.length != 0 )
				{
					alert( "Thank you. Your message has been sent" );
					RecipientsLightBox.hide();
				}
        	}
  		}
	
		// Ajax.request conflicts with drag and drop so use the Yahoo Ajax request object for updating a PHP script.
		transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
	}
}
