/**
 * Create stars for: Rate this
 * 
 * @param iterator
 * @param idUrl
 * @param rate
 * @param disable
 * @return
 */
function createStars(iterator, idUrl, idSearchType, rate, disable) {
   jQuery("#rat" + iterator + idUrl).stars(
         {
            inputType : "select",
            oneVoteOnly : true,
            cancelShow : false,
            disabled : disable,
            callback : function(ui, type, value) {
               // Disable Stars while AJAX connection is active
            ui.disable();
            jQuery
                  .getJSON(site_url + "search/ajax_rating", {
                     'id_url' : idUrl,
                     'id_search_type' : idSearchType,
                     'value' : value
                  }, function(data) {
                     // Set new raiting
                        jQuery("#rat" + iterator + idUrl).stars("select",
                              Math.round(data.rating));
                        jQuery("#ratingStringValue" + iterator + idUrl).html(
                              data.rating);
                        jQuery("#numVotes" + iterator + idUrl).html(
                              data.num_ratings);
                     });
         }
         });

   jQuery("#rat" + iterator + idUrl).stars("select", Math.round(rate));
}
/**
 * Create starts for comments
 * 
 * @param idComment
 * @param rate
 * @param disable
 * @return
 */
function createCommentStars(idComment, rate, disable) {
	jQuery("#commentRat" + idComment).stars(
			{
				inputType : "select",
				oneVoteOnly : true,
				cancelShow : false,
				disabled : disable,
				callback : function(ui, type, value) {
				// Disable Stars while AJAX connection is active
				ui.disable();
				jQuery.getJSON(site_url + "search/ajax_comment_rating/"+idComment+'/'+value,
						{}, 
						function(data) {
							// Set new raiting
							jQuery("#commentRat" + idComment).stars("select",
									Math.round(data.rating));
							jQuery("#commentRatingStringValue" + idComment).html(
									data.rating);
							jQuery("#commentNumVotes" + idComment).html(
									data.num_ratings);
				});
			}
			});
	
	jQuery("#commentRat" + idComment).stars("select", Math.round(rate));
}
