function Actions()
{
  this.detailshidden = true;
  this.showdetails = "more &raquo;&raquo;";
  this.hidedetails = "less &laquo;&laquo;";
  this.toggleDetails = function() {
    $j("#btndetails").html((this.detailshidden)?this.hidedetails:this.showdetails);
    (this.detailshidden)?$j("div.details").show("fast"):$j("div.details").hide("fast");
    this.detailshidden = !this.detailshidden;
  };
  
  this.friends = function(userid, page) {
    ajaxpost("/ajax/userprofilefriends", actions.friendshandler, [{name: "id", value: userid}, {name: "page", value: page}]);
  }
  
  this.friendshandler = function(o) {
    if (o.xmlhttp.status == 200) $j("#fc").html(o.responseText);
  }
  
  this.changeplaylist = function(id) {
    actions.sw();
    ajaxpost("/ajax/getplaylist", actions.playlisthandler, [{name: "id", value: id}]);
  }
  
  this.sw = function(show) {
    $j("#playlistwait").css("display", (show)?"inline":"none");
  }
  
  this.hw = function() {
    $j("#playlistwait").css("display", "none");
  }
  
  this.playlisthandler = function(o) {
    actions.hw(); if (o.xmlhttp.status == 200) $j("#playlistcontents").html(o.responseText);
  }
  
  this.play = function() {
    player.playlist($j("#selplaylist").val());
  }
  
  this.commentpage = function(id, page) {
    ajaxpost("/ajax/usercomments", actions.ch2, [{name: "id", value: id}, {name: "page", value: page}]);
  }

  this.ch2 = function(o) {
    if (o.xmlhttp.status == 200)
      $j("#cc").html(o.responseText);
  }

  this.report = function(userid) {
    var f = function() { ajaxpost("/ajax/reportform", actions.srh, [{name: "userid", value: userid}]); };
    this.postquery(f);
  }
  
  this.sendreport = function(userid) {
    var details = $j("#txtDetails").val().trim();
    if (details == "")
      alert("You must describe the reason you are reporting this user");
    else
    {
      var f = function() { ajaxpost("/ajax/report", actions.srh, [{name: "userid", value: userid}, {name: "details", value: details}]); };
      this.postquery(f);
    }
  }
  
  this.srh = function(o) {
    if (o.xmlhttp.status == 200) {
      $j("#message").html(o.responseText);
      $j("#message").slideDown("normal");
    }
  }
  
  this.hidemessage = function(f) {
    this.postquery(f);
  };

  this.postquery = function(f) {
    if ($j("#message").css("display") == "block")
      $j("#message").slideUp("normal", f);
    else
      f();
  }

  
  
}

var actions = new Actions;

f = function() { actions.msgVisible = true; $j("div.message").slideDown("fast"); setTimeout( function() { $j("div#message").slideUp("fast", function() { actions.msgVisible = false; } ); }, 5000); }               