window.addEvent('domready', function()
  {
  contatore = 0;
  var slideArticoli = new Fx.Slide('ultimi_articoli',{duration: 1000, mode:'vertical'});
	
	slideArticoli.hide();
  
  var slideEsperto = new Fx.Slide('esperto',{duration: 1000, mode:'vertical'});
	
	slideEsperto.hide();
    
  var slideCerca = new Fx.Slide('per_chi_cerca',{duration: 1000, mode:'vertical'});
	
	slideCerca.hide();
	
	var slideOffre = new Fx.Slide('per_chi_offre',{duration: 1000, mode:'vertical'});
	
	slideOffre.hide();
	
	var slideRicerca_blog = new Fx.Slide('cerca_nel_blog',{duration: 1000, mode:'vertical'});
	slideRicerca_blog.hide();
	
			
	var ajax_a = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_articoli'),
			onSuccess: function() {
			contatore = contatore +3;
			slideArticoli.slideIn();
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		  }
});
var ajax1_a = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_articoli'),
			onSuccess: function() {
			contatore = contatore -3;
			slideArticoli.slideIn();
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
			
		}
});	
	
	$('apri_cerca_blog').addEvent('click', function(e){
				e = new Event(e);
				slideRicerca_blog.toggle();
        
				e.stop();
			});
	
  $('apri_ultimi').addEvent('click', function(e){
				e = new Event(e);
				
        slideArticoli.toggle();
				slideEsperto.slideOut();
				slideCerca.slideOut();
				slideOffre.slideOut();
				contatore = 0;
				
				e.stop();
			});
	
  $('apri_esperto').addEvent('click', function(e){
				e = new Event(e);
				slideArticoli.slideOut();
				slideEsperto.toggle();
				slideCerca.slideOut();
				slideOffre.slideOut();
				contatore = 0;
				e.stop();
			});
			  
  $('apri_cerca').addEvent('click', function(e){
				e = new Event(e);
				slideArticoli.slideOut();
				slideEsperto.slideOut();
				slideCerca.toggle();
				slideOffre.slideOut();
				contatore = 0;
				e.stop();
			});
  
  $('apri_offre').addEvent('click', function(e){
				e = new Event(e);
				slideArticoli.slideOut();
				slideEsperto.slideOut();
				slideCerca.slideOut();
				slideOffre.toggle();
				contatore = 0;
				e.stop();
			});
//********
	

	  $('avanti_articoli').addEvent('click', function(e){
	      
				e = new Event(e);
        ajax_a.request('limit='+contatore+'&cat=10');
        
				e.stop();
				
			});
		$('indietro_articoli').addEvent('click', function(e){
				e = new Event(e);
				  if(contatore>0)
				    {
				    contatore=contatore-3;
            ajax1_a.request('limit='+contatore+'&cat=10');
            }
				
				e.stop();
			});
  
//**********************************
var ajax_e = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_esperto'),
			onSuccess: function() {
			contatore = contatore +3;
			slideEsperto.slideIn();
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		  }
});
var ajax1_e = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_esperto'),
			onSuccess: function() {
			slideEsperto.slideIn();
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		}
});		

	  $('avanti_esperto').addEvent('click', function(e){
				e = new Event(e);
        ajax_e.request('limit='+contatore+'&cat=31');
				e.stop();
			});
		$('indietro_esperto').addEvent('click', function(e){
				e = new Event(e);
				  if(contatore>0)
				    {
				    contatore=contatore-3;
            ajax1_e.request('limit='+contatore+'&cat=31');
            }
				e.stop();
			});


//**********************************
var ajax_c = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_cerca'),
			onSuccess: function() {
			contatore = contatore +3;
			slideCerca.slideIn();
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		  }
});
var ajax1_c = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_cerca'),
			onSuccess: function() {
			slideCerca.slideIn();
			
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		}
});		

	  $('avanti_cerca').addEvent('click', function(e){
				e = new Event(e);
        ajax_c.request('limit='+contatore+'&cat=29');
				e.stop();
			});
		$('indietro_cerca').addEvent('click', function(e){
				e = new Event(e);
				  if(contatore>0)
				    {
				    contatore=contatore-3;
            ajax1_c.request('limit='+contatore+'&cat=29');
            }
				e.stop();
			});
//**********************************
var ajax_o = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_offre'),
			onSuccess: function() {
			contatore = contatore +3;
			slideOffre.slideIn();
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		  }
});
var ajax1_o = new Ajax('prova.php', {
			method: 'POST',
			evalScripts: true,
			update: $('ul_cerca'),
			onSuccess: function() {
			slideOffre.slideIn();
			
			},
      onRequest: function() {
			this.options.update.setHTML("<img src='http://talentfinder.it/images/restyling/loading.gif'>");
		}
});		

	  $('avanti_offre').addEvent('click', function(e){
				e = new Event(e);
        ajax_o.request('limit='+contatore+'&cat=30');
				e.stop();
			});
		$('indietro_offre').addEvent('click', function(e){
				e = new Event(e);
				  if(contatore>0)
				    {
				    contatore=contatore-3;
            ajax1_o.request('limit='+contatore+'&cat=30');
            }
				e.stop();
			});
});
