var Loadingsmall='<img src="http://www.goenche.com/images/loading.gif"/>';
function Shareminds(){
	document.getElementById("loaderid").innerHTML = Loadingsmall;
	var frmwall_minds = document.getElementById("frmwall_minds").value;
	if(frmwall_minds!='' && frmwall_minds!="Click here to type"){
		var success = function(t){ Shareminds_Success(t);}
		var failure = function(t){ Shareminds_Failed(t);}
		var pars    = 'action=addshare&frmwall_minds='+frmwall_minds;
		var url     =  'wallajax.php';
		var myAjax  = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}	
}
function Shareminds_Success(t){
    var strValue = t.responseText;
	var frmwall_minds = document.getElementById("frmwall_minds").value='';
	document.getElementById("loaderid").innerHTML = '';
	document.getElementById("wallreplaceid").innerHTML = strValue;
}
function Shareminds_Failed(t) {
	alert(t);
}

function AddComments_Failed(t) {
	alert(t);
}
function writecomment(contid) {
	document.getElementById("enablecomments"+contid).style.visibility='visible';
	document.getElementById("enablecomments"+contid).style.position='relative';
}
function AddComments(wallid,contid,like){
	document.getElementById("loaderid").innerHTML = Loadingsmall;
	var frmwall_comments = document.getElementById("frmwall_comments"+contid).value;
	if(frmwall_comments!=""){
		var success = function(t){ AddComments_Success(t,wallid,contid);}
		var failure = function(t){ AddComments_Failed(t,wallid,contid);}
		var pars    = 'action=addcomments&wallid='+wallid+'&frmwall_comments='+frmwall_comments+'&like='+like;
		var url     =  'wallajax.php';
		var myAjax  = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}	
}

function AddComments_Success(t,wallid,contid){
    var strValue = t.responseText;
	document.getElementById("wallreplaceid").innerHTML = strValue;
	document.getElementById("loaderid").innerHTML = '';
	document.getElementById("enablecomments"+contid).style.visibility='hidden';
	document.getElementById("enablecomments"+contid).style.position='absolute';
}
function Updatelike(userid,wallid,likestatus){
	var success = function(t){ Addlike_Success(t,userid,wallid,likestatus);}
	var failure = function(t){ Addlike_Failed(t,userid,wallid,likestatus);}
	var pars    = 'action=updaterlike&wallid='+wallid+'&userid='+userid+'&likestatus='+likestatus;
	var url     =  'wallajax.php';
	var myAjax  = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
}
function Addlike_Success(t,userid,wallid,likestatus){
	var strValue = t.responseText;
	document.getElementById("wallreplaceid").innerHTML = strValue;
}

function deleteComment(id){
	if(confirm("Are you sure you want to remove this comment?")){
		var success = function(t){ deleteComment_Success(t);}
		var failure = function(t){ deleteComment_Failed(t);}
		var pars    = 'action=deletecomment&cmdid='+id;
		var url     = 'wallajax.php';
		var myAjax  = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}
}
function deleteComment_Success(t){
	 var strValue = t.responseText;
	 document.getElementById("wallreplaceid").innerHTML = strValue;
}
