$(document).ready(function() {
    // карта Миасс
    $(".click-map").click(function(){
        $('.pl').toggle();
    });
    $(".map-close").click(function(){
        $('.pl').hide();
    });

    // высота плашки
    var h = $('#middle').height();
    $('.cabinet').height(h+73);

    if (($.browser.msie) && ($.browser.version == '9.0' || $.browser.version == '8.0')) {
        $('.header-table').css ('width','99%');
    }
    if($.browser.safari){
        $('.header-table').css ('width','99%');
    }
    
    if(showShkaff==1){
        function imageresize() {
            var contentwidth = $('#wrapper').width();
            if ((contentwidth) < '1200'){
                $('.cabinet').hide();
                $('.main-in').css('padding','0 0 0 0');
                $('.content-help').css ('max-width','451px');
                $('.img-catalog2').css ('float','right');
                $('.img-catalog2').css ('margin-left','0');
            } else {
                $('.cabinet').show();
                $('.main-in').css('padding','0 0 0 201px');
                $('.content-help').css('max-width','697px');
                $('.img-catalog2').css ('float','left');
                $('.img-catalog2').css ('margin-left','66px');
            }
        }
        imageresize();
        $(window).bind("resize", function(){
            imageresize();
        });
    }else{
       $(window).bind("resize", function(){
           var contentwidth = $('#wrapper').width();
            if ((contentwidth) < '1200'){
                $('.content-help').css ('max-width','652px');
                $('.img-catalog2').css ('float','right');
                $('.img-catalog2').css ('margin-left','0');
            } else {
                $('.content-help').css('max-width','898px');
                $('.img-catalog2').css ('float','left');
                $('.img-catalog2').css ('margin-left','66px');
            }
        });
    }

    var imgw = $('.h-w').width();
    var imgh = $('.h-w').height();
    $('.h-w').hover (

        function(){

            $(this).width(imgw/0.88);
            $(this).height(imgh/0.88);
            $(this).css('margin-left','0px')

        },
        function(){

            $(this).width(imgw);
            $(this).height(imgh);
            $(this).css('margin-left','0')

        });

    $('.test').hover (
		
        function(){
			
			
            $(this).children('.popup').show();
            $(this).children('.test-a').addClass('active');
			
            var elements = $('.menu li');
	
	  
            $.each(elements, function(){
                var w = $(this).children().children().children('.center').width();
                $(this).find('.top-center').width(w-10);
                $(this).find('.bottom-center').width(w-10);
                $(this).find('.ie').width(w);
		    
            });
			
        },
        function(){
            $(this).children('.test-a').removeClass('active');
            $(this).children('.popup').hide();
        });
		
});

function searchFocus(){
    var search = $('#search-in');
    if(search.val()=='Найти...'){
        search.val('');
    }
}
function searchBlur(){
    var search = $('#search-in');
    if(search.val()==''){
        search.val('Найти...');
    }
}
function catRedirect(){
    var id = $('#product-in').val();
    //alert(id);
    document.location = "?action=catRedirect&id=" + id + "";
}

     


