


    var ratings = new Array();
    var bugged = 0;


    function showStars( product_id, rating ) {

        bugged = 1;

        for ( count = 1; count < 4; count++ ) {
           for ( i = 1;  i < 6; i++ ) {

		  suffix = count > 1 ? "_"+count : "";
		  img = eval("document.star_"+product_id+"_"+i+suffix);

		  if (img) {
		    bugged = 0;
  		    if ( i <= rating ) {
		        img.src = "http://" + document.domain + "/guardian/images/icons/red-star-js.gif";
		    }
		    else {
		        img.src = "http://" + document.domain + "/guardian/images/icons/blank_star.gif";
		    }
		  }

	    }
        }

     }


     function rate( product_id, rating ) {
	//showStars( product_id, rating, 1 );

	if ( bugged ) {
	  return true;     // should just follow link
	}

        rnd = Math.random();
	//img = eval("document.star_"+product_id+"_"+rating);
	star = new Image();
	star.src = "http://" + document.domain + "/dynimgs/rate.html?fr="+rnd+"&rate_product=1&rating="
		+ rating + "&product_id=" + product_id;
 
	ratings[product_id] = rating;

	return false;    // tells onClick not to follow link
     }


     function preLoadStars() {

     	      blank = new Image();
	      blank.src = "http://" + document.domain + "/guardian/images/icons/red-star-js.gif";

	      clear = new Image();
	      clear.src = "http://" + document.domain + "/guardian/images/icons/blank_star.gif";
     }

