jQuery.preloadImages = function() { for(var i = 0; i").attr("src", arguments[i]); } } function scrollTo(s) { $(window).scrollTo($(s), 1000, {axis : 'y', easing:'easeInOutQuad'}); return false; } function fitCacheToWindow() { $('#cache').css('width', $(document).width() + 'px'); $('#cache').css('height', $(document).height() + 'px'); } var slideTimer; $(function() { $('.mainnav LI').mouseover(function() { $('.mainnav .fleche').hide(); $('.nav .container').hide(); var id = $(this).attr('id'); id = id.substring(3); var refLeft = $('#nav1').position().left; var subnav = $('#subnav' + id); if( subnav.length > 0 ) { var left = ( $(this).width() - 16 ) / 2; $(this).find('.fleche').css('margin-left', left + 'px'); $(this).find('.fleche').show(); subnav.show(); var width = 0; subnav.find('li').each(function() { width += $(this).width(); }); var refMain = $('.mainnav').position().left - $('#site').position().left; var subleft = $(this).position().left - $('#site').position().left - refMain; var subwidth = ($(this).width() - width)/2;; subleft += subwidth; subnav.css('margin-left', subleft + 'px'); } }); $('#header .search INPUT').focus( function() { handleSearchField(this) } ); $('#header .search INPUT').blur ( function() { handleSearchField(this) } ); $('#langues A').each(function() { if( ! $(this).hasClass('on') ) { $(this).mouseover(function() {$('#langues A').css("opacity", 0.4); $(this).css("opacity", 1);} ); $(this).mouseout(function() {$(this).css("opacity", 0.4);$('#langues .on').css("opacity", 1);} ); } }); }); $.preloadImages(root + 'img/footer-buttons-ON.png', root + 'img/header-buttons-ON.png', root + 'img/sub-navigation-sprite.gif', root + 'img/slider-nav-ON.gif'); function handleSearchField(f) { f = $(f); if( f.attr('save') == null ) { f.attr('save', f.attr('value')); } if( f.val() == f.attr('save') ) { f.val(''); } else if( f.val() == '' ) { f.val(f.attr('save')); } } function fixTop() { if( $('#top').width() < $(document).width() ) { $('#top').css('width', $(document).width() + 'px'); // $('#header').css('width', $(document).width() + 'px'); } }