var xmlHttp;

function add_com(div_id,id)
{
	 
  xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	} 
  //  Set our destination PHP page "ajaxpost.php"
  xmlHttp.open("POST", "actions.php", true);
  xmlHttp.onreadystatechange = function(){ 
								 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
								 { 
									var str = xmlHttp.responseText;
									var http = false;
									if(navigator.appName == "Microsoft Internet Explorer") {
									http = new ActiveXObject("Microsoft.XMLHTTP");
									} else {
									http = new XMLHttpRequest();
									} 
									document.getElementById(div_id).innerHTML = '<img src="images/Loader.gif">';
									if(id!=""){
										var url="comments.php?div_id="+div_id+"&id="+id;
										  http.open("GET", url, Math.random());
										  http.onreadystatechange=function() {
											if(http.readyState == 4) {
											  document.getElementById(div_id).innerHTML = "";
											  document.getElementById(div_id).innerHTML = http.responseText;
											}
										  }
									}
									  http.send(null);
									//expand_it(feed);
									return false;
								 } 
								}

  // Make our POST parameters string
  var params = "id="+id+
  	           "&actionid=add_comment"+
  	           "&text="+encodeURI( document.getElementById("comments_"+id).value );
  // Set our POST header correctly
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");

  // Send the parms data
  xmlHttp.send(params);

}

function DoLogin(div_id,com_id)
{
	 
  xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	} 
  //  Set our destination PHP page "ajaxpost.php"â€
  xmlHttp.open("POST", "actions.php", true);
  xmlHttp.onreadystatechange = function(){ 
								 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
								 { 
									var str = xmlHttp.responseText;
									if(str.indexOf("Invalid") != -1)
									{
										document.getElementById("Log_action1").innerHTML = str;
									}
									else
									{
									var http = false;
									if(navigator.appName == "Microsoft Internet Explorer") {
									http = new ActiveXObject("Microsoft.XMLHTTP");
									} else {
									http = new XMLHttpRequest();
									} 
									document.getElementById(div_id).innerHTML = '<img src="images/Loader.gif">';
									if(div_id!=""){
										var url="comments.php?div_id="+div_id+"&id="+com_id;
										  http.open("GET", url, Math.random());
										  http.onreadystatechange=function() {
											if(http.readyState == 4) {
											  document.getElementById(div_id).innerHTML = "";
											  document.getElementById(div_id).innerHTML = http.responseText;
											}
										  }
									}
									  http.send(null);
									}
									return false;
								 } 
								}

  // Make our POST parameters string
  var params = "&actionid=login"+
  	           "&loginid="+encodeURI( document.getElementById("loginid").value )+
  	           "&pass="+encodeURI( document.getElementById("pass").value );
  // Set our POST header correctly
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");

  // Send the parms data
  xmlHttp.send(params);

}

function LogOut(div_id,com_id)
{

var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
} 
	document.getElementById(div_id).innerHTML = '<img src="images/Loader.gif">';
	if(com_id!=""){
		var url="comments.php?act=logout&div_id="+div_id+"&id="+com_id;
		  http.open("GET", url, Math.random());
		  http.onreadystatechange=function() {
			if(http.readyState == 4) {
			  document.getElementById(div_id).innerHTML = "";
			  document.getElementById(div_id).innerHTML = http.responseText;
			}
		  }
	}
	  http.send(null);
}



function contact_feedback() 
{ 
 	
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	var str = xmlHttp.responseText;
	document.getElementById("Log_action").innerHTML=xmlHttp.responseText;
 } 
}
function GetXmlHttpObject()
{
var xmlHttp=null;

try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
