  $(document).ready(function() {
       $('input#agree').change(function() {
	if ($('input#agree').attr('checked') == true) {
                $('input.make_next_step').removeAttr('disabled');
                $('input.make_next_step').css('background', '#d60224');
	} else {
		$('.make_next_step').attr('disabled', 'disabled');
                $('input.make_next_step').css('background', 'gray');
	}

    })

	  
	  
    // nastaveni textu pro odkazy
    var showText="zobrazit vyhledávání";
    var hideText="skrýt vyhledávání";
  
    $('a.skryvaciodkaz').html(hideText);
  
    // na odkazy navaze funkci
    $('a.skryvaciodkaz').click(function() {
    	
      if ($(this).html()==showText) { // zobrazit
        $(this).html(hideText);
        $('.skryvaci').slideDown('fast');
        $('#products_filter_title').css('border-bottom', '1px solid #afb3bf');
      } else { // skryt
        $(this).html(showText);
        $('.skryvaci').slideUp('fast');
        $('#products_filter_title').css('border', '0px');
      }
      return false; // odkazy nikam nevedou
    });
    
    $('#pagination').change(function(){
    	$('form#pagination_form').submit();
    });

    $('#pagination_select_bottom').change(function(){
    	$('form#pagination_bottom_form').submit();
    });
    
    
    $('a.del_basket').click(function(){
    	return(confirm('Opravdu si přejete tento produkt odstranit z košíku?'));
    });
    
    
    $('#poptavka').submit(function(){
    	if ($('#name').val() == '' || $('#firm').val() == '' || $('#mail').val() == '' || $('#message').val() == '' || $('#kod').val() == '')
    	{
    		alert('Vyplňte, prosím, všechny údaje.');
    		return false;
    	} else {
    		return true;
    	}
    });

    $('input#agency_checkbox').change(function() {
	if ($('input#agency_checkbox').attr('checked') == true) {
 		$('#agency_info').css("display", "block");
	} else {
		$('#agency_info').css("display", "none");
	}

    });
    


    $('.category_color img').click(function() {
     $('.category_color img').parent().css({border:'1px solid #aaaaaa' , margin : '2px 3px 0 0px'});
     if ($(this).parent().attr('id') == $('#search_color').val())
      {
       $('#search_color').val('');
       if ($('#products_title').val()) $('#search_form').submit();
      } else {
        $('#' + $(this).parent().attr('id')).css({border:'3px solid darkred' , margin : '0px 1px 0 -2px'});
        $('#search_color').val($(this).parent().attr('id'));
        if ($('#products_title').val() != '') $('#search_form').submit();
        $('#search_form').submit();
      }
    });

    
    
    
    
  });
  
  function combinations(id) {
      $("#price_final").text(value_dph[document.getElementById('combination_id').options[document.getElementById('combination_id').selectedIndex].value]);
      $("#product_number").text(product_number[document.getElementById('combination_id').options[document.getElementById('combination_id').selectedIndex].value]);
      $("#stock").text(stock[document.getElementById('combination_id').options[document.getElementById('combination_id').selectedIndex].value]);

      if (discount == '1') $("#price_agency").text(value_original[document.getElementById('combination_id').options[document.getElementById('combination_id').selectedIndex].value]);

      for (var key in combinations_ids) {
        $("#big_product_" + combinations_ids[key]).removeClass("display");


        $("#big_product_" + combinations_ids[key]).css('display', 'none');
      }
      $("#big_product_" + id).css('display', 'inline');

    }  
  