
function reply_user(username)
    {
    document.getElementById("status_new5").focus();
    document.getElementById("status_new5").value = "@" + username + " ";
    
    }

	function chk_user(uid)
	{
		var user_id=uid;
		if(user_id==0)
		{
			alert("Please sign in first to submit it...");
			return false;
		}
		else 
		{
			document.search_form2.submit();
		document.getElementById("status_new5").value = "What's entertaining you?";
		return false;
		}
		
	}
	var reply_global;
	function chkinitial()
	{
		if(document.getElementById("status_new5").value=="What's entertaining you?")
		     document.getElementById("status_new5").value="";
	}
	function chkinitial2()
	{
		if(document.getElementById("status_new5").value=="")
		     document.getElementById("status_new5").value="What's entertaining you?";
	}	
	 function show_comments(aid)
	   {
	   	$j("#comments_"+aid).slideDown("slow");
	   }
	   function ilikeit(type,feed_type,uid,aid)
	   {
	   		//type 1 for like 2 for dislike
			
	   		var user_id=uid;
			if(user_id==0)
			{
				alert("Please sign in first to do this...");
				return false;
			}
			else 
			{
				var url_status = 'http://'+tube_hostname+'/likeit.php';
				var req = new Request({
				method: 'post',
				url: url_status ,
				data: { 'id' : aid , 'type' : type , 'feed_type' : feed_type },
				onRequest: function() {  },
				onComplete: function(response) {status_res=response.split("##");
				document.getElementById('likediv_'+aid).innerHTML = status_res[0];
				document.getElementById('like_count_'+aid).innerHTML = status_res[1];
				$j('#reply_box_'+aid).slideDown("slow");
				$j('#like_count_'+aid).slideDown("slow");
				}
				}).send();
				return false;
			}
	   }
	 function show_reply_box(uid,aid)
	   {
	   		//type 1 for like 2 for dislike
	   		var user_id=uid;
			if(user_id==0)
			{
				alert("Please sign in first to do this...");
				return false;
			} 
			else
			{
				document.getElementById("reply_box_"+aid).style.display="block";
				return false;
			}
			
		}
		function hide_reply(aid)
		{
			document.getElementById("reply_box_"+aid).style.display="none";
			return false;
		}
		function show_reply_box_right(uid,aid)
	   {
	   		//type 1 for like 2 for dislike
	   		var user_id=uid;
			if(user_id==0)
			{
				alert("Please sign in first to do this...");
				return false;
			} 
			else
			{
				document.getElementById("reply_box_"+aid).style.display="block";
				document.getElementById("reply_sec_"+aid).style.display="block";
				return false;
			}
			
		}
		function hide_reply_right(aid)
		{
			document.getElementById("reply_box_"+aid).style.display="none";
			document.getElementById("reply_sec_"+aid).style.display="none";
			return false;
		}
		
		function chk_twitter()
		{
			TB_show('Twitter user info', '#TB_inline?height=200&width=300&inlineId=confirmtwitter', '', '../images/trans.gif');
			
		}
		function chk_twit(user_name,password)
		{
			if(user_name== "" || password == "")
			{
				alert("Please enter user name and password");
				return false;
			}
			else
			{
				
				var url_status = 'http://'+tube_hostname+'/twitter_activity.php';
				var req = new Request({
				method: 'post',
				url: url_status ,
				data: { 'twitter_username' : user_name ,'twitter_password' : password ,'twitter_msg' : reply_global},
				onRequest: function() {  },
				onComplete: function(response) {return false;}
				}).send();
				parent.TB_remove();
				return false;
				
			}
		}
		function delete_user_action(aid,type)
    {
    			var url_status = 'http://'+tube_hostname+'/delete_actions.php';
				var req = new Request({
				method: 'post',
				url: url_status ,
				data: { 'id' : aid , 'type' : type  },
				onRequest: function() {  },
				onComplete: function(response) {
				if(type==1)
				{
					$j('#action_'+aid).slideUp(1000);

					//document.getElementById('action_'+aid).style.display = 'none';
				}
				else
				{
					$j('#comment_'+aid).slideUp(1000);
					//document.getElementById('comment_'+aid).style.display = 'none';	
				}	
				}
				}).send();
				return false;

    }


	    function replyonit(type,feed_type,aid,fid,tid)
	   {
	   		var reply_text;
			reply_global='';
			var send_twitter; 
			send_twitter=0;
			
			reply_text=document.getElementById('reply_area_'+aid).value;
			if(reply_text!="")
			{
				reply_global=reply_text;
				
				if(document.getElementById('reply_twitter_'+aid).checked ==true)
				{
					if(tid==0)
					{
						chk_twitter();	
					}
					else 
					{
						send_twitter=1;
					}
					
				}
				  
				//document.getElementById("reply_box_"+aid).style.display="none";
				document.getElementById('reply_area_'+aid).value="";
				if(fid>0)
				{
				if(document.getElementById('reply_face_'+aid).checked ==true)
					facebook_publish_feed_story(113739464006,{"actor":"","body":reply_text});
				}
				//reply_text=encodeURIComponent(reply_text);
				var url_status = 'http://'+tube_hostname+'/replyonit.php';
				var req = new Request({
				method: 'post',
				url: url_status ,
				data: { 'id' : aid ,'type' : type ,'feed_type': feed_type , 'reply_text' : reply_text, 'send_twitter' : send_twitter },
				onRequest: function() {  },
				onComplete: function(response) {
					
					status_res=response.split("##");
					
					//document.getElementById('count_reply_'+aid).innerHTML =  status_res[0] + " Comments - ";
					if(status_res[0]>1)
					$j('#reply_sec_'+aid).html($j('#reply_sec_'+aid).html()+ status_res[1]);
					else
					$j('#reply_sec_'+aid).html("<ul>"+ status_res[1]+"</ul>"+$j('#reply_sec_'+aid).html());	
					 $j('#reply_sec_'+aid).slideDown("slow");
					//document.getElementById('reply_sec_'+aid).innerHTML ="<ul>" +  status_res[1] + "</ul>";
					}
				}).send();
				return false;
			
			}
			else
			{
			return false;
			}
	   }
	   
	   function replyonit_right(type,feed_type,aid,fid,uid,tid)
	   {
		   if(uid>0)
		   {
	   		var reply_text;
			reply_global='';
			var send_twitter; 
			send_twitter=0;
			
			reply_text=document.getElementById('reply_area_'+aid).value;
			if(reply_text!="")
			{
				reply_global=reply_text;
				
				if(document.getElementById('reply_twitter_'+aid).checked ==true)
				{
					if(tid==0)
					{
						chk_twitter();	
					}
					else 
					{
						send_twitter=1;
					}
					
				}
				  
				//document.getElementById("reply_box_"+aid).style.display="none";
				document.getElementById('reply_area_'+aid).value="";
				if(fid>0)
				{
				if(document.getElementById('reply_face_'+aid).checked ==true)
					facebook_publish_feed_story(113739464006,{"actor":"","body":reply_text});
				}
				//reply_text=encodeURIComponent(reply_text);
				var url_status = 'http://'+tube_hostname+'/replyonit_right.php';
				var req = new Request({
				method: 'post',
				url: url_status ,
				data: { 'id' : aid ,'type' : type ,'feed_type': feed_type , 'reply_text' : reply_text, 'send_twitter' : send_twitter },
				onRequest: function() {  },
				onComplete: function(response) {
					
					status_res=response.split("##");
					
					//document.getElementById('count_reply_'+aid).innerHTML =  status_res[0] + " Comments - ";
					if(status_res[0]>1)
					$j('#reply_sec_'+aid).html($j('#reply_sec_'+aid).html()+ status_res[1]);
					else
					$j('#reply_sec_'+aid).html("<ul>"+ status_res[1]+"</ul>"+$j('#reply_sec_'+aid).html());	
					 $j('#reply_sec_'+aid).slideDown("slow");
					}
				}).send();
				return false;
			
			}
			else
			{
			return false;
			}
		   }
		   else
		   {
			   	alert("Please sign in first to do this...");
			   return false;
		   }
	   }
	   

	
	   
