function post_tp(symbol, user_action, my_wp_nonce, base_url)
{
//	alert(symbol + " " + ltp + " " + user_action);

  var orightml = $("#lkb_comment_submit_td").html();
  save_button_html = orightml;
  post_to_fb_html = $("#comment_status").html(); 

  var comment_text = get_comment_text();
  if(comment_text=="")
  {
	$("#comment_status").css("width", "30%");
	$("#lkb_comment_submit_td").css("color", "#dd0000");
	$("#lkb_comment_submit_td").html("Oops.. You have to add a comment");
	$("#comment_status").html("");
	$("#lkb_comment").click(function(){
		$("#comment_status").css("width", "70%");
		$("#lkb_comment_submit_td").html(save_button_html);
		$("#lkb_comment_submit").click(function(){post_tp(symbol, current_user_action, my_wp_nonce, base_url);});
		$("#comment_status").html(post_to_fb_html);
		$("#lkb_comment").unbind('click');
	});

	return;
  }

  set_ajax_loading("#lkb_comment_submit_td");

  var topic = symbol + " " + user_action + " at " + "Rs. " + ltp  ;
  var contents = comment_text;

  var iframe_ele = document.getElementById('lkb_cmt_iframe');

  var new_url = this_page_url.replace("=","||;;"); //Added to fix a bug

  var mydata = "topic=" + topic + "&post_content=" + contents + "&tags=&Submit=Send Post %C2%BB&_wpnonce=" +  my_wp_nonce + "&_wp_http_referer=%2Fblog%2Fforum%2Fforum.php%3Fid%3D1&forum_id=1" + "&parent_url=" + new_url + "&user_action=" + user_action + "&symbol=" + symbol + "&ltp=" + ltp  + "&ml_internal_ajax_call=true";


$.ajax({
    type: "POST",
    url: "/blog/forum/bb-post.php",
    data: mydata,
    success: function(data, textStatus, jqXHR) {
        if((data.indexOf("Grand Success")) != -1)
        {
		var cmt_textarea_ele = document.getElementById('lkb_comment');
		cmt_textarea_ele.readOnly="readonly";
		cmt_textarea_ele.style.border="solid 1px #006";
		cmt_textarea_ele.style.background="#F1ECFF";

		var fb_post=false;

		var ele = document.getElementById("post-to-fb-checkbox");
		if(ele.checked)
			fb_post=true;


		if(!fb_post)
		{
		$("#comment_status").css("width", "30%");
		$("#comment_status").html("");
		$("#lkb_comment_submit_td").css("color","#507ec2");
		$("#lkb_comment_submit_td").css("font-size", "11px");
		$("#lkb_comment_submit_td").css("font-style","italic");
		$("#lkb_comment_submit_td").html("Your comment has been saved.");
		
		$("#view_talk").show();

		}

		if(fb_post)
		{
			fb_clicked(symbol, current_user_action);	
		}
        }
        else
        {
		alert("Error in saving your comment");
		$("#lkb_comment_submit_td").html(orightml);
        }
      },
    error: function(jqXHR, textStatus, errorThrown) {
		alert("Error in saving your comment");
		$("#lkb_comment_submit_td").html(orightml);
    }
  });






}


function set_ajax_loading(ele_id)
{


                img_file="white-aj-loading.gif";
        html = '<img border="0" style="background:none;" src="http://marketlive.in/images/like/' + img_file + '" alt="loading" align="middle" />'       ;
        $(ele_id).html(html);
}


