
//---------------------------------------------------------------------------------------------------------
// Notícies
//---------------------------------------------------------------------------------------------------------

var tickerEntries = new Array(	
"<a href=news_more.asp?id=130 target=_top><b>Jean Marc Caron, silver in the French Nationals</b></a>",	
"<a href=news_more.asp?id=130 target=_top><b>Nordic Open</b></a>",	
"<a href=news_more.asp?id=129 target=_top><b>PWC Italie, Niviuk sur le podium</b></a>",
"<a href=news_more.asp?id=128 target=_top><b>Essai ARTIK 2</b></a>",
"<a href=news_more.asp?id=126 target=_top><b>Niviuk pousse</b></a>",
"<a href=news_more.asp?id=124 target=_top><b>Petra Slivova signe chez Niviuk</b></a>",
"<a href=news_more.asp?id=123 target=_top><b>Le championnat d’Europe 2010</b></a>",
"<a href=news_more.asp?id=118 target=_top><b>Sebastian Merino, 111km avec sa PEAK 25</b></a>",
"<a href=news_more.asp?id=117 target=_top><b>Niviuk est venu, a vu et a vaincu sur la 1ère étape de la PWC du Brésil !!!</b></a>",
"<a href=news_more.asp?id=116 target=_top><b>Felipe Razende sous Icepeak 3, Bright Paragliding Open 2010</b></a>",
"<a href=news_more.asp?id=115 target=_top><b>2 podiums Niviuk à Valadares 2010</b></a>",
"<a href=news_more.asp?id=109 target=_top><b>L'Icepeak4... Révélation ! Coupe d'Italie 2010</b></a>",
"<a href=news_more.asp?id=108 target=_top><b>Double victoire Niviuk, Open Brasileiro 2010</b></a>",
"<a href=news_more.asp?id=107 target=_top><b>Podium de Niviuk Monarca 2010</b></a>",
"<a href=news_more.asp?id=106 target=_top><b>L'équipe Niviuk s'agrandit</b></a>",
"<a href=news_more.asp?id=105 target=_top><b>Bresil - XCEARA 2009, Icepeak 3 et Peak présentes</b></a>",
"<a href=news_more.asp?id=104 target=_top><b>Argentina, avec le coeur</b></a>",
"<a href=news_more.asp?id=103 target=_top><b>Une consécration pour la PEAK en serial class pour la saison de compétition Brésilienne.</b></a>",
"<a href=news_more.asp?id=100 target=_top><b>Artik 2</b></a>",
"<a href=news_more.asp?id=99 target=_top><b>championnat Espagnol 2009 </b></a>",
"<a href=news_more.asp?id=97 target=_top><b>Open Argentino 2009</b></a>",
"<a href=news_more.asp?id=96 target=_top><b>Cuope Icare 2009</b></a>"
);

//---------------------------------------------------------------------------------------------------------
// Configuració
//---------------------------------------------------------------------------------------------------------

var tickerWidth = 900;								// amplada (pixels)
var tickerDelay = 40;								// velocitat (+baix = +ràpid)
var tickerSpacer = " | ";							// separador entre notícies

var tickerBGColor = "#000000";						// color de fons
var tickerHLColor = "#000000";							// color de rollover (redefinit en els estils de la pàgina html)

var tickerFont = "Verdana, Arial, Helvetica";		// font (redefinit en els estils de la pàgina html)
var tickerFontSize = 10;							// tamany (pixels) (redefinit en els estils de la pàgina html)
var tickerFontColor = "#FFFFFF";						// color de la font (redefinit en els estils de la pàgina html)

var tickerBorderWidth = 0;							// amplada del filet (pixels)
var tickerBorderStyle = "white";					// estil del filet
var tickerBorderColor = "white";					// color del filet

//---------------------------------------------------------------------------------------------------------
// Funcions
//---------------------------------------------------------------------------------------------------------

var DOM = document.getElementById;
var IE  = document.all;
var NN4 = document.layers;

var iv, tickerID;
var tickerArea = new Array();
var tickerHeight = tickerFontSize + 8;

function tickerObject(obj, cont) {
  cont = cont ? 'document.' + cont + '.' : '';
  if(DOM) this.elem = document.getElementById(obj);
  else if(NN4) this.elem = eval(cont + 'document.' + obj);
  else if(IE) this.elem = document.all[obj];
  this.css = NN4 ? this.elem : this.elem.style;
  this.width = NN4 ? this.elem.document.width : this.elem.offsetWidth;
  this.css.width = this.width;
  this.left = this.css.left = tickerWidth;
  this.css.visibility = 'visible';
  this.move = false;
  return this;
}

