// JavaScript Document
function trim(s) {
	if (s == null || s == "") {
		return "";
	}
	var Str = new String(s);
	var newstr = Str.replace(/^\s*/, "");
	return (newstr.replace(/\s*$/, ""));
}
function viewComment() {
	var nodeid = 0;
	var nsid = 0;
	try {
		nodeid = document.forms["myform"].nodeid.value;
		nsid = document.forms["myform"].nsid.value;
	}
	catch (e) {
	}
	document.forms["myform"].action = "http://comments.china.org.cn/comments/servlet/DisplayComments?nodeid=" + nodeid + "&nsid=" + nsid;
	document.forms["myform"].submit();
}
function submitCheck() {
	if (document.forms["myform"].content.value.length > 1000) {
		alert("Comentario demasiado largo...");
		return false;
	}
	if (document.forms["myform"].content.value.indexOf("<script") != -1 || document.forms["myform"].content.value.indexOf("</") != -1) {
		alert("Esta prohibido scripts...");
		return false;
	}
	if (trim(document.forms["myform"].content.value) == "") {
		alert("Escribir un Comentario, no peuede ser vacio");
		return false;
	}
	if (document.forms["myform"].isGuest.checked == false && trim(document.forms["myform"].author.value) == "") {
		alert("Favor de escribir el nombre...");
		return false;
	}

	alert("Gracias por tu comentario.");
	if(document.forms["myform"].isGuest.checked == true){
		document.forms["myform"].author.value="Anónimo";
		document.forms["myform"].isGuest.checked = false;
	}
	document.forms["myform"].submit();
	document.location.href = document.location.href;
}
function loadContent() {
	var nodeid = 0;
	var nsid = 0;
	try {
		nodeid = document.forms["myform"].nodeid.value;
		nsid = document.forms["myform"].nsid.value;
	}
	catch (e) {
	}
	var s = document.createElement("script");
	s.src = "http://comments.china.org.cn/comments/servlet/ViewPartialCommentServlet?nodeid=" + nodeid + "&nsid=" + nsid;
	document.body.appendChild(s);
}
loadContent();

