var tbv = 0; var basst = 0; var basketbotmar = 50; var baskettop = 130; $(document).ready(function(){ $("b").each(function(){ if($(this).text()=='Fatal error'){ $(this).text('Как такое могло произойти? '); } }); $('#topbutton') .mouseenter(function(){ $(this).fadeTo(10,1); }) .mouseleave(function(){ $(this).fadeTo(200,0.3); }) .click(function(){ $('html, body').animate({scrollTop:0},'slow'); }); $("#col2 p img").each(function(){ if($(this).css("float")=="right"){ $(this).css("margin","0px 0px 10px 15px"); }else{ $(this).css("margin","0px 15px 10px 0px"); } }); $("#counters").position({my:"right bottom",at:"right bottom",of:"#footer2",offset:"-"+$("#footer2").css("padding-right")+" -"+$("#footer2").css("padding-bottom"),collision:"none" }); // PrettyPhoto $("area[rel^='prettyPhoto']").prettyPhoto(); $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'fast', theme:'dark_square_hui', opacity: 0.80, slideshow:5000,autoplay_slideshow:false, markup: '
\ ' }); var basvi=0; $(window).scroll(function(){ var windowheight = $(window).height(); var scr = $('html').scrollTop() + $('body').scrollTop(); var scr2 = scr / 80; $('body').css({'background-position':'center -' + scr2 + 'px'}); var basketheight = $('#basket').height(); if(basvi==0 && ( scr > baskettop ) && ( baskettop+basketheight+basketbotmar < scr+windowheight ) ){ basvi=1; if( basketheight < windowheight ){ $('#basket').addClass('fix').css('top', '16px' ); }else{ $('#basket').addClass('fix').css('top', windowheight - basketbotmar - basketheight ); } } if(basvi==1 && ( ( scr+windowheight < basketheight+baskettop ) || ( scr < baskettop ) ) ){ basvi=0; $('#basket').removeClass('fix').css('top', baskettop+'px'); } if(tbv==0 && scr>=320){ tbv = 1; $('#topbutton').stop().fadeTo(500,0.3); } if(tbv==1 && scr<320){ tbv = 0; $('#topbutton').stop().fadeTo(500,0); } }); $("#basketopen").click(myBasketToggle); $("#basket").children("p:first-child").click(myBasketToggle); $('#basket ul li').children('img:first-child').click(myBasketExpand); function myBasketToggle(){ if(basst==0){ myBasketExpand(); }else if(basst==1){ myBasketMinimize(); } } function myBasketExpand(){ $('#header').stop().animate({'margin-left':"-217px"}); $('#center').stop().animate({'margin-left':"-200px"}); $('#footer1').stop().animate({'margin-left':"-180px"}); $('#footer2').stop().animate({'margin-left':"-200px"}); $('#basket').stop().animate({width:"221px", "margin-left":"-426px"}); $('#basketitems ul li div.f1').show(); $('#basketopen').html('Свернуть'); basst=1; } function myBasketMinimize(){ $('#header').stop().animate({'margin-left':"-437px"}); $('#center').stop().animate({'margin-left':"-420px"}); $('#footer1').stop().animate({'margin-left':"-400px"}); $('#footer2').stop().animate({'margin-left':"-420px"}); $('#basket').stop().animate({width:"60px", "margin-left":"-486px"}); $('#basketitems ul li div.f1').hide(); $('#basketopen').html('Открыть'); basst=0; } });