
function menu() {

    $('ul#menu_pral li:has(ul)').hover(
	    function(e)
	    {
		$(this).find('ul').fadeIn(300);
	    },
	    function(e)
	    {
		$(this).find('ul').fadeOut(100);
	    }
	);
}
function banners() {
    $('#banners a').hover(function() {
        banners_obre($(this));
    });
}
function banners_obre(banner) {
	
	var index = $('#banners a').index(banner);
	var i = 0;
	$('#banners a').each(function() {
		var left = i*100;
		if (i < index) left-=300;
		$(this).animate({left:left+"px"}, { queue:false, duration:200, easing: 'swing' });
		i++;
	});
}

function ajax_carrega(desti, url) {
    var dest = jQuery(desti);
    var w = dest.innerWidth();
    if (w<16) w=16;
    var h = dest.innerHeight();
    if (h<16) h=16;
    dest.fadeOut('fast', function() {
        $(this).html('<div class="carregant" style="width:'+w+'px;height:'+h+'px;"></div>').fadeIn('fast',function() {
            jQuery.ajax({
                url: url ,
                error: function(result) { jQuery(desti).html(''); },
                success: function(result) { jQuery(desti).fadeOut('fast',function() {
                        $(this).html(result).fadeIn('fast'); 
                    })
                },
                async: true
            });
        });
      });
}