function tickerNext() {
  if(!DOM && !IE && !NN4) return;
  var obj = tickerArea[tickerID];
  obj.left = obj.css.left = tickerWidth;
  obj.move = true;
}

function tickerMove() {
  if(!DOM && !IE && !NN4) return;
  for(var i = 0; i < tickerEntries.length; i++) {
    if(tickerArea[i].move) {
      if(tickerArea[i].left > -tickerArea[i].width) {
        tickerArea[i].left -= 2;
        tickerArea[i].css.left = tickerArea[i].left;
      }
      else tickerArea[i].move = false;
    }
  }
  if(tickerArea[tickerID].left + tickerArea[tickerID].width <= tickerWidth) {
    tickerID++;
    if(tickerID >= tickerEntries.length) tickerID = 0;
    tickerNext();
  }
}

function tickerStart(init) {
  if(!DOM && !IE && !NN4) return;
  if(tickerBGColor) {
    if(DOM) document.getElementById('ticker').style.backgroundColor = tickerBGColor;
    else if(NN4) document.ticker.bgColor = tickerBGColor;
    else if(IE) document.all.ticker.style.backgroundColor = tickerBGColor;
  }
  if(init) {
    tickerID = 0;
    tickerNext();
  }
  iv = setInterval('tickerMove()', tickerDelay);
}

function tickerStop() {
  if(!DOM && !IE && !NN4) return;
  clearInterval(iv);
  if(tickerHLColor) {
    if(DOM) document.getElementById('ticker').style.backgroundColor = tickerHLColor;
    else if(NN4) document.ticker.bgColor = tickerHLColor;
    else if(IE) document.all.ticker.style.backgroundColor = tickerHLColor;
  }
}

function tickerInit() {
  if(!DOM && !IE && !NN4) return;
  for(var i = width = 0; i < tickerEntries.length; i++) {
    tickerArea[i] = new tickerObject('tickerEntry' + (i+1), 'ticker.document.tickerContainer');
    tickerArea[i].css.top = 2;
    width += tickerArea[i].width;
  }
  if(width < tickerWidth) {
    i = tickerArea.length - 1;
    tickerArea[i].width += tickerWidth;
    tickerArea[i].css.width = tickerArea[i].width;
  }
  tickerStart(true);
}

window.onload = tickerInit;

//---------------------------------------------------------------------------------------------------------
// Construcció
//---------------------------------------------------------------------------------------------------------

document.write('<style> ' +
               '#ticker { ' +
               'width:' + (IE ? tickerWidth + tickerBorderWidth*2 : tickerWidth) + 'px; ' +
               'height:' + (IE ? tickerHeight + tickerBorderWidth*2 : tickerHeight) + 'px; ' +
               'cursor:default; ' +
               'float:left; ' +
               (NN4 ? 'position:relative; ' : '') +
               ((tickerBorderWidth && !NN4) ? 'border-width:' + tickerBorderWidth + 'px; ' : '') +
               ((tickerBorderStyle && !NN4) ? 'border-style:' + tickerBorderStyle + '; ' : '') +
               ((tickerBorderColor && !NN4) ? 'border-color:' + tickerBorderColor + '; ' : '') +
               '} ' +
               '#tickerContainer { ' +
               'position:absolute; ' +
               'width:' + ((IE || NN4) ? tickerWidth : 10000) + 'px; ' +
               'height:' + tickerHeight + 'px; ' +
               'clip:rect(0,' + tickerWidth + ',' + tickerHeight + ',0); ' +
               '} ' +
               '.clsTickerEntry { ' +
               'font-family:' + tickerFont + '; ' +
               'font-size:' + tickerFontSize + 'px; ' +
               'color:' + tickerFontColor + '; ' +
               '} ' +
               '</style>');

document.write('<div id="ticker" onMouseOver="tickerStop()" onMouseOut="tickerStart()">' +
               '<div id="tickerContainer">');

for(var i = 0; i < tickerEntries.length; i++) {
  document.write('<div id="tickerEntry' + (i+1) + '" style="position:absolute; visibility:hidden">' +
                 '<table border=0 cellspacing=0 cellpadding=0><tr>' +
                 '<td class="clsTickerEntry" nowrap>' + tickerEntries[i] +
                 ((tickerEntries.length > 1) ? '&nbsp;' + tickerSpacer + '&nbsp;' : '') +
                 '</td></tr></table></div>');
}
document.write('</div></div>');

//---------------------------------------------------------------------------------------------------------
