jQuery.noConflict();

// FONCTIONS COOKIE
function EcrireCookie(nom, valeur) {
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}	
function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(nom) {
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

// GESTION TAILLE
taille=LireCookie("aze_taille");
if (taille==null) { taille=0; } // Le cookie aze_taille n'existe pas, initialiser taille

function agrandir() {
	if (taille<2) {
	jQuery(".taille_"+taille).hide();
	taille++;
	calcul_taille(); }
}
function reduire() {
	if (taille>-2) {
	jQuery(".taille_"+taille).hide();
	taille--;
	calcul_taille(); }
}

// GESTION DIAPO
var boucle_diapo;
var $class_diapo = 0;
var current_diapo = 0;

function run_diapo() {
	jQuery(".diapo").eq(current_diapo).fadeOut(4000);
	current_diapo++;
	if (current_diapo == $class_diapo.length) current_diapo = 0;
	jQuery(".diapo").eq(current_diapo).fadeIn(2000);
}

function activation_diapo(class_diapo) {
	$class_diapo = jQuery(class_diapo);
	jQuery(class_diapo).eq(0).fadeIn(2000);
	if ($class_diapo.length > 1) boucle_diapo = window.setInterval(run_diapo, 15000);
}

// GESTION TOTEM
function activation_totem() {
	jQuery("#acces").animate({ width: "100%", opacity: 0.8 }, 1000, "swing");
	jQuery("#telechargement").animate({ width: "100%", opacity: 0.8 }, 1000, "swing");
	jQuery("#acces").bind("mouseenter",function(){ 
		jQuery("#acces").stop();
		jQuery("#acces").animate({ width: "100%", opacity: 1 }, 250, "swing");
	}).bind("mouseleave",function(){
		jQuery("#acces").animate({ width: "100%", opacity: 0.8 }, 1000, "swing");
	});
	jQuery("#telechargement").bind("mouseenter",function(){
		jQuery("#telechargement").stop();
		jQuery("#telechargement").animate({ width: "100%", opacity: 1 }, 250, "swing");
	}).bind("mouseleave",function(){
		jQuery("#telechargement").animate({ width: "100%", opacity: 0.8 }, 1000, "swing");
	});
}

function init_totem() {
	jQuery("#acces").animate({ width: "100%", opacity: 0.4 }, 3000, "swing");
	jQuery("#telechargement").animate({ width: "100%", opacity: 0.4 }, 3000, "swing");
	setTimeout('activation_totem();',16000);
}
