// js function to request photo from database
function showPicture(thisPhoto)
	{
		DWREngine._execute(_cfscriptLocation, null, 'getPhoto', thisPhoto, resultPhoto);
	}

// js function that returns photo results to the page
function resultPhoto(photoResult)
	{
		document.getElementById("divPhoto").innerHTML = photoResult;
	}
	
// js function to add the comments form to the page
function addComment(thisPhoto)
	{
		DWREngine._execute(_cfscriptLocation, null, 'addCommentForm', thisPhoto, showCommentInfo);
	}

// js function to submit the comment from the user
function submitComment()
	{
		var photo_ID = document.getElementById("Photo_ID").value;
		var userName = document.getElementById("UserName").value;
		var userEMail = document.getElementById("UserEMail").value;
		var photoComment = document.getElementById("Comment").value;
			
		// execute cf function to add
		DWREngine._execute(_cfscriptLocation,null,'submitComment',photo_ID,userName,userEMail,photoComment,resultComment);
	}
	
function resultComment()
	{
		// return a message to the user
		document.getElementById("divComment").innerHTML = 'Thank you, your message has been submitted.';
	}
	

// js function to add the comments form to the page
function viewComment(thisPhoto)
	{
		DWREngine._execute(_cfscriptLocation, null, 'viewComment', thisPhoto, showCommentInfo);
	}

// js that displays the returned comment form, or the posted comments to the page
function showCommentInfo(commentInfo)
	{
		// new note value for display on page
		var commentInfo2 = commentInfo.replace(/\[br]/g, "<br/>" )
		document.getElementById("divComment").innerHTML = commentInfo2;
	}




