$(document).ready(function() {
	//Activate FancyBox
	$("a.custom_1").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut': 500,
		'frameWidth' :	600,
		'frameHeight' :	570
	});
	
	$("a#custom_2").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut': 500,
		'frameWidth' :	600,
		'frameHeight' :	550
	});
	
	$("a#custom_3").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut': 500,
		'frameWidth' :	450,
		'frameHeight' :	250
	});
	
	$("a.custom_4").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut': 500,
		'frameWidth' :	420,
		'frameHeight' :	150
	});
	
	$('ul.tabNav a').click(function() {
		if (!$(this).hasClass('noop')) {
			var curChildIndex = $(this).parent().prevAll().length + 1;
			$(this).parent().parent().children('.current').removeClass('current');
			$(this).parent().addClass('current');
			$(this).parent().parent().next('.tabContainer').children('.current').slideUp('fast', function(){
				$(this).removeClass('current');
				$(this).parent().children('div:nth-child(' + curChildIndex + ')').slideDown('normal', function(){
					$(this).addClass('current');
				});
			});
		}
		return false;								
	});
	
	$('a.suivant').click(function() {
		var element = $(this).attr('rel');
		var curLink = $('#'+element);
		
		var curChildIndex = curLink.parent().prevAll().length + 1;
		curLink.parent().parent().children('.current').removeClass('current');
		curLink.parent().addClass('current');
		curLink.parent().parent().next('.tabContainer').children('.current').slideUp('fast', function(){
			$(this).removeClass('current');
			$(this).parent().children('div:nth-child(' + curChildIndex + ')').slideDown('normal', function(){
				$(this).addClass('current');
			});
		});
		return false;								
	});
	
	if (typeof($('#actualite').innerfade) == 'function') {
		$('#actualite').innerfade({
			animationtype: 'fade',
			speed: 750,
			timeout: 4000,
			type: 'sequence',
			containerheight: '77px'
		});
	}
});

function getGroupItems(opts) {
	jQuery.each(imageList, function(i, val) {
        opts.itemArray.push(val);
    });
}

function display_bloc(e){
	$('#'+e).slideToggle('normal');
}

function popup(url){
	var w=655;
    var h=500;
    var scroll='no';
    var winl = (screen.width-w)/2;
    var wint = ((screen.height-h)/2)-30;
    var settings ='height='+h+',';
        settings +='width='+w+',';
        settings +='top='+wint+',';
        settings +='left='+winl+',';
        settings +='scrollbars=yes,';
        settings +='resizable=yes,';
        settings +='menubar=0,status=0';
    win=window.open(url,"popup",settings);
    if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}