/// JavaScript Document
var InfoAnim, InfoNb, InfoTimeAnim, InfoTime, InfoNum, InfoStart, imgHeight;
InfoNum=0; InfoStart=0;
var a = $("#actu");
var b = $("#infos");
var c = $("#infoimg");

Infos = function(){ };

Infos.start = function(){
	var d = $("#info"+InfoNum);
	if(InfoNum<InfoNb&&InfoStart!=0) InfoNum++; else InfoNum=0;
	var e = $("#info"+InfoNum);

	if(InfoStart==0) {
		
		d.show(); InfoStart=1; // At Start => Show First News
		
	}else if(InfoStart==1 && InfoNb>0){	
	
		if(InfoAnim=="slide") d.slideUp(InfoTimeAnim); else d.fadeOut(InfoTimeAnim); // Hide Actual (SLIDE or FADE)
		
		if(InfoAnim=="slide") var show = setTimeout( function(){ e.slideDown(InfoTimeAnim); clearTimeout(show); }, InfoTimeAnim );  // Show Next SLIDE
		else var show = setTimeout( function(){ e.fadeIn(InfoTimeAnim); clearTimeout(show); }, InfoTimeAnim ); // Show Next FADE
			
	}
	var next = setTimeout( function() { Infos.start(); clearTimeout(next); } , InfoTime );
};

Infos.setConfig = function(Width,Height,BgColor,Anim,TimeAnim,Time,Nb){
	imgHeight = Number(c.height());
	InfoAnim = Anim;
	InfoNb = Number(Nb)-1;
	InfoTimeAnim = Number(TimeAnim);
	InfoTime = Number(Time)+(2*InfoTimeAnim);
	
	a.css({height: (Number(Height)+Number(imgHeight))+"px"});	
	b.css({"width": Width+"px", "height": Height+"px", "background-color": BgColor, "overflow": "hidden"});
};