function riddle(riddlerarray)
{
/***********************************************
* Encrypt Email script- Please keep notice intact
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/

//var emailriddlerarray=[121,111,117,64,121,111,117,114,100,111,109,97,105,110,46,99,111,109]
var encryptedemail_id32='' //variable to contain encrypted email 
for (var i=0; i<riddlerarray.length; i++)
 encryptedemail_id32+=String.fromCharCode(riddlerarray[i])

//document.write('<a href="mailto:'+encryptedemail_id32+'">Contact Us</a>')
document.write(encryptedemail_id32)
}

function riddle2(riddlerarray)
{
/***********************************************
* Encrypt Email script- Please keep notice intact
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/

//var emailriddlerarray=[121,111,117,64,121,111,117,114,100,111,109,97,105,110,46,99,111,109]
var encryptedemail_id32='' //variable to contain encrypted email 
for (var i=0; i<riddlerarray.length; i++)
 encryptedemail_id32+=String.fromCharCode(riddlerarray[i])

//document.write('<a href="mailto:'+encryptedemail_id32+'">Contact Us</a>')
window.location.assign(encryptedemail_id32)
}

function imprimer(lang){
	if (window.print) { window.print(); } 
	else if (lang == "fr") { alert("Votre navigateur n'est pas compatible avec l'impression directe.\n\nPour imprimer, allez dans le menu Fichier de votre navigateur et choisissez \"Imprimer\"."); }
	else { alert("Your browser does not support direct printing.\n\nTo print, go to the File menu of your browser and select \"Print\"."); }
}

/* bannières */
function feedBan(HtmlDivID, flash, image, alt, link, banWidth, banHeight, target) {
	var ctnr = document.getElementById(HtmlDivID);
	var img = '';
	if (target != '') {
		img = '<a href="' + link + '" target="' + target + '"><img src="' + image + '" alt="' + alt + '" />';
	} else {
		img = '<a href="' + link + '"><img src="' + image + '" alt="' + alt + '" />';
	}


	if (flash == "") {
		ctnr.innerHTML = img;
	} else {
		var so = new SWFObject(flash, "banner", banWidth, banHeight, "7.0.0", "#FEFCF1");
		so.write(HtmlDivID);
		if (so.write(HtmlDivID) == false) ctnr.innerHTML = img;
	}
	ctnr.style.display = "block";
}

/***********************************************
* ShowHide layer/
* **********************************************/

function multiClass(eltId) {
	arrLinkId = new Array('_0','_1','_2','_3');
	intNbLinkElt = new Number(arrLinkId.length);
	arrClassLink = new Array('current','ghost');
	strContent = new String()
	for (i=0; i<intNbLinkElt; i++) {
		strContent = "menu"+arrLinkId[i];
		if ( arrLinkId[i] == eltId ) {
			document.getElementById(arrLinkId[i]).className = arrClassLink[0];
			document.getElementById(strContent).className = 'on content';
		} else {
			document.getElementById(arrLinkId[i]).className = arrClassLink[1];
			document.getElementById(strContent).className = 'off content';
		}
	}	
}

/***********************************************
* ShowHide textfield/
* **********************************************/

	function hideDefaultText(field, password) {
	alert(field.value);
}

function hideDefaultText(field, password) {
	if (field.value == password) {
		field.value = "";
	}
}

function showDefaultText(field, password) {
	if (field.value == "") {
		field.value = password;
	}
}

/***********************************************
* ShowHide print/
* **********************************************/

var strTitle = encodeURIComponent(document.title);
var strUrl = encodeURIComponent(document.location.href);

function imprimer() {
	if (window.print) { window.print(); }
	else if (lang == "fr") { alert("Votre navigateur n'est pas compatible avec l'impression directe.\n\nPour imprimer, allez dans le menu Fichier de votre navigateur et choisissez \"Imprimer\"."); }
	else { alert("Your browser does not support direct printing.\n\nTo print, go to the File menu of your browser and select \"Print\"."); }
}

function printPage() {
	imprimer();
}

/***********************************************
* Vidéos/
* **********************************************/
	var lang = 'fr';
	
	function playVideoExperience(target, file, image) {
		var so = new SWFObject("/medias/videos/player-licensed.swf", target, "320", "260", "0");

		so.addParam("allowfullscreen", "true");
		so.addParam('wmode', 'opaque');
		so.addVariable('file', file);
		so.addVariable('image', image);
		so.addVariable("displayheight", "236");
		so.addVariable("width", "320");
		so.addVariable("backcolor", "0x2a2a2a");
		so.addVariable("frontcolor", "0xCCCCCC");
		so.addVariable("lightcolor", "0x777777");
		so.addVariable('title', 'jump');
		so.addVariable("width", "320");

		so.write(target);
		if (wmode == true) so.addParam("wmode", "opaque");
		if (autoplay) so.addVariable("autostart", "true");
		so.write(target);
		if (so.write(target) == false) disableVideo(target);
	}

	function playVideoMembre(target, file, image) {
		var so = new SWFObject("/medias/videos/player-licensed.swf", target, "300", "200", "0");

		so.addParam("allowfullscreen", "true");
		so.addParam('wmode', 'opaque');
		so.addVariable('file', file);
		so.addVariable('image', image);
		so.addVariable("displayheight", "236");
		so.addVariable("width", "320");
		so.addVariable("backcolor", "0x2a2a2a");
		so.addVariable("frontcolor", "0xCCCCCC");
		so.addVariable("lightcolor", "0x777777");
		so.addVariable('title', 'jump');
		so.addVariable("width", "320");

		so.write(target);
		if (wmode == true) so.addParam("wmode", "opaque");
		if (autoplay) so.addVariable("autostart", "true");
		so.write(target);
		if (so.write(target) == false) disableVideo(target);
	}


	function disableVideo(target) {
		var ctnr = document.getElementById(target);
		var txt = '<span>Le lecteur Adobe Flash doit être installé sur votre navigateur pour visualiser nos vidéos.<br /><br /><a href="http://www.adobe.com/go/getflashplayer" target="_blank">Téléchargez la dernière version ici</a></span>';
		if (lang == "en") txt = '<span>Adobe Flash Player must be installed on your browser to watch our videos.<br /><br /><a href="http://www.adobe.com/go/getflashplayer" target="_blank">Download the latest version here</a></span>'
		ctnr.className += " vidBoxMsg";
		ctnr.innerHTML = txt;
	}

/***********************************************
* Image menu/
* **********************************************/
	
	function feedmenu(control, srcImage) {
 
		var divContainer = $(control).parent().parent().parent();
		var controlImage = $(divContainer).children(":first-child");

		if ($(controlImage)) {
			$(controlImage).attr("src", srcImage);
		}

}


/***********************************************
* DoInsertImage() - Insère la photo dans le frame principal */
/* **********************************************/
function DoInsertImage(source, titre) {

//    var ObjCadre = document.getElementById("cphContenu_CadrePhoto");
//    if (ObjCadre == null) {
//        ObjCadre = document.getElementById("CadrePhoto");
//    }

	var aObjCadre = document.getElementById("cphContenu_aCadrePhoto");
	if (aObjCadre == null) {
		aObjCadre = document.getElementById("aCadrePhoto");
	}

	ObjCadre.src = source;
	ObjCadre.alt = titre;

	aObjCadre.href = source;
	aObjCadre.title = titre;
   }


   /***********************************************
   * FAQ */
   /* **********************************************/

   function ToggleFAQ(QuestionID, AnswerID) {
	var Answer = document.getElementById(AnswerID);
	var Question = document.getElementById(QuestionID);

	if (Question != null && Answer != null) {
		if (Answer.style.display == "block") {
			Answer.style.display = "none";
			Question.className = "faqinactif";
		}
		else {
			Answer.style.display = "block";
			Question.className = "faqactif";
		}
	}
   }
   
   /***********************************************
   * Menu gauche accordion */
   /* **********************************************/
   
   ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='/medias/communs/plus.png' class='statusicon' />", "<img src='/medias/communs/minus.png' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

/***********************************************
* Calendrier */
/* **********************************************/

function showWork() {
	clientWorkPage = document.client.clientselect.selectedIndex
	if (document.client.clientselect.options[clientWorkPage].value != "none") {
		//pass .value into work(which), then call the work function;
	}
}
function work(which) {
	document.getElementById('calendrier1').style.display = 'none';
	document.getElementById('calendrier2').style.display = 'none';
	document.getElementById(which).style.display = 'block';
}

/***********************************************
* DoInsertImage() - Insère la photo dans le frame principal
/* **********************************************/

function DoInsertImage(iImgName, iImgDesc, iImgPhotographe) {
    var ObjCadre = document.getElementById("cphContenu_CadrePhoto");

	ObjCadre.src = iImgName;
	ObjCadre.alt = iImgDesc;

}


function popupMapFiche(typeFiche, id) {
	window.open("/popupmap.php?TypeFiche=" + typeFiche + "&FicheID=" + id, "", "width=930,height=700");
}

function popupMapCircuit(id) {
	window.open("/popupmapCircuit.php?ID=" + id, "", "width=930,height=700");
}

function changePage(page) {
	document.frmGalerie.curPage.value = page;
	document.frmGalerie.submit();
}


function expandImage(photoID, categoryID, langue) {
	url = "/visionneuse.php?ID=" + photoID + "&GalerieID=" + categoryID + "&amp;L=" + langue;
	window.open(url, "", "width=534,height=630");
}


var strTitle = encodeURIComponent(document.title);
var strUrl = encodeURIComponent(document.location.href);

$(document).ready(function () {
    //script pour actif du menu gauche
    $(".glossymenu a.actif").next(".submenu").css("display", "block");
});
