$(window).load(function() { /*--------------- Bg global ---------------*/ if(document.getElementById('global')){ var heightWin = 0; if (self.innerHeight) {// all except Explorer heightWin = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode heightWin = document.documentElement.clientHeight; } else if (document.body) { // other Explorers heightWin = document.body.clientHeight; } if(heightWin != 0 && heightWin >= $('body').height() && heightWin >= $('#container').height()+250){ $('#global').css({minHeight:heightWin}); }else if($('body').height() >= $('#container').height()+180){ $('#global').css({minHeight:$('body').height()}); }else if(heightWin != 0){ $('#global').css({minHeight:heightWin}); }else{ $('#global').css({minHeight:$('#container').height()+180}); } } /*--------------- Login slide ---------------*/ if(document.getElementById('login_title_slide')){ if(document.getElementById('login_error')){ $('#login_slide').show(); $('#login_title_slide').addClass('selected'); $('#login_title_slide').toggle(function(){ $(this).removeClass('selected'); $('#login_slide').slideUp(); }, function(){ $(this).addClass('selected'); $('#login_slide').slideDown(); }); }else{ $('#login_title_slide').toggle(function(){ $(this).addClass('selected'); $('#login_slide').slideDown(); }, function(){ $(this).removeClass('selected'); $('#login_slide').slideUp(); }); } } /*--------------- Menu slide ---------------*/ if(document.getElementById('navigation')){ $('.menu_custom_slide').each(function(){ $(this).css({marginLeft:-($(this).width()/2)}).attr('id', $(this).height()); $(this).children('.menu_slide_margin').attr('id', $(this).width()); }); $('.menu_slide').hover(function(){ $(this).children('.menu_custom_slide').stop().css({height:$(this).attr('id'), width:$(this).children(".menu_custom_slide").children(".menu_slide_margin").attr('id')}).slideDown(); }, function(){ $(this).children('.menu_custom_slide').stop().css({height:$(this).attr('id'), width:$(this).children(".menu_custom_slide").children(".menu_slide_margin").attr('id')}).slideUp(); }); } /*--------------- Home news slide ---------------*/ if(document.getElementById('news_puces_box')){ var news_actu=0; var cible=0; var news_total=$('#news_pictures_box > *').length; var slide_home=function(cible, auto){ if(auto && news_actu+1 < news_total){ cible=news_actu+1; }else if(auto){ cible=0; } if(cible!=news_actu){ $('.news_picture_'+news_actu).css({zIndex:news_total+1}); $('.news_picture_'+cible).css({zIndex:news_total}); $('.news_picture_'+news_actu).fadeOut(600, function(){ $('.news_picture_'+cible).css({zIndex:news_total+2}); $(this).css({zIndex:1}).show(); }); $('.news_info_'+news_actu).fadeOut(300, function(){ $('.news_infos').hide(); $('.news_info_'+cible).fadeIn(300); }); if(!$('body').hasClass('browser_ie9')) { $('.news_puce_'+news_actu).animate({opacity:'0.5'}, 600, function(){ $(this).removeClass('selected_puce').addClass('unselected_puce'); }); $('.news_puce_'+cible).animate({opacity:'1'}, 600, function(){ $(this).removeClass('unselected_puce').addClass('selected_puce'); }); } else { $('.browser_ie9 .news_puce_'+news_actu).removeClass('selected_puce').addClass('unselected_puce'); $('.browser_ie9 .news_puce_'+cible).removeClass('unselected_puce').addClass('selected_puce'); } news_actu=cible; } clearTimeout(time_home); time_home = window.setTimeout(function(){slide_home(false, true);}, 6000); } $('.arrow_home_right').click(function(){ if(news_actu+1 < news_total){ cible=news_actu+1; }else{ cible=0; } slide_home(cible, false); }); $('.arrow_home_left').click(function(){ if(news_actu > 0){ cible=news_actu-1; }else{ cible=news_total-1; } slide_home(cible, false); }); $('.news_puces').click(function(){ slide_home(Number($(this).attr('alt'), false)); }); time_home = window.setTimeout(function(){slide_home(false, true);}, 6000); } /*--------------- Objects details slide ---------------*/ if(document.getElementById('gallery_points')){ var mask_height = $('#gallery_slide').height(); var slide_height = $('#gallery_points').height(); var slide_pos = 0; var slide_cible = 0; if( slide_height > mask_height ){ $('.arrow_slide').show(); $('#arrow_slide_bottom').click(function(){ slide_cible = (15-mask_height)*(slide_pos+1); if(slide_cible > -slide_height){ $('#gallery_points').stop().animate({marginTop:slide_cible}); slide_pos++; if((15-mask_height)*(slide_pos+1) < -slide_height){ $('#arrow_slide_bottom').addClass('unselectable').removeClass('selectable'); } if(slide_pos > 0){ $('#arrow_slide_top').addClass('selectable').removeClass('unselectable'); } } }); $('#arrow_slide_top').click(function(){ slide_cible = (15-mask_height)*(slide_pos-1); if(slide_pos > 0){ $('#gallery_points').stop().animate({marginTop:slide_cible}); slide_pos--; if(slide_pos <= 0){ $('#arrow_slide_top').addClass('unselectable').removeClass('selectable'); } if((15-mask_height)*(slide_pos-1) > -slide_height){ $('#arrow_slide_bottom').addClass('selectable').removeClass('unselectable'); } } }); } } /*--------------- Objects details size ---------------*/ if(document.getElementById('info2_container')){ $('.detail_col_left').css({minHeight:$('.detail_col_right').height()-20}); } /*--------------- Custom pages with s-menus ---------------*/ if($('div.custom_title').hasClass('s_menu_container')){ $('.s_menu').click(function(){ var select_part = $(this).attr('id'); $('.module_part.selected').removeClass('selected'); $('.s_menu.selected').removeClass('selected'); $('.s_menu_actu.selected').removeClass('selected'); $(this).addClass('selected'); $('#'+select_part+'_title').addClass('selected'); $('#'+select_part+'_part').addClass('selected'); }); } /*--------------- Iphone link ---------------*/ if(document.getElementById('iphone_link')){ var alreadyShown = document.cookie.match(/FUTURE_PROOF=1(?:;|$)/); if(!alreadyShown){ $("#iphone_link").fadeIn("500"); $("#iphone_close").click(function () { $("#iphone_link").fadeOut("500"); var date = new Date(); date.setFullYear( date.getFullYear() + 1); var expires = date.toUTCString(); document.cookie = "FUTURE_PROOF=1;path=/;expires="+expires; }); } } });