                
                    // Круговой скроллинг ресурсов
                    
                    var mycarousel_itemList = [];
                    
                    function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
                    {
                        var idx = carousel.index(i, mycarousel_itemList.length);                        
                        carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));                      
                        prodhover();
                    };
                    
                    function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
                    {
                        carousel.remove(i);     
                    };
    
                    function mycarousel_getItemHTML(item)
                    {
                        return item.cod;
                    };
                    
                    // Грузим скроллинг для фото
                    
                    function photoscroll(){     
                        var phnumb1 = $(".photocontainer .photodiv").size();
                        $(".photocontainer .photoscroll").css("width",phnumb1*326+'px');                            
                        $(".phnav .from").html((langid==1?"1 из ":"1 from ")+phnumb1);
                        
                        var phnumb2 = $(".grapcontainer .graphdiv").size();
                        $(".grapcontainer .grapscroll").css("width",phnumb2*326+'px');      
			$(".grnav .from").html((langid==1?"1 из ":"1 from ")+phnumb2);
                    };
                    
                    // Слой при наведении на ресурс
                    
                    function prodhover(){       
                    
                        $(".productsbg .product .thumb img").hover(function() 
                                    {
                                        var ntit = $(this).parents(".product").find(".prodpucontent .ptit").text();                                     
                                        var ndtxt = $(this).parents(".product").find(".prodpucontent .text").html();                                        
                                        var l = $(this).offset().left-($("#prodpopup").width()-124)/2;
                                        var h = $(this).offset().top-($("#prodpopup").height()-116)/2;
                                        if(l<0) l=0;
                                        
                                        $("#prodpopup").css("top",h+"px");
                                        $("#prodpopup").css("left",l+"px");
                                        $("#prodpopup .ptitle").text(ntit);
                                        $("#prodpopup .plcontent").html(ndtxt);
                                        
                                        $("#prodpopup").css("display","block");                                     
                                     },function() 
                                        {
                                            $("#prodpopup").hover(function()
                                                {
                                                $("#prodpopup").css("display","block");
                                                }, function(){
                                                $("#prodpopup").css("display","none");
                                                $("#prodpopup .ptitle").html("&nbsp;");
                                                $("#prodpopup .plcontent").html("&nbsp;");                                          
                                                });
                                            
                                            //$(".mainnews").mouseover(function(){  $("#prodpopup").css("display","none"); })
                                            //$(".newsblockdiv").mouseover(function(){  $("#prodpopup").css("display","none"); })                                       
                                            $(".productsbg").mouseout(function(){  $("#prodpopup").css("display","none"); })            
                                            
                                        });
                    }
                    
                // Горизонтальный скроллинг нижнего блока новостей 
                    
                function newsscroller(){
                    var nact = $(".newsblockdiv.nblock2 .ncborder.ncopen");
                    $(nact).css("width", 335*$(nact).find(".newscell").size()+'px');
                    var from = ($(nact).find(".newscell").size()/3);
                    from = Math.ceil(from);

		    if (langid == 1) {
	                    $(".newspager .pages").html("1 из "+from);
		    } else {
			    $(".newspaper .pages").html("1 from"+from);
		    }
                    
                    j2=0;                     
                     var ncarr = $(".newsblockdiv.nblock2 .ncborder.ncopen .newscell");
                     var ncnumb = $(ncarr).size();
                     for(j=0;j<ncnumb;j++){
                         if(j2 == 0)  if($(ncarr[j]).attr("class")!="newscell ncfirst") $(ncarr[j]).toggleClass("ncfirst");
                         if(j2==2) j2=0; else     j2++;
                         }
                }

         $(document).ready(function(){  
                    
                    // Выпадающее меню 
                    
                    $(".menuul li").hover(function() {
                        $(this).toggleClass("lihov");
                        }, function(){
                        $(this).removeClass("lihov");
                        });
                    
                    var idx = $("#mycarousel li");
                    $(".products ul").css("padding-left","0px");
                
                    for(i=0;i<idx.size();i++){
                        var ctxt = $(idx[i]).html();
                        mycarousel_itemList[i] = {cod: ctxt};
                        }
                    
                    
                    // Горизонтальный скроллинг фото - кнопка назад
                    
                    phnav = 0;
                    
                    $(".phnav .prev").click(function() {
                                                 
                            if(phnav==0)
                            {
                                phnav = 1;
                                var phpleft = $(".photocontainer .photoscroll").css("left");
                                if(phpleft=="auto") phpleft="0px";
                                
                                phpleft = phpleft.substring(0, phpleft.length-2)
                                phpleft = phpleft*1;        
                                if(phpleft!=0) phpleft =(phpleft+326);  

                                var pnumber =Math.abs(phpleft/326)+1;
                                $(".phnav .from").html(pnumber+ (langid==1?" из ":" from ")+$(".photocontainer .photodiv").size());
                                
                                $(".photoscroll").animate({"left": phpleft+"px"}, 500, 'swing',function(){phnav = 0;});             
                            }                                                
                                                 
                        });
                    
                    // Горизонтальный скроллинг фото - кнопка вперед
                        
                    $(".phnav .next").click(function() {
                                                 
                            if(phnav==0)
                            {
                                phnav = 1;
                                var phpleft = $(".photocontainer .photoscroll").css("left");
                                if(phpleft=="auto") phpleft="0px";                              
                                phpleft = phpleft.substring(0, phpleft.length-2)
                                phpleft = phpleft*1;                                    
                                var phnumb = (Math.ceil($(".photocontainer .photodiv").size())-1)*326;                                  
                                phnumb = -(phnumb-1);
                                if(phpleft>=phnumb) phpleft = phpleft -326;
                                
                                pnumber = Math.abs(phpleft/326)+1;                              
                                $(".phnav .from").html(pnumber+(langid==1?" из ":" from ")+$(".photocontainer .photodiv").size());
                                
                                $(".photoscroll").animate({"left": phpleft+"px"}, 500, 'swing',function(){phnav = 0;});                     
                            }                                                
                                                 
                        });
                    
                    // Горизонтальный скроллинг графика - кнопка назад
                    
                    grnav = 0;
                    
                    $(".grnav .prev").click(function() {
                                                 
                            if(grnav==0)
                            {
                                grnav = 1;
                                var grpleft = $(".grapcontainer .grapscroll").css("left");
                                if(grpleft=="auto") grpleft="0px";
                                
                                grpleft = grpleft.substring(0, grpleft.length-2)
                                grpleft = grpleft*1;        
                                if(grpleft!=0) grpleft =(grpleft+326);          
                                
                                var pnumber =Math.abs(grpleft/326)+1;
                                $(".grnav .from").html(pnumber+(langid==1?" из ":" from ")+$(".grapcontainer .graphdiv").size());
                                
                                $(".grapscroll").animate({"left": grpleft+"px"}, 500, 'swing',function(){grnav = 0;});              
                            }                                                
                                                 
                        });
                    
                    // Горизонтальный графика фото - кнопка вперед
                        
                    $(".grnav .next").click(function() {
                                                 
                            if(grnav==0)
                            {
                                grnav = 1;
                                var grpleft = $(".grapcontainer .grapscroll").css("left");
                                if(grpleft=="auto") grpleft="0px";                              
                                grpleft = grpleft.substring(0, grpleft.length-2)
                                grpleft = grpleft*1;                                    
                                var phnumb = (Math.ceil($(".grapcontainer .graphdiv").size())-1)*326;                               
                                phnumb = -(phnumb-1);
                                if(grpleft>=phnumb) grpleft = grpleft -326;
                                
                                pnumber = Math.abs(grpleft/326)+1;                              
                                $(".grnav .from").html(pnumber+(langid==1?" из ":" from ")+$(".grapcontainer .graphdiv").size());
                                
                                $(".grapscroll").animate({"left": grpleft+"px"}, 500, 'swing',function(){grnav = 0;});                      
                            }                                                
                                                 
                        });
                    
                    // Горизонтальный скроллинг нижнего блока новостей - кнопка назад
                    
                    var nenav = 0;
                    
                    $(".newspager .prev").click(function() {
                        if(nenav==0)
                        {
                            nenav = 1;
                            var pleft = $(".newsblockdiv.nblock2 .ncborder.ncopen").css("left");
                            if(pleft=="auto") pleft="0px";
                            
                            pleft = pleft.substring(0, pleft.length-2)
                            pleft = pleft*1;        
                            if(pleft!=0) pleft =(pleft+985);    
                            
                            
                            var pagenumb =Math.abs(pleft/985)+1;
                            //alert(pagenumb);
                            fromc = Math.ceil($(".newsblockdiv.nblock2 .ncborder.ncopen .newscell").size()/3);
                            $(".newspager .pages").html(pagenumb+(langid==1?" из ":" from ")+fromc);
                            
                            $(".newsblockdiv.nblock2 .ncborder.ncopen").animate({"left": pleft+"px"}, 500, 'swing',function(){nenav = 0;});     
                        }                       
                    });                 
                    
                    // Горизонтальный скроллинг нижнего блока новостей - кнопка вперед
                    
                    $(".newspager .next").click(function() {
                        if(nenav==0)
                        {
                            nenav = 1;
                            var pleft = $(".newsblockdiv.nblock2 .ncborder.ncopen").css("left");
                            if(pleft=="auto") pleft="0px";
                            
                            pleft = pleft.substring(0, pleft.length-2)
                            var pleft = pleft*1;        
                            var ncellnumb = (Math.ceil($(".newsblockdiv.nblock2 .ncborder.ncopen .newscell").size()/3)-1)*985;
                            ncellnumb = -(ncellnumb-1);
                            if(pleft>=ncellnumb) pleft = pleft -985;
                            
                            var pagenumb =Math.abs(pleft/985)+1;
                            fromc = Math.ceil($(".newsblockdiv.nblock2 .ncborder.ncopen .newscell").size()/3);
                            
                            $(".newspager .pages").html(pagenumb+(langid==1?" из ":" from ")+fromc);                     
                            $(".newsblockdiv.nblock2 .ncborder.ncopen").animate({"left":  pleft+"px"}, 500, 'swing',function(){nenav = 0;});    
                        }
                    });
                    
                    photoscroll();
                    prodhover();
                    newsscroller();
                    
                    // переключение вкладок Новости часа Фото Графика
                    
                    $(".nlmenu .link").click(function() {
                            $(".nlmenu .link.lact").removeClass("lact");                    
                            $(this).toggleClass("lact");    
                            
                            var bid = $(".nlmenu .link.lact").attr("id");
                            $(".mainnews .nvariant.nvshow").removeClass("nvshow");  
                            $(".mainnews #"+bid+"_block").toggleClass("nvshow");                        
                        });
                    
                    // переключение вкладок новостей 1 блок
                    
                    
                    // переключение вкладок новостей 2 блок
                    
var nt1 = 0;

                                       $(".newsblockdiv .tabs .tab").click(function() {
                                               if(nt1==0){
                                                               nt = 1;
                                                               var ido = $(this).parents(".newsblockdiv").find(".tabs .tab.tact a").attr("lang");
                                                               var idn = $(this).find("a").attr("lang");
                                                               if(ido!=idn){
                                                                       $(this).parents(".newsblockdiv").find(".tabs .tab.tact").removeClass("tact");
                                                                       $(this).toggleClass("tact");
                                                                       var nid = $(this).parents(".newsblockdiv").find(".tabs .tab.tact a").attr("lang");
                                                                       var nbdheight = $(this).parents(".newsblockdiv").find(".newsblock").height();
                                                                       $(this).parents(".newsblockdiv").find(".newsblock").css("height",nbdheight+"px");
                                                                       $(this).parents(".newsblockdiv").find(".newsblock").css("overflow","hidden");
                                                                       $(this).parents(".newsblockdiv").find(".ncborder.ncopen").slideUp("slow");
                                                                       $(this).parents(".newsblockdiv").find(".ncborder.ncopen").removeClass("ncopen");
                                                                       $(this).parents(".newsblockdiv").find("#"+nid).toggleClass("ncopen");
                                                                       $(this).parents(".newsblockdiv").find("#"+nid).css("display","none");
                                                                       $(this).parents(".newsblockdiv").find("#"+nid).slideDown("slow",function(){nt1=0;});
                                                                       nt1++;
                                                               }
                                               }
                                       });
                    
                    // Открываем новость в попапе               
                    
                    $(".newscell a.lnk").click(function() {
                        var href = $(this).attr("rel");
                        var ntit = $(this).parents(".newscell").find(".ntit").text();
                        var ndate = $(this).parents(".newscell").find(".date").text();
                        var ndtxt = $(this).parents(".newscell").find(".detailtext").html();

                        $("#popup .pucontent .newstxt").text(""); 
         
                        $("#popup .pucontent .tit").text(ntit);
                        $("#popup .pucontent .date").text(ndate);
                        $("#popup .pucontent .newstxt").load(href);

                        var w = $(window);
                        var wtop = (w.height()-$("#popup").height())/2+w.scrollTop() + "px";
                        var wleft =(w.width()-$("#popup").width())/2+w.scrollLeft() + "px";
                        $("#popup").css ("top",wtop);
                        $("#popup").css ("left",wleft);
                        $("#layernews").css("height",$(document).height()+"px");
                        $("#layernews").css("width",$(window).width()+"px");
                        $("#layernews").fadeIn("slow");
                        $("#popup").fadeIn("slow");

                        return false; 
                    });

                    $(".menu a.lnk, .copyrights a.lnk").click(function() {
                        var href = $(this).attr("rel");
                        var ntit = $(this).attr("title");
                        var ndate = $(this).parents(".newscell").find(".date").text();
                        var ndtxt = $(this).parents(".newscell").find(".detailtext").html();

                        $("#popup .pucontent .newstxt").text(""); 
         
                        $("#popup .pucontent .tit").text(ntit);
                        $("#popup .pucontent .date").text(ndate);
                        $("#popup .pucontent .newstxt").load(href);

                        var w = $(window);
                        var wtop = (w.height()-$("#popup").height())/2+w.scrollTop() + "px";
                        var wleft =(w.width()-$("#popup").width())/2+w.scrollLeft() + "px";
                        $("#popup").css ("top",wtop);
                        $("#popup").css ("left",wleft);
                        $("#layernews").css("height",$(document).height()+"px");
                        $("#layernews").css("width",$(window).width()+"px");
                        $("#layernews").fadeIn("slow");
                        $("#popup").fadeIn("slow");

                        return false; 
                    });
                    
                    // закрываем попап      
                    
                    $(".newsline .nlinepopup .close_nlinepopup").click(function() {

                            $(".newsline .nlinepopup").css("display","none");                         
                            $("#popup").fadeOut("slow",function(){
                                                                $("#popup .pucontent .tit").html("&nbsp;");
                                                                $("#popup .pucontent .date").html("&nbsp;");
                                                                $("#popup .pucontent .newstxt").html("&nbsp;");     
                                                                });
                            $("#layernews").fadeOut("slow");            
                            
                    });
                    
                    $("#popup .puclose a").click(function() {                           
                            $("#popup").fadeOut("slow",function(){
                                                                $("#popup .pucontent .tit").html("&nbsp;");
                                                                $("#popup .pucontent .date").html("&nbsp;");
                                                                $("#popup .pucontent .newstxt").html("&nbsp;");     
                                                                });
                            $("#layernews").fadeOut("slow");            
                            
                    });
                    
                    // Попап для блока Новости часа открытие
                    
                    $(".newsline .newsltext a").click(function() {
                            $(".newsline .nlinepopup").css("display","block");      
                    });

                    $(".photodiv a").click(function() {
                            $(".newsline .phlinepopup").css("display","block");      
                    });
                    $(".graphdiv a").click(function() {
                            $(".newsline .grlinepopup").css("display","block");      
                    });

                    
                    // Попап для блока Новости часа закрытие
                    
                    $(".newsline .nlinepopup a").click(function() {
                            $(".newsline .nlinepopup").css("display","none");                                                                                           
                    });
                    
					$(".newsline .phlinepopup a").click(function() {
                            $(".newsline .phlinepopup").css("display","none");                                                                                           
                    });
					
					$(".newsline .grlinepopup a").click(function() {
                            $(".newsline .grlinepopup").css("display","none");                                                                                           
                    });
                    // Открываем попап для пунктов меню
                    
/*                    $(".menu .lnk").click(function() {
                            var atr = $(this).attr("lang");
                            var ntit = $(".content ."+atr+"_text .ctit").text();
                            var ndtxt = $(".content ."+atr+"_text .ctext").html();

                            $("#cpopup .pucontent .tit").text(ntit);
                            $("#cpopup .pucontent .newstxt").html(ndtxt);
    
                            var w = $(window);
                            var wtop = (w.height()-$("#cpopup").height())/2+w.scrollTop() + "px";
                            var wleft =(w.width()-$("#cpopup").width())/2+w.scrollLeft() + "px";
                            $("#cpopup").css ("top",wtop);
                            $("#cpopup").css ("left",wleft);
                            
                            $("#layernews").css("height",$(document).height()+"px");
                            $("#layernews").css("width",$(window).width()+"px");
                            $("#layernews").fadeIn("slow");
                            $("#cpopup").fadeIn("slow");                            
                    });
*/
                                        
                    // Закрываем попап для пунктов меню
                    
                    $("#layernews").click(function() {                          
                            $("#cpopup").fadeOut("slow",function(){
                                                                $("#cpopup .pucontent .tit").html("&nbsp;");
                                                                $("#cpopup .pucontent .newstxt").html("&nbsp;");        
                                                                });
                            $("#layernews").fadeOut("slow");            
                            
                    });
                    
                    $("#cpopup .puclose a").click(function() {                          
                            $("#cpopup").fadeOut("slow",function(){
                                                                $("#cpopup .pucontent .tit").html("&nbsp;");
                                                                $("#cpopup .pucontent .newstxt").html("&nbsp;");        
                                                                });
                            $("#layernews").fadeOut("slow");            
                            
                    });
                    
                 });
                
                // вертикальные скроллеры
                
                    function graphicsb_data0()
                            {
                                this.up_button = "images/scrollh_up.gif";                                          //image path and name only
                                this.up_button_roll = "images/scrollh_up.gif";                                //image path and name only
                                this.down_button = "images/scrollh_down.gif";                                      //image path and name only
                                this.down_button_roll = "images/scrollh_down.gif";                            //image path and name only
                                this.slider_tile_bg_style = "background:#092f7c"  //image defined as CSS style
                                this.bubble_top_cap = "images/scroll_bar_t.gif,5";                        //image path and name, height - (width is automatically set to scroll bar width)
                                this.bubble_bottom_cap = "images/scroll_bar_t.gif,5";                  //image path and name, height - ""
                                this.bubble_center = "images/scroll_bar.gif,4";                         //image path and name, height - ""
                                this.bubble_tile_bg_style = "images/scroll_bar.gif";                        //image path and name only
                                this.container_width = 308;
                                this.container_height = 323
                                this.container_bg_color = "";
                                this.content_padding = 0
                                this.content_styles = "font-family:Arial;font-weight:normal;font-size:12px;";
                                this.content_class_name = "";
                                this.scroll_bar_width = 21                     //The width of the bar in pixels.
                                this.scroll_increment = 10                     //The distance to scroll when clicking the up or down buttons.
                                this.allow_hover_scroll = true;                //Auto scroll while hovering over top and bottom buttons.
                                this.hover_scroll_delay = 50;                  //Milliseconds (1/1000 second)
                                this.use_hand_cursor = false;
                            }

                function graphicsb_data1()
                            {
                                this.up_button = "images/scroll_up.gif";                                          //image path and name only
                                this.up_button_roll = "images/scroll_up.gif";                                //image path and name only
                                this.down_button = "images/scroll_down.gif";                                      //image path and name only
                                this.down_button_roll = "images/scroll_down.gif";                            //image path and name only
                                this.slider_tile_bg_style = "background:#092f7c"  //image defined as CSS style
                                this.bubble_top_cap = "images/scroll_bar_t.gif,5";                        //image path and name, height - (width is automatically set to scroll bar width)
                                this.bubble_bottom_cap = "images/scroll_bar_t.gif,5";                  //image path and name, height - ""
                                this.bubble_center = "images/scroll_bar.gif,4";                         //image path and name, height - ""
                                this.bubble_tile_bg_style = "images/scroll_bar.gif";                        //image path and name only
                                this.container_width = 323;
                                this.container_height = 270
                                this.container_bg_color = "";
                                this.content_padding = 0
                                this.content_styles = "font-family:Arial;font-weight:normal;font-size:12px;";
                                this.content_class_name = "";
                                this.scroll_bar_width = 21                     //The width of the bar in pixels.
                                this.scroll_increment = 10                     //The distance to scroll when clicking the up or down buttons.
                                this.allow_hover_scroll = true;                //Auto scroll while hovering over top and bottom buttons.
                                this.hover_scroll_delay = 50;                  //Milliseconds (1/1000 second)
                                this.use_hand_cursor = false;
                            }
                                                        

