// JavaScript Document
function follow(no) {
  $.post("/", { 'procType':'follow', 'id': no}, function(xml) {
    if($("error",xml).text()==0){
      $("#follow-"+no).removeClass('follow');
      $("#li-follow-"+no).html('<a href="javascript:void(0);" id="follow" class="pre" onClick="javascript:unfollow(\''+no+'\');" title="unfollow"><span id="follow-'+no+'" class="following">Following</span></a>'); 
    }
 });
 return false;
}
function unfollow(no) {
  $.post("/", { 'procType':'unfollow', 'id': no}, function(xml) {
    if($("error",xml).text()==0){
      $("#follow-"+no).removeClass('following');
      $("#li-follow-"+no).html('<a href="javascript:void(0);" id="follow" class="pre" onClick="javascript:follow(\''+no+'\');"><span id="follow-'+no+'" class="follow">Follow</span></a>'); 
    }
 });
 return false;
}
(function(A){
  A.fn.noSpace=function(){
    return this.each(function(){
      var M=A(this);
      var N=M.val();
      var Q=/[a-z0-9-]/i;
      M.keyup(function(S){
        if(jQuery.inArray(S.keyCode,[16,17,18,20,27,33,34,35,36,37,38,39,40,144])==-1){
          var R=M.val();
          if(R!=""){
            M.val(R.replace(/<\/?[^>]+>/gi,""));
          }
        }
      });

      M.keypress(function(b){
        var a=b.which;
        var c=String.fromCharCode(a);
        return !!(Q.test(c)||a==0||a==8||a==9||a==13)
      })
    })
  }
}
)(jQuery);
$(document).ready(function() {
  $("#query").blur(function () {
    var str = $(this).val();
    S = jQuery.trim(str);
    S = S.replace(/[\s]+/gi," ");
    $(this).val(S);
  });
});

