var timer, timerb, btimer, ctimer;
var num = 0;
var numa = -1;
var numi = 0;
var nump = 0;

function slideSwitch() {
var $active = $('#visuel IMG.active');

if ($active.length == 0) $active = $('#visuel IMG:last');

var $next = $active.next().length ? $active.next() : $('#visuel IMG:first');
$active.addClass('last-active');

$next.css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 500, function() {
		$active.removeClass('active last-active');
		});
}


$(function() {
associes();
setInterval("slideSwitch()", 3000);
timer = setInterval("actus()", 3000);
timerb = setInterval("associes()", 2000);
btimer = true;
ctimer = true;
});


function actus() {

if ((num+1) % numact != num) {
	$('#actus' + num).hide();
	num = (++num % numact);
	$('#actus' + num).show();
	}

if ((nump+1) % numpar != nump) {
	$('#partenaires_slide' + nump).hide();
	nump = (++nump % numpar);
	$('#partenaires_slide' + nump).show();
	}

return;
}


function associes() {

numa = (++numa % tass.length);
var img = tass[numa];
var url = turl[numa];
var tgt;

var pre = Math.floor(img%100);
pre = (pre<10 ? '0' + pre : pre);

img = 'medias/0' + Math.floor(img/100) + '/lo_' + pre + '/' + img + '.png';
tgt = (url!='' ? '_blank' : '_self');
url = (url!='' ? url : 'javascript:void(0)');


document.getElementById("imgass").src = img;
document.getElementById("urlass").target = tgt;
document.getElementById("urlass").href = url;

return;
}


function slide_ass(val) {

if (val & !btimer) {
	timerb = setInterval("associes()", 3000);
	}
if (!val) {
	clearInterval(timerb);
	btimer = false;
	}

return;
}


function slide_actus(val) {
if (val & !ctimer) {
	timer = setInterval("actus()", 3000);
	}
if (!val) {
	clearInterval(timer);
	ctimer = false;
	}

return;
}


