window.addEvent('domready', function() {
	
	// rollOvers pour les images
	// Application : class="roll"

	//preload images
	var aPreLoad = new Array();
	var aPreLoadi = 0;
	
	//do rollover
	$$('img.roll', 'input.roll').each(function(el){
		//let's preload
		aPreLoad[aPreLoadi] = new Image();
		aPreLoad[aPreLoadi].src = el.src.replace(el.src.replace(/_off([._])/, '_on$1'));
		aPreLoadi++;
	
		el.addEvent('mouseover',function(){
			this.setAttribute('src',this.src.replace(/_off([._])/, '_on$1'));
		});
	
		el.addEvent('mouseout',function(){
			this.setAttribute('src',this.src.replace(/_on([._])/, '_off$1'));
		});
	});


	// tooltip on apple
	var appleHelpTips = new RedTips('.help', {offsets: {x: -100, y: 0}, fixed: true });
	
	// tooltip on apple
	var bigAppleHelpTips = new RedTips('.helpbig', {offsets: {x: -80, y: 17}, fixed: true });

});

// rollOvers for Text
// Application : class="rollText"
window.addEvent('domready',function() {
	$$('.rollText').each(function(el){
		var original = el.getStyle('color');
		var morph = new Fx.Morph(el,{ 'duration':'300' });
		el.addEvents({
			'mouseenter' : function() { morph.start({ 'color':'#ff8c00' }) },
			'mouseleave' : function() { morph.start({ 'color': original }) }
		});
	});
});


// Shadowbox
Shadowbox.loadSkin('btfs', '../_java/shadowbox/skin'); // use the "classic" skin
Shadowbox.loadLanguage('en', '../_java/shadowbox/lang'); // use the English language
Shadowbox.loadPlayer(['iframe', 'img', 'swf'], '../_java/shadowbox/player'); // use img and qt players

window.addEvent('domready', function() {
	var options = {
		animate: false,
		modal: true,
        handleOversize:     'none',
        handleUnsupported:  'remove',
        autoplayMovies:     false
    };

	Shadowbox.init(options);
});

var current_popup = false;
var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
function show_popup(id) {
	document.getElementById('overlay').style.display = 'block';
	document.getElementById('popups').style.display = 'block';
	document.getElementById(id).style.display = 'block';
	document.getElementById(id).style.visibility = 'visible';
	current_popup = id;
	if (isIE6) toggleSelects('none');
	
}
function hide_popup() {
	document.getElementById('overlay').style.display = 'none';
	document.getElementById('popups').style.display = 'none';
	if (current_popup != false) {
		document.getElementById(current_popup).style.display = 'none';
		document.getElementById(current_popup).style.visibility = 'hidden';
	}
	if (isIE6) toggleSelects('');
}

function toggleSelects(action) {
	var selects = document.getElementsByTagName('select');

	for(var i=0; i < selects.length; i++) {
		selects[i].style.display=action;
	}
}
