
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\"."); }
}

/***********************************************
* 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;
    }
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DoInsertImage() - Insère la photo dans le frame principal
*/
function DoInsertImage(iImgName,iImgDesc,iImgPhotographe)
{
	var ObjCadre=document.getElementById("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);

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();
}

function ajouterDestination(type, ID) {
	document.PlannedMap.itineraireAction.value = 1;
	document.PlannedMap.itineraireType.value = type;
	document.PlannedMap.itineraireID.value = ID;
	document.PlannedMap.submit();
}

function retirerDestination(type, ID) {
	document.PlannedMap.itineraireAction.value = 2;
	document.PlannedMap.itineraireType.value = type;
	document.PlannedMap.itineraireID.value = ID;
	document.PlannedMap.submit();
}

function ajouterCarnet(type, ID) {
	document.FormCarnetVoyage.carnetAction.value = 1;
	document.FormCarnetVoyage.carnetType.value = type;
	document.FormCarnetVoyage.carnetID.value = ID;
	document.FormCarnetVoyage.submit();
}

function retirerCarnet(type, ID) {
	document.FormCarnetVoyage.carnetAction.value = 2;
	document.FormCarnetVoyage.carnetType.value = type;
	document.FormCarnetVoyage.carnetID.value = ID;
	document.FormCarnetVoyage.submit();
}


/***********************************************
* ShowHide boutique/
* **********************************************/

function layerSetup(id,visibility){
if(document.getElementById){
this.obj = document.getElementById(id).style;
this.obj.visibility = visibility;
return this.obj;}
else if(document.all){
this.obj = document.all[id].style;
this.obj.visibility = visibility;
return this.obj;}
else if(document.layers){
this.obj = document.layers[id];
this.obj.visibility = visibility;
return this.obj;}
}
function visVisible(param){
new layerSetup(param,'visible');
}

function visHidden(param){
new layerSetup(param,'hidden');
}

/***********************************************
/* vidéos et flash */
/* **********************************************/
function playVideo(){
//var s1 = new SWFObject("/medias/videos/player-licensed.swf","playlist","316","280","7");
//s1.addParam("allowfullscreen","true");
//s1.addVariable("file", "/medias/videos/videos.xml");
//s1.addVariable("image","/medias/videos/preview.jpg");
//s1.addVariable("backcolor","0xbd2905");
//s1.addVariable("frontcolor","0xefe6c7");
//s1.addVariable("lightcolor","0x707631");
//s1.addVariable('title','jump');
//				 
//s1.addVariable('playlistsize','50');
//s1.addVariable('playlist','bottom');
//s1.write('preview'); 
}

/***********************************************
/* onglet */
/* **********************************************/

function ShowImages() {
document.getElementById('photos').style.display = "none";
document.getElementById('films').style.display = "block";
}
function ShowVideos() {
document.getElementById('films').style.display = "none";
document.getElementById('photos').style.display = "block";
}

function ShowHide1() {
document.getElementById('forfait1').style.display = "block";
document.getElementById('forfait2').style.display = "none";
document.getElementById('forfait3').style.display = "none";
document.getElementById('forfait4').style.display = "none";
}

function ShowHide2() {
document.getElementById('forfait1').style.display = "none";
document.getElementById('forfait2').style.display = "block";
document.getElementById('forfait3').style.display = "none";
document.getElementById('forfait4').style.display = "none";
}

function ShowHide3() {
document.getElementById('forfait1').style.display = "none";
document.getElementById('forfait2').style.display = "none";
document.getElementById('forfait3').style.display = "block";
document.getElementById('forfait4').style.display = "none";
}

function ShowHide4() {
document.getElementById('forfait1').style.display = "none";
document.getElementById('forfait2').style.display = "none";
document.getElementById('forfait3').style.display = "none";
document.getElementById('forfait4').style.display = "block";
}

/**************************************************************/
/**************************************************************/
/**************************************************************/
/********** DIFFERENTS EFFETS & FONCTIONS *********************/
/**************************************************************/
/**************************************************************/
/**************************************************************/

$(document).ready(function (e) {

    /* Boutons Action MenuLogo */
    $("#btOrganisez, #btCartes, #btZone").hover(function () {
        $(this).animate({ opacity: 0.7 }, 200);
    }, function () {
        $(this).animate({ opacity: 1 }, 200);
    });

    /* ANIMATION LOGO EXCEPTE POUR IE6 A CAUSE DE LA TRANSPARENCE DU LOGO */
    if (!($.browser.msie && $.browser.version == "6.0")) {
        $("#ImgLogo").css({ 'position': 'absolute', 'top': 0, 'opacity': 0 });

        $("#ImgLogo").animate({
            top: '+=43',
            opacity: 1
        }, 600);
    }

    /* OPACITE DU FOOTER */
    $("#footerOpacity").css({ 'opacity': 0.6 });


    //Change vidéo YouTube au click
    function YouTubeFct() {

        $("#YoutubeList li:first a").addClass("selected");

        $("#YoutubeList li a").click(function () {

            $("#YoutubeList li").each(function () {
                if ($(this).find("a").is(".selected")) {
                    $(this).find("a").removeClass("selected");
                }
            });

            $(this).addClass("selected");

            var link = $(this).attr("href");

            var s = '<object width="370" height="305">';
            s += '<param name="movie" value="' + link + '&f=user_favorites&amp;c=ytapi-google-jsdemo&amp;app=youtube_gdata&amp;hl=en_US&amp;fs=1?rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999"></param>';
            s += '<param name="allowFullScreen" value="true"></param>';
            s += '<param name="wmode" value="transparent"></param>';
            s += '<param name="allowscriptaccess" value="always"></param>';
            s += '<embed src="' + link + '&f=user_favorites&amp;c=ytapi-google-jsdemo&amp;app=youtube_gdata&amp;hl=en_US&amp;fs=1?rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="370" height="305"></embed>';
            s += '</object>';


            //$("#YoutubePlayer").empty();
            $("#YoutubePlayer").html(s);
            $('YoutubePlayer').html(s);

            //alert(s);

            return false;
        });
    }


    //Zone médias
    if ($("#BLocMedias").length > 0) {
        //On charge le premier onglet
        var firsLi = $("#BLocMedias ul li:first").attr("id");
        $.ajax({
            url: '/' + firsLi + '.aspx',
            success: function (data) {
                $('#ZoneMediasContent').html(data);
            }
        });
    }

    $("#BLocMedias ul li").click(function () {

        var objC = $(this);
        //On enleve la classe .active existante
        $.each($("#BLocMedias ul li"), function () { $(this).removeClass("active"); });

        //On applique le mask de loading
        $("#ZoneMedias").MaskLoader();

        //Traitement de l'event
        var EventMedias = $(this).attr("id");

        //$(".arrondi").css({ behavior: 'url(/css/border-radius.htc)' });

        $.ajax({
            url: '/' + EventMedias + '.aspx',
            success: function (data) {

                $("#ZoneMedias").MaskLoader();
                $('#ZoneMediasContent').html(data);
                //On charge le JS pour la partie Youtube
                YouTubeFct();
                //On rajoute la classe .active pour l'élément courant
                objC.addClass("active");
            }
        });

        return false;
    });


    /* SLIDER EVENTS */
    if ($('#sliderEvent').length) {

        $("#sliderEvent").easySlider({
            continuous: false,
            prevId: 'prevBtn4',
            nextId: 'nextBtn4'
        });

        //fermeture de la popup
        $(".closePopUp").click(function () {
            $(".PopUpEvent").remove();
            return false;
        });


    }
    /* FIN SLIDER */


    /* Infolettre infobulle */
    $('a.bubbleLinkNewsletter').hover(
			function () { $(this).parents('div.Titre').find('div.bubbleLinkNewsletter_thumb:hidden').fadeIn(500); },
			function () { $(this).parents('div.Titre').find('div.bubbleLinkNewsletter_thumb:visible').fadeOut(500); }
		);
    $('a.bubbleLinkNewsletter').click(function (e) {
        e.preventDefault();
    });



});


/***********************************************
* Vidéos/
* **********************************************/
var lang = 'fr';

function playVideoForfait(target, file, image) {
	var so = new SWFObject("/player/player-licensed.swf", "player", "234", "200", "8");

	so.addParam("allowfullscreen", "true");
	so.addParam('wmode', 'opaque');
	so.addVariable('file', file);
	so.addVariable('image', image);
	so.addVariable('title', 'jump');
	so.addVariable("width", "234");

	//so.addVariable('skin', '/player/styleplayer.swf&frontcolor=ffffff&lightcolor=A1A477&backcolor=A1A477');
	//so.addVariable("width", "234");
	so.addVariable("volume", "100");
	so.addVariable("usefullscreen", "true");
	//so.addParam("allowfullscreen", "true");
	//so.addVariable("backcolor", "0x536420");
	//so.addVariable("frontcolor", "0xffffff");
	//so.addVariable("lightcolor", "0xA1A477");

	//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;
}

function SetSelected(strField) {
    var field = document.getElementById(strField);
    if (field) {
        field.select();
    }
}
