    function changeBasket(sender) {
    	$.cookie('show_basket', '1', { expires: 7, path: '/', domain: 'originalni.cz', secure: false });
    	$(sender).hide();
    	$('#cart').show();
    }
    
	var countSlides = 5;
	var currentSlide = 1;
	function nextSlideshow() {
	  $('#slideshow .pane'+currentSlide).fadeOut(150);
	  $('#point'+currentSlide).removeClass('active');
	  
	 currentSlide = currentSlide + 1;
	  
	  // pokud přesáhneme počet slidů, jeďme od začátku
	  if (currentSlide == (countSlides + 1)) {
	  	currentSlide = 1;
	  }
	  	  
	  $('#slideshow .pane'+currentSlide).fadeIn(150);
	  $('#point'+currentSlide).addClass('active');
	  
	  t = setTimeout('nextSlideshow();', 10000 );
	}
	
	function setSlideshowPane(number) {
	  //clearTimeout(t);
	  $('#slideshow .pane'+currentSlide).fadeOut(150);
	  $('#point'+currentSlide).removeClass('active');
	  
	  currentSlide = number;
	  	  
	  $('#slideshow .pane'+currentSlide).fadeIn(150);
	  $('#point'+currentSlide).addClass('active');
	  
	  t = setTimeout('nextSlideshow();', 10000 );
	  
	  return false;
	}
	

$(document).ready(function() {
   	
    function checkOrderForm() {
		if (($('input#agree').attr('checked') == true) &&
			 $('input:radio[name=gift_product]:checked').val()) {
			$('input.make_next_step').removeAttr('disabled');
			$('input.make_next_step').css('background', '#d60224');
			$('#error_condition').hide();
		} else {
			$('.make_next_step').attr('disabled', 'disabled');
			$('input.make_next_step').css('background', 'gray');
			$('#error_condition').show();
		}
    }
    
    $('input:radio[name=gift_product]').change(function() {
    	checkOrderForm();
    });

   	
	$('input#agree').change(function() {
		checkOrderForm();
	});
	
	t = setTimeout('nextSlideshow();', 5000 );
	
    // 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();
      }
    });
    
}); // jquery document ready
  
  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');

    }    
    
    var koleda_sent = 0;
    // pro vánoční akci - koleduj 2011
    function checkFormKoleduj() {
    	if (($('#koleduj_email').val() == '') || ($('#koleduj_kod').val() == '')) {
    		$('#koleduj_hlaska').html('Obě dvě pole jsou povinná.');
    	} else {
	    	if (($('#koleduj_kod').val() == 'OR0766') || ($('#koleduj_kod').val() == 'OR0076')) {
	    		$('#koleduj_hlaska').html('Váš kód vyhrává.');
	    		
	    		if (koleda_sent == 0) {
					$.post("index.php?koleda2011=1", { email: $('#koleduj_email').val(), kod: $('#koleduj_kod').val() },
						function(data) {
							//alert("Data Loaded: " + data);
							koleda_sent = 1;
						});
				}
	    	} else {
	    		$('#koleduj_hlaska').html('Váš kód bohužel nevyhrává.');
	    	}
	    }
    }
    
    var upecte_sent = 0;
    // pro akci - upecte to
    function checkFormUpecte() {
    	if (($('#upecte_email').val() == '') || ($('#upecte_kod').val() == '')) {
    		$('#upecte_hlaska').html('Obě dvě pole jsou povinná.');
    		$('#upecte_hlaska').show();
    	} else {
	    	if (($('#upecte_kod').val() == 'UPECTE 0911HP') || 
	    		($('#upecte_kod').val() == '0911HP') ||
	    		($('#upecte_kod').val() == 'UPECTE 0911DMM') ||
	    		($('#upecte_kod').val() == 'UPECTE 0911S') ||
	    		($('#upecte_kod').val() == 'UPECTE 0911V') ||
	    		($('#upecte_kod').val() == 'UPECTE 0911DMC')) {
				
				$('#upecte_hlaska').show();
				$('#inputs').hide();
				//$('#upecte_kod').hide();
//				$('#upecte_email').hide();
//				$('#upecte_submit').hide();

				$('#upecte_hlaska').html('Děkujeme za vložení Vašeho kódu, budeme Vás kontaktovat ohledně Vašeho PŘEKVAPENÍ.');
	    	
				
				
	    		if (upecte_sent == 0) {
					$.post("index.php?upecte=1", { email: $('#upecte_email').val(), kod: $('#upecte_kod').val() },
						function(data) {
							//alert("Data Loaded: " + data);
							upecte_sent = 1;
						});
				}
	    	} else {
	    		$('#upecte_hlaska').html('Zadaný kód je nesprávný');
	    	}
	    }
    }
  
