//show Comment

function showsubmenu()

{

	var whichEl = eval("submenu1");

	var imgmenu = eval("imgmenu1");

	if (whichEl.style.display == "none")

	{

		eval("submenu1.style.display=\"\";");

		imgmenu.background="images/menuup.gif";

	}

	else

	{

		eval("submenu1.style.display=\"none\";");

		imgmenu.background="images/menudown.gif";

	}

}

//Click the checkbox

function selectHide(fname,line,flag)

{

	if(flag)

	{

		//then well display

		if(window.confirm("Do you Display it?") != 1) 

		{

			document.location.href="/essays/updateReturn.php?fname="+fname;

		}

		else

		{

			document.location.href="/essays/updateComment.php?fname="+fname+"&line="+line+"&action=display";

		}

	}

	else

	{

		//then well undisplay

		if(window.confirm("Do you don't Display it?") != 1)

		{

			document.location.href="/essays/updateReturn.php?fname="+fname;

		}

		else

		{

			document.location.href="/essays/updateComment.php?fname="+fname+"&line="+line+"&action=undisplay";

		}

		//alert("then well undisplay");

	}

}

//message of Submit 

function showMessage()

{

	alert("Please wait for administrators validate!");

}



//Delete the comment (UnDisplay)

function DeleteCommentUn(fname,line)

{

	if(window.confirm("Delete this comment?") != 1) 

	{

		return;

	}

	else

	{

		document.location.href="/essays/deleteComment.php?fname="+fname+"&line="+line;

	}

}

//Update the comment (UnDisplay)

function UpdateCommentUn(fname,line)

{

	if(window.confirm("Update this comment?") != 1) 

	{
		return;

	}

	else

	{

		var line2 = line - 1;
		
		var line3 = line - 2;
		var a ='comment'+[line];

		var n = 'name' + [line3];
		
		var e = 'email' + [line2];

		var avalue=eval("document.commentform."+a+".value");
		var nvalue=eval("document.commentform."+n+".value");
		var evalue=eval("document.commentform."+e+".value");

		avalue = avalue.replace(/\r\n/g,"<br>");

		avalue = avalue.replace(/\n/g,"<br>");

		
		document.location.href="/essays/updateComment.php?fname="+fname+"&line="+line+"&"+a+"="+avalue+"&"+n+"="+nvalue+"&"+e+"="+evalue+"&nowaction=undisplay";
		

	}

}



//Delete the comment (Display)

function DeleteComment(fname,line)

{

	if(window.confirm("Delete this comment?") != 1) 

	{

		return;

	}

	else

	{

		document.location.href="/essays/deleteComment.php?fname="+fname+"&line="+line;

	}

}

//Update the comment (Display)

function UpdateComment(fname,line)

{

	if(window.confirm("Update this comment?") != 1) 

	{

		return;

	}

	else

	{

		var a ='comment'+[line];
		
		var line2 = line - 1;
		
		var line3 = line - 2;
		
		var n = 'name' + [line3];
		
		var e = 'email' + [line2];

		var avalue=eval("document.commentform."+a+".value");
		var nvalue=eval("document.commentform."+n+".value");
		var evalue=eval("document.commentform."+e+".value");


		avalue = avalue.replace(/\r\n/g,"<br>");

		avalue = avalue.replace(/\n/g,"<br>");

		document.location.href="/essays/updateComment.php?fname="+fname+"&line="+line+"&"+a+"="+avalue+"&"+n+"="+nvalue+"&"+e+"="+evalue+"&nowaction=display";

	}

}



//Delete the writing

function DeleteWriting(fname,line)

{

	if(window.confirm("Delete this writing?") != 1) 

	{

		return;

	}

	else

	{

		line++;

		document.location.href="/essays/deleteWriting.php?fname="+fname+"&line="+line;

	}

}