$.fn.clearOnFocus = function() {
	$(this).each(function(){
		t = $(this);

		if(t.attr("title").length == 0 || t.attr("title") == null) return;
		t
			.val( t.attr("title") )
			.focus(function(){
				t = $(this);
				if(t.val() == t.attr("title")) t.val("");
			})
			.blur(function() {
				t = $(this);
				if(t.val() == "") t.val( t.attr("title") );
			});

	});
};

$(function(){
	
	$("input[type=text], input[type=password]").clearOnFocus();
	$('.sfStarsRatingContainer .uiRatingBox.ratable')
		.attr("rank", function(){ return $(this).find(".active").length+1; })
		.hover (
			function() {
				a = $(this);
			},
			function(){
				a = $(this);
				$("li:first-child", a).addClass("active").nextUntil(":nth-child("+a.attr("rank")+")").addClass("active");
			}
		)
		.find("li")
			.hover(
				function() {
					a = $(this);
					a.addClass("active");
					a.prevUntil("").addClass("active");
					a.nextUntil("").removeClass("active");
				},
				function() {
					a = $(this);
					a.removeClass("active");
					a.prevUntil("").removeClass("active");
				}
			);

});
