/* Fonctions pour les depeches deroulantes */
/* et pour les forums permanents*/ 
$(function(){
	$(".scrolling_depeche").hover(function(){
		$(this).attr("scrollamount",0);
	},function(){
		$(this).attr("scrollamount",1);
	})
	
	$(".onglet").hover(function(){
		$(".onglet").removeClass("on");
		$(this).addClass("on");
	},function(){
		
		//$(this).removeClass("on");
		//$(".onglet:eq(0)").addClass("on");
	})
	
	
})
function scroller_depeche(bloc,direction){	
	$("#"+bloc).attr("direction",direction);
}

$.fn.typewriter = function(opt) {
  var typeone = function(self, text, content) {
    if (text.length > 0) {
      var next = text.match(/(\s*(<[^>]*>)?)*(&.*?;|.?)/)[0];
      text = text.substr(next.length);
      $(self).html(content+next);
      setTimeout(function(){
        typeone(self, text, content+next);
      }, opt['delay']);
    }
  }
  this.each(function() {
    opt = opt || { 'delay': 100 };
    $(this).height($(this).height());
    $(this).width($(this).width());
    typeone(this, $(this).html(), '');
  });
}


$(goType);
function goType() {
	var nbCharEtTemps = $(".typeslower").text().length*80+5000;
	$(".typeslower").typewriter({'delay': 80});
	setTimeout(goType,nbCharEtTemps);
}

