$(document).ready(function () {
    $("a.filter1").click(function(){
        if ($("#filter1").is(":hidden")) {
            $("#filter1").slideDown("slow");
	} else {
            $("#filter1").slideUp("slow");
	}
	return false;
    });
    $("a.filter2").click(function(){
        if ($("#filter2").is(":hidden")) {
            $("#filter2").slideDown("slow");
	} else {
            $("#filter2").slideUp("slow");
	}
	return false;
    });
    $('.addtocart').click (function() {
	$.add2cart( $(this).parent().parent().parent(), $('#basket') );
	$(this).parent().addClass("gray");
        $.ajax({url: $(this).attr("href").replace('/addToCart/', '/ajaxAddToCart/')+'', cache: false, success: function(html){ $("#basketContent").html(html); }});
        return false;
    });
    
    $("a.select_down1, a.select_up1").click(function(){
	    $(".select_1 .inactiv, a.select_up1").slideToggle("slow");
	  return false;
    });
	
    $(".enter, .enter_form_open").click(function(){
    	$(".enter_form_open").toggle();
    	$(".enter_form").toggle();
    });
    
    $('.addtocompare').click (function() {
        $(this).hide();
		$.add2cart( $(this).parent().parent(), $('#compareBlock') );
        $(this).parent().children('.off').show();
        $.ajax({url: $(this).attr("href").replace('/addToCompare/', '/ajaxAddToCompare/'), cache: false, success: function(html){ $("#compareBlock").html(html); }});
        return false;
    });    
    $('.delfromcompare').click (function() {
        $(this).hide();
		$.add2cart( $('#compareBlock') , $(this).parent().parent() );
        $(this).parent().children('.on').show();
        count = parseInt($("#compare_count").html())-1;
        if (count!=0) { $("#compare_count").html(count); } else { $("#compareBlock").html(''); }
        $.ajax({url: $(this).attr("href").replace('/delFromCompare/', '/ajaxDelFromCompare/'), cache: false, success: function(html){ if (count!=0) $("#compareBlock").html(html); }});
        return false;
    });   
    $(".spec_long, .desc_long").hide();
    	var banners = $(".banner_bar_outer .banner_bar").height();
	$(".banner_bar_outer .banner_bar").hide();
	if ($("#main_content").height()<banners) {
		$(".banner_bar_outer .banner_bar").height($("#main_content").height()).css({overflowY: 'scroll'});
		$(".banner_bar_outer .banner_bar .prod_item").width(170);
	}
	$(".banner_bar_outer .banner_bar").show();
	$(".infopanel.icq").mouseenter(function(){
		$(".icq_list").show();
		$(".infopanel.icq a.out").toggleClass('active', true);
		return false;
	});
	$(".infopanel.icq").mouseleave(function(){
		$(".icq_list").hide();
		$(".infopanel.icq a.out").toggleClass('active', false);
	});
		$("#basket .basket_head:not(.no_items)").mouseenter(function(){
			$(".basket_list").slideDown();
			$("#basket").toggleClass('active', true);
			return false;
		});
		$("#basket .basket_inner").mouseleave(function(){
			$(".basket_list").slideUp();
			$("#basket").toggleClass('active', false);
		});
});

