var
  t1,
  tickerMarkerTotal = 11,
  tickerSlideTime = 1000,
  tickerPauseTime = 4000,
  tickerMarker,haut=4;

function windowload(Total){
	tickerMarkerTotal=Total;
  tickerMarker = 1;
 
	t1= xGetElementById('tickerContainer1');
	xBackground(t1,'#fff');
    xResizeTo(t1,780,25);
    xMoveTo(t1,0,117);
    xShow(t1);
  
	tfc=xFirstChild(t1);
	xBackground(tfc,'#fff');
    xMoveTo(tfc,0, xHeight(xParent(tfc)));
    xShow(tfc);
    // use the rate-type you like:
//    slideRate = cbeSlideRateLinear;
//    slideRate = cbeSlideRateSine;
//    slideRate = cbeSlideRateCosine;
    //addEventListener('slideEnd', tickerControl);
	//tfc.onslideend=tickerControl;
  	xs1 = new tickerControl(tfc, 1);
	xs1.run();
}

function tickerControl(tContent, slide) {

	var ai = 0; // current action index of seq
	var stop = true;
	var running = false;

function runSeq(){
	if (stop) {
      running = false;
      return;
    }
	//if (this.onslideend) this.onslideend = null;
	tContent.onslideend = runSeq;
  
if (slide) {
    if (tickerMarker > tickerMarkerTotal) {
		tickerMarker = 1;
		haut=4;
		xMoveTo(tContent,0,0);
    }
    var marker = xGetElementById('m' + tickerMarker);
	setTimeout(runSeq, tickerPauseTime);
	
	xMoveTo(tContent,xWidth(xParent(tContent)),haut);
    xSlideTo(tContent, 0,haut, tickerSlideTime);
    ++tickerMarker;
	haut=haut-25;
  }  
  else setTimeout(runSeq, tickerPauseTime);
}
	this.run = function(si)
  {
    if (!running) {
      stop = false;
      running = true;
      runSeq();
    }
  }
  this.stop = function()
  {
    stop = true;
  }
}

function PopupImage(img) {
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');
	w.document.write("<HTML><HEAD><TITLE>CG43 &gt; Actualités</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+20,document.images[0].height+35); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><table width=100% height=100% cellspacing=0 cellpadding=0><tr><td align=center valign=middle><IMG src='"+img+"' border=0 onclick=\"window.close();\"></td></tr></table>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function PopupCentrer(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}