﻿   		function commentPreview(){
			if (document.comments_form.text.value == ""){
				document.getElementById("commentpreview").innerHTML = "";
			} else {
				theText = document.comments_form.text.value.replace(/\n/g, "<br />");
				var theMonths = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

				var time = new Date();
					
				theHour = time.getHours();
					
				if (theHour == "0"){
					theHour = "12";
					AMorPM = "AM";
				} else if (theHour > 12){
					theHour = theHour - 12;
					AMorPM = "PM";
				} else {
					AMorPM = "AM";
				}
					
				theMinute = time.getMinutes();
					
				if (theMinute < 10){
					theMinute = "0" + theMinute;
				}
					
				theTime = theMonths[time.getMonth()] + " " + time.getDate() + ", " + time.getFullYear() + " " + theHour + ":" + theMinute + " " + AMorPM;
				
				document.getElementById("commentpreview").innerHTML = "<div class=\"comment\"><div class=\"comment-content\">" + theText + "</div><p class=\"comment-footer\">نویسنده:<a href=\"" + document.comments_form.url.value + "\" rel=\"nofollow\">" + document.comments_form.author.value + "</a> | <a href=\"#\">" + theTime + "</a></p></div>";
			}
		}
