$(document).ready(function() {
	  $("#example > ul").tabs({ cookie: { expires: 1 } });
	  $("#credit_b").click(function () {
        var elem = $("[class='flatform2']");
        var key = true;
        var error_id;
        $.each(elem, function(){
            if ($(this).attr("validate") == 'true' && ($(this).attr("value") == null || $(this).attr("value") == "")){
                key = false;
            }
        });
        if(key){
          $("form#fbasketForm").attr("action", "http://rostov-don.polaris.ru/make_credit_request/1/1035.shtml");
          $("form#fbasketForm").attr("target", "_blank");
          $("form#fbasketForm").submit();
        }else{
          alert("Заполните все обязательные поля");
        }
    });
    
    $(".producerList > span").click(function () {
		$('.producer, .producerAll').removeClass("producerHl");
		$(this).addClass("producerHl");
        var producer = $(this).find("a").attr("title");
        $('.ListTable2 tr').each(function(){
			      if (($(this).attr("producer") != "pr-" + producer) && ($(this).attr("producer") != null)) $(this).hide();
			      else $(this).show();
				});
		$("span[id='producer_name']").text(producer);
		return false;
    });
    
    $(".producerAll").click(function () {
        $('.ListTable2 tr').show();
    });

	$(function(){
    	$('#folded_list #header').click(function(event){
    		var content = $(this).next('#content');
    		$(this).find('span').css('background-position-x',
    				(content.is(':hidden')) ? '-64px' : '-32px');
   			content.slideToggle('fast');
    		return false;
    	}).next('#content').hide();
    });
});
