function UserNewsletterValidation(theform) {
    if (!TesteEMail(theform.email, 255, true)) {
        return false;
    }
    return true;
}

jQuery(document).ready(function() {

    // Taille de la fenetre du navigateur
    var width  = $(window).width();
    var height = $(window).height();

    var contenu_height    = $('#conteneur_contenu').height();
    var contenu_newHeight = height_first + 30;
    if (contenu_height < contenu_newHeight) {
        $('#conteneur_contenu').height(height);
    }

    /*$('#bascule_on').hide();
    $('#bascule_off').hover(function(){
        $(this).attr('src','static/images/common/bascule_hover.gif');
    }, function() {
        $(this).attr('src','static/images/common/bascule.gif');
    });
    $ ('#bascule_on').hover(function(){
        $(this).attr('src','static/images/common/bascule_on_hover.gif');
    }, function() {
        $(this).attr('src','static/images/common/bascule_on.gif');
    });
    $('#bascule_off, #switch_fond, #voir_photos').livequery('click', function(){
        $('.fermable').hide();
        $('#conteneur_contenu').width(45);
        $('#bascule_off, #switch_fond, #x_mania').hide();
        $('#bascule_on, #conteneur_cache').show();
        $('.oeuvre', '#conteneur_cache').css('top', (539 - $('.oeuvre', '#conteneur_cache').height()) + 'px');
        $(window).resize();
    });
    $('#bascule_on').click(function(){
        $('.fermable').show();
        $('#conteneur_contenu').width(589);
        $('#bascule_off, #switch_fond, #x_mania').show();
        $('#bascule_on, #conteneur_cache').hide();
        $(window).resize();
    });*/

//    Logger('Width : ' + width);
//    Logger('Height : ' + height);

    // Taille de l'image au chargement de la page
    var width_ini  = $('#imgTag').width();
    var height_ini = $('#imgTag').height();
    //alert('ici');

//    Logger('Width_ini : ' + width_ini);
//    Logger('Height_ini : ' + height_ini);

    // Calcul du ratio d'affichage de l'image
    var width_defaut       = width;
    var ratio_width_defaut = width / width_ini;
//    Logger ('Ratio : ' + ratio_width_defaut);

    // Calcul de la taille de l'image
    var width_first  = width_ini * ratio_width_defaut;
    var height_first = height_ini * ratio_width_defaut;

//    Logger('Width_first : ' + width_first);
//    Logger('Height_first : ' + height_first);


    $('#imgTag').width(width_first);
    $('#imgTag').height(height_first);

/*  jQuery('#header ul').superfish();
    jQuery('#sidebar ul').superfish({
        animation: {height:'show'},   // slide-down effect without fade-in
        delay:     500,
        autoArrows: true
    });*/

    $(window).resize(function() {
        $("#bg_content").css('visibility', 'hidden');
        tailleImage();
        /*var height_resize = $(window).height() ;
        var width_resize = $(window).width();
        var ratio_height = height_resize / height ;
        var ratio_width = width_resize / width ;
        var newWidth =  width_first * ratio_width;
        var newHeight = height_first * ratio_width;
        $('#imgTag').width(newWidth);
        $('#imgTag').height(newHeight);
        if (contenu_height < newHeight) {
            $('#conteneur_contenu').height(newHeight + 30);
        }
        $('#conteneur_fond').height(height);*/
    });

    // Vidéo centrale
    $('.video_central a').click(function(e) {
        e.preventDefault();
        var pere = $(this).parent().get(0);
        $(this).hide();
        $('div', pere).show();
        return false;
    });

    $('#iconographie a').hover(function() {
        $('img', this).attr('src', $('img', this).attr('src').replace('.gif', '_on.gif'));
    }, function() {
        $('img', this).attr('src', $('img', this).attr('src').replace('_on.gif', '.gif'));
    });
    $('#ok_recherche').hover(function() {
        $(this).attr('src', $(this).attr('src').replace('.gif', '_on.gif'));
    }, function() {
        $(this).attr('src', $(this).attr('src').replace('_on.gif', '.gif'));
    });
});



function tailleImage(){

    var initWidth  = $("#bg_element").width();
    var initHeight = $("#bg_element").height();
    var screenW    = 0, screenH = 0;
    if ( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        screenW = window.innerWidth - 18;
        screenH = window.innerHeight;
    } else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        screenW = document.documentElement.clientWidth;
        screenH = document.documentElement.clientHeight;
    } else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        screenW = document.body.clientWidth;
        screenH = document.body.clientHeight;
    }
    if (initWidth == 0 || initHeight == 0) {
        document.getElementById("bg_element").style.width  = screenW + "px";
        document.getElementById("bg_element").style.height = screenW * 729 / 1024 + "px";
        $("#bg_content").css('visibility', 'visible');
    } else {
        ratio = screenW / initWidth;
        final_height = initHeight * ratio;
        document.getElementById("bg_element").style.width  = screenW + "px";
        document.getElementById("bg_element").style.height = final_height + "px";
        //$("#content").height(final_height - 45);
        $("#bg_content").css('visibility', 'visible');
    }

}

function tailleBloc(){

    var screenW = 0, screenH = 0;
    if ( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        screenW = window.innerWidth;
        screenH = window.innerHeight;
    } else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        screenW = document.documentElement.clientWidth;
        screenH = document.documentElement.clientHeight;
    } else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        screenW = document.body.clientWidth;
        screenH = document.body.clientHeight;
    }

    //var margeDivScroll = 75;

    //document.getElementById("Scroll").style.height = (screenH*77/100-8-margeDivScroll)+"px";

}

function initScrollLayer(){}

$.extend(hs, {
    graphicsDir     : base_url + 'static/js/highslide/graphics/',
    align           : 'center',
    expandDuration  : 0,
    restoreDuration : 0,
    showCredits     : false,
    dimmingOpacity  : 0.75
});
$.extend(hs.lang, {
    cssDirection    : 'ltr',
    loadingText     : 'Chargement...',
    loadingTitle    : 'Cliquer pour annuler',
    focusTitle      : 'Cliquer pour amener au premier plan',
    fullExpandTitle : 'Afficher à la taille réelle',
    previousText    : 'Précédente',
    nextText        : 'Suivante',
    moveText        : 'Déplacer',
    closeText       : 'Fermer',
    closeTitle      : 'Fermer (esc ou Échappement)',
    resizeTitle     : 'Redimensionner',
    playText        : 'Lancer',
    playTitle       : 'Lancer le diaporama (barre d\'espace)',
    pauseText       : 'Pause',
    pauseTitle      : 'Suspendre le diaporama (barre d\'espace)',
    previousTitle   : 'Précédente (flèche gauche)',
    nextTitle       : 'Suivante (flèche droite)',
    moveTitle       : 'Déplacer',
    fullExpandText  : 'Taille réelle',
    number          : 'Image %1 sur %2',
    restoreTitle    : 'Cliquer pour fermer l\'image, cliquer et faire glisser pour déplacer, utiliser les touches flèches droite et gauche pour suivant et précédent.'
});
hs.registerOverlay({
    html        : '<div class="closebutton" onclick="return hs.close(this)" title="' + hs.lang.closeText + '"></div>',
    position    : 'top right',
    useOnHtml   : true,
    fade        : 0 // fading the semi-transparent overlay looks bad in IE
});

