var starRatingAjax = new Ajax();

function sendStarRating(musicID, starRating) 
   {
      // Get the rating that the user applied to this song
      // var oRatingDiv       = document.getElementById('rating' + musicID);
      // var oRatingDiv       = document.getElementById('yourrating');
      // oRatingDiv.innerHTML = "<img src='/images/starrating/progressimage.gif'>";
      
      // Process the rating
     var url = '/starrating/?musicID=' + musicID + '&starRating=' + starRating

      starRatingAjax.doGet( url, showStarRating, 'text');     
   }

var showStarRating = function(starRatingResponse) 
   {  
      if (starRatingResponse)
         {            
            // The response should be a | delimited string of values
            // We're going to split it into an array 
            var aResponse = starRatingResponse.split('|');
            
            // We now assign the values from the array to the appropriate variables
            var musicID = aResponse[0]
            var starRating = aResponse[1]
            var starRatingImageHTML = aResponse[2]
            var averageStarRating = aResponse[3]
            var averageStarRatingImageHTML = aResponse[4]
            
            // Get the div elements that we'll be manipulating
            // var oRatingDiv = document.getElementById('rating' + musicID);
            var oRatingDiv = document.getElementById('yourrating');
            //  var oAverageRatingImage = document.getElementById('averageratingimage' + musicID);
            var oAverageRatingImage = document.getElementById('currentratingimage');

            // Update the rating star image
            oRatingDiv.innerHTML = starRatingImageHTML.toString();
            
            // Update the average rating star image
            oAverageRatingImage.innerHTML = averageStarRatingImageHTML.toString();
         }
      else
         {
            // no response -- do nothing for now
         }
   }
