$(document).ready(function(){

$(".menu-cat .cat-sub").hide();

$(".menu-cat").hover(function(){
var current = $(this).find(".cat-title").attr("id");
$(this).find(".cat-sub:hidden").fadeIn("fast");
$(".menu-cat .cat-title[id!=" + current +"]").hide();
},function() {
var current = $(this).find(".cat-title").attr("id");
$(this).find(".cat-sub:visible").fadeOut("fast", function(){$(".menu-cat .cat-title[id!=" + current +"]").show();});
});

$(".widget-pub p a").hide();

function pub_roll() {
$(".widget-pub span a").hide().appendTo(".widget-pub p");
$(".widget-pub p a:first").appendTo(".widget-pub span").fadeIn("slow");
}
setInterval(pub_roll, 5000);

$("a#faire-pub").click(function(){ 
$("#pub-form").slideToggle("slow");
return false;
});

$(".rate a").hover(function(){
var maxid = $(this).attr("title");
$(this).parent().find("a").each(function(){
if($(this).attr("title") <= maxid) $(this).css("background-image", "url(img/png/star.png)");
});
},function(){
$(this).parent().find("a").css("background-image", "url(img/png/star_grey.png)");
});

$(".rate a").click(function(){
var vote = $(this).attr("title");
var elm = this;
$.get($(this).attr("href"), function(data){
$(elm).parent().empty().append("<span style=\"width:" + 16*vote + "px;\"></span>");
});
return false;
});

});