window.addEvent('load', function(){
	
	var urlpath = "";
	var mySlide = new Fx.Slide('entete').hide();
	$('op1').addEvent('click', function(e){
		var textLink = $('op2').getAttribute('src');
		if(textLink != (urlpath+'img/bulle-verte.png')){
			$('op2').setAttribute("src",(urlpath+"img/bulle-verte.png"))
			mySlide.toggle();
		} else {
		$('op2').setAttribute("src",(urlpath+"img/bulle.png"))
			mySlide.toggle();
		} 
		//e = new Event(e).stop();
		//mySlide.toggle();				
	});
	
// formulaire vip
/*$('in1').addEvent('click', function(e){
	if (this.value == 'Identifiant') { this.value=''; }
});

$('in1').addEvent('focus', function(e){
	if (this.value == 'Identifiant') { this.value=''; }
});

$('in1').addEvent('blur', function(e){
	if (this.value == '') { this.value='Identifiant'}
});

$('in2').addEvent('click', function(e){
	if (this.value == 'Code carte vip') { this.value=''; }
});

$('in2').addEvent('focus', function(e){
	if (this.value == 'Code carte vip') { this.value=''; }
});

$('in2').addEvent('blur', function(e){
	if (this.value == '') { this.value='Code carte vip'}
});*/

////////////////
var arrHeadlines = null; 	// array to hold headline objects
var idx = 0;

function Init()
{
    if ($('divHeadlines'))
    {
        // get all headlines
        arrHeadlines = $('divHeadlines').getElements('div[class=Headline]');	
        // convert time to milliseconds        
        if (arrHeadlines != null && arrHeadlines.length > 0)
        {
            // hide all
            for (var i = 0; i < arrHeadlines.length; i++)
            {
                var fx = new Fx.Morph(arrHeadlines[i], { duration:0, wait:false });
                fx.set({ 'opacity': 0 });
            }
            // show first link
            ShowHeadline();
        }
    }
}
 
function ShowHeadline()
{
    var oTargetDiv = arrHeadlines[idx];
    oTargetDiv.style.display = "block";   // make div appear
    var fx = new Fx.Morph(oTargetDiv, { duration:1000, wait:false });
    fx.start({ 'opacity': 1 });     // set opacity to visible
    // in X seconds time, hide this headline's div
    HideHeadline.delay(5000);
}
 
function HideHeadline()
{
    // get index of next headline to show
    var newIdx = idx + 1;
    if (newIdx >= arrHeadlines.length)
        newIdx = 0;    // reset index
    var oTargetDiv = arrHeadlines[idx];
    var fx = new Fx.Morph(oTargetDiv, { duration:1000, wait:false,
        onComplete:function(){
            oTargetDiv.style.display = "none"; idx = newIdx; ShowHeadline();
        }/*end onComplete*/ });
    fx.start({ 'opacity': 0 });     // set to fade out, on complete, show next headline
}
 
// call Init after everything loads
Init();///// 
});

