﻿// JavaScript Document


jQuery(document).ready(function ($) {
    gallery = $('#vwrGalThumbs').galleriffic({
        delay: 4000,
        imageContainerSel: '#vwrGalSlideshow',
        loadingContainerSel: '#vwrGalLoading',
        captionContainerSel: '#Caption'
    });

    var ImageCout=$("#promos_photo_thumbs > ul > li").size();
    gallery2 = $('#promos_photo_thumbs').galleriffic({
        delay: 3000,
        imageContainerSel: '#promos_photo_slide',
        loadingContainerSel: '#promos_photo_loading',
        captionContainerSel: '#promos_Caption'
    });
    if (ImageCout<= 1) {
        gallery2.pause();
    }

    /*var arrLangTxt = ""; 
    var arrLangTxtOver = "";*/

    lang = $("body").attr("class");

    var type_sejour_texte = $('#type_sejour_texte');
    function changerTexte(contenu) { $(type_sejour_texte).html(contenu); }

    if (lang == "fr") {
        arrLangTxt = new Array("En solo", "En amoureux", "En famille", "Entre ami(e)s", "Pour affaires", "En groupe organis&eacute;", "Pour un bal, mariage ou autre &eacute;v&eacute;nement sp&eacute;cial", "survolez<br/>les photos");
        arrLangTxtOver = new Array("Le conseiller du manoir", "Organisez votre séjour");
    } else {
        arrLangTxt = new Array("Solo", "Romantic", "Family", "Between friends", "For Business", "Groups", "For a prom, a wedding or a special event", "Move over<br/>photos");
        arrLangTxtOver = new Array("The Manor advisor", "Organise your stay");
    }


    /* Test de délai entre les boutons 

    $("#type_sejour_item_02", this).bind({
    mouseover: function () {
    changerTexte(arrLangTxt[0]);
    },
    mouseout: function () {
    setTimeout(function () {
    changerTexte(arrLangTxt[7]);
    }, 500);
    }
    });

    */


    $("#type_sejour_item_02").mouseover(function () { changerTexte(arrLangTxt[0]); });
    $("#type_sejour_item_02").mouseout(function () { changerTexte(arrLangTxt[7]); });

    $("#type_sejour_item_03").mouseover(function () { changerTexte(arrLangTxt[1]); });
    $("#type_sejour_item_03").mouseout(function () { changerTexte(arrLangTxt[7]); });

    $("#type_sejour_item_04").mouseover(function () { changerTexte(arrLangTxt[2]); });
    $("#type_sejour_item_04").mouseout(function () { changerTexte(arrLangTxt[7]); });

    $("#type_sejour_item_05").mouseover(function () { changerTexte(arrLangTxt[3]); });
    $("#type_sejour_item_05").mouseout(function () { changerTexte(arrLangTxt[7]); });

    $("#type_sejour_item_06").mouseover(function () { changerTexte(arrLangTxt[4]); });
    $("#type_sejour_item_06").mouseout(function () { changerTexte(arrLangTxt[7]); });

    $("#type_sejour_item_07").mouseover(function () { changerTexte(arrLangTxt[5]); });
    $("#type_sejour_item_07").mouseout(function () { changerTexte(arrLangTxt[7]); });

    $("#type_sejour_item_08").mouseover(function () { changerTexte(arrLangTxt[6]); });
    $("#type_sejour_item_08").mouseout(function () { changerTexte(arrLangTxt[7]); });



    $(".conseiller_manoir_01").colorbox({ width: "940px", height: "429px", iframe: true });
    $(".conseiller_manoir_02").colorbox({ width: "940px", height: "429px", iframe: true });
    $(".conseiller_manoir_03").colorbox({ width: "940px", height: "429px", iframe: true });
    $(".conseiller_manoir_04").colorbox({ width: "940px", height: "429px", iframe: true });
    $(".conseiller_manoir_05").colorbox({ width: "940px", height: "429px", iframe: true });
    $(".conseiller_manoir_06").colorbox({ width: "940px", height: "429px", iframe: true });
    $(".conseiller_manoir_07").colorbox({ width: "940px", height: "429px", iframe: true });


    /* calendrier */

    $.datepicker.regional['fr'] = {
        closeText: 'Fermer',
        prevText: '&#x3c;Préc',
        nextText: 'Suiv&#x3e;',
        currentText: 'Courant',
        monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
        monthNamesShort: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aoû', 'Sep', 'Oct', 'Nov', 'Déc'],
        dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
        dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
        dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
        weekHeader: 'Sm',
        dateFormat: 'dd/mm/yy',
        buttonText: 'Choisir une date',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''
    };
    $.datepicker.setDefaults($.datepicker.regional[lang]);


    $('#txtDate').datepicker({
        minDate: 0,
        showOn: 'both',
        buttonImage: '/medias/communs/icon_calendrier.png',
        buttonImageOnly: true,
        showAnim: 'slideDown'
    });
    $('#txtDate').datepicker('setDate', new Date());
	
	//Envoi sur le site de reservit
    $("#icone_fleche").click(function (e) {
        e.preventDefault();

        var dateText = $("#txtDate").val();
        var dateArray = dateText.split("/");
        var day = dateArray[0];
        var month = dateArray[1];
        var year = dateArray[2];

        if (lang == "en") {
            day = dateArray[1];
            month = dateArray[0];
        }


        var nbnights = $("#nuits").val();
        var numadult = $("#adultes").val();
        var nbchd = $("#enfants").val();
        var url = "http://softbooker.reservit.com/reservit/reserhotel.php?lang=" + lang + "&action=resa&hotelid=93686&fday=" + day + "&fmonth=" + month + "&fyear=" + year + "&nbnights=" + nbnights + "&numadult=" + numadult + "&nbchd=" + nbchd;
        window.open(url);

    });
});
