  $.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };



 
var totale_offerte = 0;
var totale_news = 0;


function conta(){
 totale_offerte = $("#pannello_offerte li").length;
 totale_news = $("#pannello_news li").length;
  attiva();

}

 


function attiva(){
	$("#logo_home").fadeIn("slow", function(){ $("#logo_home").animate({ left: "40px"}, 1500);});
	 
 setTimeout("inizializza_slide('../')", 1500);
 setTimeout("pannello_offerte()", 0);
 setTimeout("pannello_news()", 300);

}












var im = "public/home_1.jpg";
var o=-1;
function pannello_offerte(){
	
	  o=o+1;
	 
   		if(o>=totale_offerte){o=0;}
	
		im = ""+$("#off_"+o).attr("title")+".jpg";
		
		$("#pannello_offerte_img").css("background","url("+im+")");
		 
		$("#pannello_offerte").show(500);
		$("#off_"+o).fadeIn(1000);
   		$("#off_"+o).animate({"left": "+=0px", "top": "+=0px"}, 5000, function(){$("#pannello_offerte").fadeOut(1000);$("#off_"+o).fadeOut(1000, function(){$("#off_"+o).animate({"left": "-=0px", "top": "-=0px"}, "fast", pannello_offerte);})});
     
  } 
	 
	 

var im2 = "public/home_1.jpg";
var n=-1;
function pannello_news(){
	
	  n=n+1;
	 
   		if(n>=totale_news){n=0;}
	
		im2 = "public/"+$("#news_"+n).attr("title")+".jpg";
		$("#pannello_news_img").css("background","url("+im2+")");
		 
		$("#news_home").show(500);
		$("#news_"+n).fadeIn(1000);
   		$("#news_"+n).animate({"left": "+=0px", "top": "+=0px"}, 5000, function(){$("#news_home").fadeOut(1000);$("#news_"+n).fadeOut(1000, function(){$("#news_"+n).animate({"left": "-=0px", "top": "-=0px"}, "fast", pannello_news);})});
     
  } 	 
	 

