/*
	Publicité Page Accueil PassionLed
	Version beta 1.1
	Last revision: 04/05/11
	
*/

window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;duree = 2000;nIndex=0;
var pubimg= new Array(), lientxt= new Array(), vPub=0;

function so_init()
{
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement('link');
	css.setAttribute('href','PubPassionled-style.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);
	imgs = d.getElementById('PubLed').getElementsByTagName('img');

        pubimg = new Array(d.getElementById('PubImage1'),d.getElementById('PubImage2'),d.getElementById('PubImage3'),d.getElementById('PubImage4'));
        lientxt = new Array(d.getElementById('LienTxt1'),d.getElementById('LienTxt2'),d.getElementById('LienTxt3'),d.getElementById('LienTxt4'));
	
        imgs[0].style.display = 'block';
	

	vPub=setTimeout(defilimg,duree);
}
function AffPub(ImgSelect) {
    clearTimeout(vPub);
    for(i=0;i<imgs.length;i++){
        pubimg[i].style.display = 'none';
        imgs[i].style.display = 'none';
        lientxt[i].style.backgroundColor = '#7AA6C8';
    }
    pubimg[ImgSelect].style.display = 'block';
    imgs[ImgSelect].style.display = 'block';
    lientxt[ImgSelect].style.backgroundColor = '#28597E';
   /* document.write(ImgSelect); */
    current = ImgSelect;

}
function ArrPub () {
    clearTimeout(vPub);
}

function EffPub (ImgSelect) {
  vPub=setTimeout(defilimg,duree);

}

function defilimg(){
        nIndex = imgs[current+1]?current+1:0;

        pubimg[nIndex].style.display = 'block';
	imgs[nIndex].style.display = 'block';
        lientxt[current].style.backgroundColor = '#7AA6C8';

        vPub=setTimeout(defilimg,duree);
        
	imgs[current].style.display = 'none';
        pubimg[current].style.display = 'none';
        current = nIndex;
        lientxt[nIndex].style.backgroundColor = '#28597E';

}

