

function AddRating(lnk,objType,objID,total,rateValue)
{        
    var url= window.location.pathname + window.location.search;

    $.post("ratings/rating_add.aspx", 
        {ObjectID: objID, ObjectType: objType, CurrentTotal: total, RatingValue: rateValue, CurrentUrl: url}, 
        function(xml) { 
          
          if ($(xml).find("RatingAddResponse").length == 0)
                return;

          if ($("Success",xml).text().toLowerCase() == "true")
          {    
            var tot= $("UpdatedTotal",xml).text();
            var display= (tot == "0") ? "&nbsp;" : tot;
            
            $(lnk).removeClass('rate-active');
            $(lnk).addClass('rate-inactive');
            $(lnk).attr('title','Thanks -- you already clicked this!');
            $(lnk).html(display);
            
            $(lnk).removeAttr('onclick');
            $(lnk).click(function() { return false; });
          }          
          else if ($("RedirectUrl",xml).text() != '')
          {
            window.location= $("RedirectUrl",xml).text();
          }          
    });
}