$(window).load(
	function()
	{
		cards = $('.com .card');
		for(i = 0; i < cards.length; i += 4)
		{
			h1 = cards.eq(i).height();
			h2 = cards.eq(i + 1).height();
			h3 = cards.eq(i + 2).height();
			h4 = cards.eq(i + 3).height();
			h = Math.max(h1,h2,h3,h4);

			cards.eq(i).height(h);
			cards.eq(i + 1).height(h);
			cards.eq(i + 2).height(h);
			cards.eq(i + 3).height(h);
		}
		cards = $('.spec .card');
		for(i = 0; i < cards.length; i += 4)
		{
			h1 = cards.eq(i).height();
			h2 = cards.eq(i + 1).height();
			h3 = cards.eq(i + 2).height();
			h4 = cards.eq(i + 3).height();
			h = Math.max(h1,h2,h3,h4);

			cards.eq(i).height(h);
			cards.eq(i + 1).height(h);
			cards.eq(i + 2).height(h);
			cards.eq(i + 3).height(h);
		}
		cards = $('.card2 .sub');
		for(i = 0; i < cards.length; i += 2)
		{
			h1 = cards.eq(i).height();
			h2 = cards.eq(i + 1).height();			
			h = Math.max(h1,h2);
			cards.eq(i).height(h);
			cards.eq(i + 1).height(h);			
		}
	}
);    

$(document).ready(
    function()
    {
        $('#main #content #prod .image img').each(function() {
        	if($(this).attr('src') == '')
        		$(this).parent().remove();
        });
        $('#catalog .card ul li').hover(
        	function() {
        		$(this).find('img').show();
        	},
        	function() {
        		$(this).find('img').hide();
        	}
        );
        var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
        var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);
        isIe6 = (jQuery.browser.msie && (ie55 || ie6))

		if(isIe6){
			alert('Вы используете устаревшую версию браузера, сайт может выглядеть некорректно. Пожалуйста обновитесь до последнеей версии.');
		}
		else
		{
		    $('#main #ban .left').corner("round 6px left");
		    $('#main #ban .right').corner("round 6px right");
		    $('.image_border,.image_main_border').corner("round 5px").find('.image,.image_main').corner("round 5px");
			$('#main #content table').find('tr:first td, tr:first th').css('background','none');
		    $('#top ul.menu').corner("round 6px");
		    $('.round').corner("round 6px");
		    
		    var banDir = 'res/img/ban/';
		    $('#ban .left div.el').each(function() {$('#ban #imgs').append('<img src="' + banDir + $(this).attr('id') + '.jpg"/>');});
		    $('#ban .left div.el').hover(
		        function() {
		            $('#ban .left div.el').removeClass('hover');
		            $(this).addClass('hover');
		            $('#ban .right').css('background-image',"url('" + banDir + $(this).attr('id') + ".jpg')");
		        }
		    );
		    
		    $("#index_slider").accessNews({
		        headline : "1",
		        speed : "normal",
		        slideBy : 1,
		        slideShow : 2
		    }, '');
		    
		    $('#main #content #prod .image').click(function(){
		        $('#main #content #prod .image').show();
		        $(this).hide();
		        $('#main #content #prod .image_main').css('background-image', 'url("' + $(this).find('img').attr('src') + '")');
		        $('#main #content #prod .image').removeClass('image_last');
		        $('#main #content #prod .image:visible:eq(2)').addClass('image_last');
		    }); 
        }
    }
    );

