function getCookie(Name){ 	var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair	if (document.cookie.match(re)) //if cookie found		return document.cookie.match(re)[0].split("=")[1] //return its value	return null}function docSave(docid,plink) {debugger	tName = "_BlogComment" + plink;	var tForm = document.forms[tName];	sessionID = getCookie("SessionID");		tcontent = (tForm.CommentName.value + "#" + tForm.CommentHomepage.value + "#" + tForm.CommentSubject.value + "#" + tForm.CommentBody.value + "#" + sessionID)	getComments(docid,plink,tcontent);}function getComments(docid,permalink,tcontent) {	// first check if we have to hide;	var elem = "dComments"+permalink;		if (tcontent != "") {				// post new content and close div (return codes reopens div)			animatedcollapse.hide(elem);			var myForm = document.forms[0];			var tmpUrl='AjaxGetComments?openagent';			ajaxPostURL(tmpUrl,"getCommentsResponse", 'Check=' + docid + '&tcontent=' + tcontent);	}	else if (document.getElementById(elem).style.display =='block' ) {		// div has to be closed, no new data needed		animatedcollapse.hide(elem);//		document.getElementById(elem).innerHTML = ""; // disabled (timing issue)		}	else		{									// show comments (return code opens div)			var myForm = document.forms[0];			var tmpUrl='/home/ndt4.nsf/AjaxGetComments?openagent';			ajaxPostURL(tmpUrl,"getCommentsResponse", 'Check=' + docid + '&tcontent=' + tcontent);		}}function getCommentsResponse(response,state) {	try {		if (state==4) {			var responseArray;			//alert(response);			responseArray=response.split("*@*");						// check for error			if (Left(responseArray[0], 1)=="!") {					alert(responseArray[0]);			}			else {				try{					// show the comments					//debugger					unid = responseArray[0];					permalink = responseArray[1];					url = "/home/ndt7.nsf/(LuBlogcontent)/" + permalink;								subject = responseArray[2];					t1 = "_BlogComment" + permalink;					t = "docSave(&quot;" + unid + "&quot;,&quot;" + permalink + "&quot;);";						editc = "<br><br><b>Enter comments</b><br><div style='font-size: xx-small; color: rgb(34, 34, 34);'>HTML is allowed for now, but this may change without notice. I may remove or edit any comments provided etcetc...</div>\</FORM><FORM METHOD='POST' NAME=" + t1 + " ACTION='/home/ndt4.nsf/BlogComment?createdocument'>\<script type='text/javascript' src='comments.js'></script>\<div style='display:block;z-index=10'>\Your Name<br>\<input name='CommentName' value=''><br>\Homepage (e.g. 'http://www...')<br>\<input name='CommentHomepage' value=''><br>\Subject<br>\<input name='CommentSubject' value='Re: " +  subject + "'><br>\<br>\Comments<br>\<textarea name='CommentBody' id='DynamicText' accesskey='c' rows='7' cols='1' style='width: 350px;'></textarea><br>\<input onclick='" + t + ";' value='Save' type='button'>\ <div style='visibility: hidden'>\<input name='Link' value='" + url + "#write'> \<input name='PermaLink' value='" + responseArray[1] + "'> \<input name='CommentBlocker' value=''>\<input name='RT' value=''></div><FORM>\"									tLinks = " &nbsp <a title='show/hide comments' href=\"javascript:getComments(&quot;" + unid + "&quot; , &quot;" + permalink + "&quot; ,'')\" > comments (" + responseArray[3] + ")</a></div>";										// show the data					document.getElementById(permalink).innerHTML = tLinks;  					var ttext = "<br><br>" + responseArray[4] + editc;	//				document.getElementById("dComments" + permalink).innerHTML =  ttext;					$('#dComments' + permalink).html(ttext);					animatedcollapse.show("dComments" + permalink);				}				catch(e) {alert(e);};			}		}	} catch(err){		alert(err);	}}function Left(str, n){	if (n <= 0)	    return "";	else if (n > String(str).length)	    return str;	else	    return String(str).substring(0,n);}