var xmlhttp;
var updateCommentWall;

function removeCommentUWall(id, hId)
{
xmlhttp=GetXmlHttpObject();
updateCommentWall = hId;
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="/wall_actions.php";
url=url+"?id="+id;
url=url+"&act=rcuw";
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=wall_stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
document.getElementById(hId).innerHTML=xmlhttp.responseText;
}

function blockUserUWall(uid, bid, fip, hId)
{
xmlhttp=GetXmlHttpObject();
updateCommentWall = hId;
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="/wall_actions.php";
url=url+"?uid="+uid;
url=url+"&bid="+bid;
url=url+"&fip="+fip;
url=url+"&act=buuw";
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=wall_stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function wall_stateChanged(hId)
{
if (xmlhttp.readyState==4)
{
	document.getElementById(updateCommentWall).innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function hideDiv(ToBeHidden) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(ToBeHidden).style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'hidden';
}
else { // IE 4
document.all.hideshow.style.visibility = 'hidden';
}
}
}

function showDiv(ToBeShown) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(ToBeShown).style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'visible';
}
else { // IE 4
document.all.hideshow.style.visibility = 'visible';
}
}
} 

  var http_request = false;
   function makeRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('commentStartPoint').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj) {
      var getstr = "?";
      for (i=0; i<obj.childNodes.length; i++) {
         if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
            if (obj.childNodes[i].type == "checkbox") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               } else {
                  getstr += obj.childNodes[i].name + "=&";
               }
            }
            if (obj.childNodes[i].type == "radio") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               }
            }
            if (obj.childNodes[i].type == "hidden") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
         }   
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];
            getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
         }
         
      }
      getstr += "message_id=" + urlencode(encodeURI( document.getElementById("message_id").value ))
      makeRequest('/wall_actions_post.php', getstr);
   }
function urlencode (str) {
    str = str.replace(/#/g, "%23");
    return str;
}
