function ingview(imm){
                    $("iframe").css('display',"none");
                    $("body").css('overflow','hidden');
                    $("#bigdiv").remove();
                    var bigdiv = $("<div id='bigdiv'></div>");

                    $(bigdiv).css('width',$(window).width()).css('height',$(window).height());
                    
                    var preloader = $("<img src='/files/matte/sys/p.gif' id='preloader' />");
                    
                    bigdiv.appendTo('body');
                    preloader.appendTo('body');
                    
                	hiddenImg= new Image();
                    hiddenImg.src= imm;
                    
                            $(hiddenImg).load(function()	{
                     
                            $(preloader).remove();
                            
                            var myimg = $('<img src="'+imm+'" id="bigimg" title="Кликните на картинку, что бы ее закрыть" style="display:none" />');
                            
                            //$(bigdiv).html('<img src="'+imm+'"  />');
                            $(myimg).css('opacity',0).animate({opacity:1},'slow');
                            myimg.appendTo(bigdiv);
                            
                            
           
                            
                            
                            var dw = $(window).width()/2;
                            var dh = $(window).height()/2;
                            var iw = hiddenImg.width/2; 
                            var ih = hiddenImg.height/2;
                            var kw = $(window).width() / hiddenImg.width;
                            var kh = hiddenImg.height / $(window).height();
                                l = 0-iw/2;
                                t = 0-ih/2;
                                
                            if (l>=0) l = ( $(window).width()/2 )-(hiddenImg.width/2);
                            if (t>=0) t = ( $(window).height()/2 )-(hiddenImg.height/2);

 
                            $(myimg).css('margin-left',l).css('margin-top',t).css('display','inline');

                        })
                
                
                
                
                
                $(bigdiv).mousemove(function(e){ 
                    myimg = "#bigimg";
            
                        w=0;
                        h=0;
                        
                        if ($(myimg).width()>$(window).width()){w = 0-(($(myimg).width()-$(window).width()) / $(window).width() * e.clientX);}else{
                            w = ( $(window).width()/2 )-($(myimg).width()/2);
                        }
                        if ($(myimg).height()>$(window).height()){h = 0-(($(myimg).height()-$(window).height()) / $(window).height() * e.clientY);}else{
                            h = ( $(window).height()/2 )-($(myimg).height()/2);
                        }
                        
             
                        
                        $(myimg).css('margin-left',w).css('margin-top',h);
                        //$("#console").text($(window).width()+':'+$(window).height());
            
          
            }).click(function(){
                $("#bigdiv").remove();
                $("iframe").css('display',"block");
                $("body").css('overflow','auto');
            });
            
            
        }
        
        
        
        $(document).ready(function()	{
            
            $("#otheropen").click(function(){ $("#other").css('display','block'); $("#otheropen").css('display','none'); return false; })
            
            $(".opacity").css('opacity',.5).hover(function(){ $(this).stop().animate({opacity:1},'slow'); },function(){ $(this).stop().animate({opacity:.5},'slow'); });
        $(window).scroll(function(){
if (document.body.scrollTop==0){
    $("#left").stop().animate({top:100},'slow');
    $("#totop").css('display','none');
}else{
    $("#left").stop().animate({top:20},'slow');
    $("#totop").css('display','block');
}


        })


        	$(".bimg").click(function(){
        	   h = $(this).attr('href');
               ingview(h);
               return false;
        	})
            
            
        				})
