$(window).load(function () {
        //потсветка пунктов меню
        $("#menu > a:not(.selected)").hover(
            function()
            {                
                var htmlStr = $(this).html();
                $(this).empty();
                $(this).append("<div class='div1'><div class='div2'>" + htmlStr + "</div></div>");
                $(this).css(
                {
                    backgroundImage: "url(/press/img/menu_bg_hover.gif)",
                    backgroundRepeat: "repeat-x",
                    backgroundPosition: "left 0px",
                    color: "#333333",
                    padding: "0px",
                    height: "61px"
                }
                );
            },
            function()
            {                
                var htmlStr = $("#menu > a:not(.selected) .div2").html();
                $(this).empty();
                $(this).append(htmlStr);
                $(this).css(
                {
                    backgroundImage: "url(/press/img/menu_divider.jpg)",
                    backgroundRepeat: "no-repeat",
                    backgroundPosition: "right 0px",
                    color: "#fff",
                    paddingTop: "24px",
                    paddingLeft: "20px",
                    paddingRight: "20px",
                    height: "37px"
                }
                );                
            }
            );
        //подсветка активного
        jQuery.each($("#menu > a.selected"),
            function()
            {
                var htmlStr = $(this).html();
                $(this).empty();
                $(this).append("<div class='div1'><div class='div2'>" + htmlStr + "</div></div>");
                $(this).css(
                {
                    backgroundImage: "url(/press/img/menu_bg_hover.gif)",
                    backgroundRepeat: "repeat-x",
                    backgroundPosition: "left 0px",
                    color: "#333333",
                    padding: "0px",
                    height: "61px"
                }
                );                
            }
            );
});
$(document).ready(
    function()
    {
        //круглые края
        jQuery.each($(".round_border"), function()
        {
            var htmlStr = $(this).html();
            var width = $(this).css('width');
            var height = $(this).css('height');
            $(this).empty();
            $(this).append("<div class='round_border_div5'><div class='round_border_div6'><div class='round_border_div7'><div class='round_border_div8'><div class='round_border_div1'><div class='round_border_div2'><div class='round_border_div3'><div class='round_border_div4' style='width:" + width + "; height: " + height + ";'>" + htmlStr + "</div></div></div></div></div></div></div></div>");
        }
        );

        //задать вопрос        
        $("#various1").fancybox({
            'titlePosition'		: 'inside',
            'transitionIn'		: 'none',
            'transitionOut'		: 'none'
        });

        //калькулятор      
        $("#various2").fancybox({
            'titlePosition'		: 'inside',
            'transitionIn'		: 'none',
            'transitionOut'		: 'none'
        });
        //видео
        $("a#video").fancybox({
            'titleShow'     : false
        });
        //слайдер
        $( "#image_slider" ).accessNews({
            headline : "1",
            speed : "normal",
            slideBy : 1,
            slideShow : 3
        }, '');        
        $( "#image_slider0" ).accessNews({
            headline : "1",
            speed : "normal",
            slideBy : 1
        }, '0');
        $( "#image_slider1" ).accessNews({
            headline : "1",
            speed : "normal",
            slideBy : 1
        }, '1');
        $( "#image_slider2" ).accessNews({
            headline : "1",
            speed : "normal",
            slideBy : 1
        }, '2');
        $( "#image_slider3" ).accessNews({
            headline : "1",
            speed : "normal",
            slideBy : 1
        }, '3');
        $( "#image_slider4" ).accessNews({
            headline : "1",
            speed : "normal",
            slideBy : 1
        }, '4');
//---------------alex
img_slider();
$("a.fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	200, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
                'hideOnContentClick': true,
                'overlayOpacity': 0.3,
'showCloseButton': false
	}); 
$("a.fancy2").fancybox(); 
    }
    );
function changePhoto(src)
{
    if( $("#photo").attr("src") == src )
        return false;
    $("#photo_container").fadeOut("slow",
        function () {
            $("#photo").attr("src", src);
        });
    $("#photo_container").fadeIn("slow");
    return false;
}
function sendAsk()
{    
    $.fancybox.showActivity();   
    // $("#question").html("<center><img style='padding: 40%;' src='/press/img/ajax-loader.gif'></center");    
    var qString = $("#ask_form").formSerialize();
    jQuery.post("/ask.html", qString, 
        function(data) {
            $.fancybox.hideActivity();   
            $("#question").html(data);
            var isError = false;
            jQuery.each($(".error"), 
                function()
                {
                    if($(this).html() != '') 
                        isError = true;
                }
                );
            if(!isError) {               
                $("#question").html("<h2 style='padding: 15px;'>Ваш вопрос принят, спасибо</h2>");
                $("#question").css(
                {
                    height: "50px"
                }
                );

                $.fancybox.resize();
            }
        }
        );
}
function sendQuestion()
{    
    $.fancybox.showActivity();   
    var qString = $("#question_form").formSerialize();
    jQuery.post("/question.html", qString, 
        function(data) {
            $.fancybox.hideActivity();   
            $("#question").html(data);
            var isError = false;
            jQuery.each($(".error"), 
                function()
                {
                    if($(this).html() != '') 
                        isError = true;
                }
                );
            if(!isError) {               
                $("#question").html("<h2 style='padding: 15px;'>Ваше письмо отправлено, спасибо</h2>");
                $("#question").css(
                {
                    height: "50px"
                }
                );

                $.fancybox.resize();
            }
        }
        );
}
//-----------------alex
function img_slider(){$('img.switched').hide();
      $('img.switched:eq(0)').show();
      ii=0;
      $('#product_img div.mini img').click(function(){
        i = $("#product_img div.mini img").index(this);
        if(i!=ii)
        {
          $('img.switched').hide();
          $('img.switched').eq(ii).show();
          if(ii<i)
          {
            $('img.switched').eq(ii).slideUp();
            $('img.switched').eq(i).show();
          }
          else
            $('img.switched').eq(i).slideDown();
          ii = i;
        }
      });
      $("a[rel=image_group]").fancybox({
        'transitionIn'    : 'elastic',
        'transitionOut'    : 'none',
        'titlePosition'   : 'inside',
        'titleFormat'    : function(title, currentArray, currentIndex, currentOpts) {
          return '<span id="fancybox-title-over" >' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }
      });
    };

