
function xmlhttpPost(strURL, func) {

    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
           func(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(strURL);
}


// function PostComment(cID,cname,cemail,ccomment) {
function PostComment(cID1) {

  var target_div = document.getElementsByName('div_comment')[0];
  var cname = document.mainform.elements['name'].value;
  var cemail = document.mainform.elements['email'].value;
  var ccomment = document.mainform.elements['comments'].value;
  var cpostID = document.mainform.elements['postID'].value;
  

  // ccomment = ccomment.replace(/a/gi, "b");
  ccomment = ccomment.replace(/(\r\n|\n|\r)/gm,"<br>");

  // alert(ccomment);

  done_fn = function(bln) {
    target_div.innerHTML = bln;
  }

  xmlhttpPost("/comment_process.asp?cpostID="+cpostID+"&cname="+cname+"&cemail="+cemail+"&ccomment="+ccomment,done_fn);

}


function DeleteComment(cID) {

  var div_to_delete = document.getElementsByName('comment'+cID)[0];
  // alert(cID);

  done_fn = function(bln) {
    div_to_delete.innerHTML = bln;
  }

  xmlhttpPost("/comment_delete.asp?cID="+cID,done_fn);

}




function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }

}

