function swf_menu(tXml, tRub, tImgLst) {
	document.write('<object type="application/x-shockwave-flash" data="img/swf/menu.swf" width="650" height="350">\n');
	document.write('<param name="movie" value="img/swf/menu.swf" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<param name="FlashVars" value="fichier='+tXml+'&menu_act='+tRub);
	if(tImgLst != "") {
		document.write('&imgLst='+tImgLst);
	}
	document.write('" />\n');
	document.write('</object>\n');
}

function form_contact_verifie() {
	if (document.forms[0].contact_tel.value.length == 0 && document.forms[0].contact_email.value.length == 0) {
		alert("Merci d'indiquer un numŽro de téléhone ou une adresse e-mail pour vous contacter.");
		return false;
	}
	return true;
}

function affichePhotoGr(image, titre)
{
  fichier = 'index.php';
  window.open(fichier,'', 'menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=700,height=600');
}

function actuImgAffiche(tImg, tWidth, tHeight) {
	var el = document.getElementById("visionneuse");
	el.className = 'reference_img_on';
	var img = document.getElementById("visionneuse_img");
	img.src = tImg;
	img.width = tWidth;
	img.height = tHeight;
}

function actuImgFerme() {
	var el = document.getElementById("visionneuse");
	el.className = 'reference_img_off';
}

function refImgAffiche(tId) {
	gImgAct = tId;
	var el = document.getElementById("visionneuse");
	el.className = 'reference_img_on';
	el = document.getElementById("visionneuse_img");
	el.src = gImgLst[gImgAct][0];
	el.width = gImgLst[gImgAct][1];
	el.height = gImgLst[gImgAct][2];
	el = document.getElementById("visionneuse_txt");
	el.innerHTML = gImgLst[gImgAct][3];
}

function refImgPrecedente() {
	gImgAct--;
	if(gImgAct<0) {
		gImgAct = gImgLst.length-1;
	}
	refImgAffiche(gImgAct);
}

function refImgSuivante() {
	gImgAct++;
	if(gImgAct>=gImgLst.length) {
		gImgAct = 0;
	}
	refImgAffiche(gImgAct);
}

function refImgFerme() {
	var el = document.getElementById("visionneuse");
	el.className = 'reference_img_off';
}

function ref_info_change_affichage() { 
	var txt = document.getElementById('ref_intro_txt'); 
	if(txt.className == 'masque') {
		txt.className = 'affiche';
	} else {
		txt.className = 'masque';
	}
	return true;
}

function projet_hasard_init(tId) {
	setInterval(projet_hasard_change, 6*1000)
	projet_hasard_affiche(0)
}

function projet_hasard_change() {
	var el = document.getElementById("visionneuse");
	if(el != null) {
		if(el.className == 'reference_img_on') {
			return 0;
		}
	}
	gProjetHasard++;
	if(gProjetHasard>=gProjetHasardLst.length) {
		gProjetHasard = 0;
	}
	$('#projet_hasard_div').fadeOut('slow', function() {
	   	projet_hasard_affiche(gProjetHasard)
	});
}

function projet_hasard_affiche(tId) {
	var projetHtml = '<a href="'+gProjetHasardLst[tId][0]+'" title="'+gProjetHasardLst[tId][1]+'"><img src="'+gProjetHasardLst[tId][2]+'" width="'+gProjetHasardLst[tId][3]+'" height="'+gProjetHasardLst[tId][4]+'" alt="vignette du projet '+gProjetHasardLst[tId][1]+'" /></a>'
	projetHtml += '<h2>'+gProjetHasardLst[tId][1]+'</h2>'
	projetHtml += '<p>'+gProjetHasardLst[tId][5]+'</p>\n'
	projetHtml += '<p class="plus_info"><a href="'+gProjetHasardLst[tId][0]+'">Plus d\'info sur ce projet</a></p>\n'
	var el = document.getElementById("projet_hasard_div");
	el.innerHTML = projetHtml
	$('#projet_hasard_div').fadeIn();
}
