jQuery.fn.ratings = function(stars, initialRating) {  var elements = this;  return this.each(function() {  if(!initialRating)      initialRating = 0;    var containerElement = this;    var container = jQuery(this);    var starsCollection = Array();    containerElement.rating = initialRating;    container.css('overflow', 'auto');    for(var starIdx = 0; starIdx < stars; starIdx++) {      var starElement = document.createElement('a');      var star = jQuery(starElement);      starElement.rating = starIdx + 1;      star.addClass('jquery-ratings-star');	  star.attr("title",starElement.rating+"/"+stars);      if(starIdx < initialRating) {        star.addClass('jquery-ratings-full');      }      container.append(star);      starsCollection.push(star);      star.click(function() {        elements.triggerHandler("ratingchanged", {rating: this.rating});        containerElement.rating = this.rating;      });            star.mouseenter(function() {        for(var index = 0; index < this.rating; index++) {          starsCollection[index].addClass('jquery-ratings-full');        }        for(var index = this.rating; index < stars; index++) {          starsCollection[index].removeClass('jquery-ratings-full');        }      });           container.mouseleave(function() {                for(var index = 0; index < containerElement.rating; index++) {          starsCollection[index].addClass('jquery-ratings-full');        }                for(var index = containerElement.rating; index < stars ; index++) {          starsCollection[index].removeClass('jquery-ratings-full');        }      });    }  });};jQuery(document).ready(function() {  function getLi (li,text,i,j) {  	     	   	 if (li.find(">ul").height()<180) return;  	 else {	  	var u=jQuery("<li id='fotli_"+i+"_"+j+"'><ul><li class='categoryHead'>"+text+"</li></ul></li>"),	  	    h=0,	  	    k=0;		jQuery.each(li.find(">ul").children("li"),function(j) {	  		h+=jQuery(this).height();  	  			  		if (h>180) {  	  			  	  				  			u.find("ul").append(jQuery(this));	  	  				  			k=1;	  	    }	  	});		  	if (k) li.after(u);  	    	  	    	  	 	  		  	getLi(jQuery("#fotli_"+i+"_"+j),text,i,j+1);  	 }	  }    jQuery.each(jQuery("#mycarousel > li"),function(i) {  	     	   getLi(jQuery(this),jQuery(this).find(".categoryHead").text(),i,0);  	     });      jQuery('#mycarousel').jcarousel({scroll:6,animation:"slow"});});	
