$(document).ready(function(){

// vertikální centrovani obrazku
    $(".pl_img img").each(function(){
      var h = 0;
      h = $(this).height();
      var $newmargin = (124 - h)/2;
      //$(this).css("margin-top", $newmargin + "px");
   	});

	// nas kod
//  $("#muj_odstavec").hide(1000);
//  $("#muj_odstavec").show(3000); 
    //var coJeVybrano = $("#item_select option:selected").val();
    //$("p").text(coJeVybrano);
    
    $("#item_select").change(function(){
           var coJeVybrano = $("#item_select option:selected").val();
           $("#hodnota").text(coJeVybrano);
      });
    $("#odkaz").click(function(){
       $("#item_select").addOption("4", "item4", false);
        var $newvyrobce =  $("#novy_vyrobce").val();
        //var $newvyrobce =  $("input[@name=novy_vyrobce]").val(); ma fungovat ale nefuguje:-(
        $.get("/pecha/jquery/ajax/stranka.php",{ vyrobce: $newvyrobce}, function(vystup){
           alert("Soubor vrátil: " + vystup);
          // $("#select").html(vystup);
           //vystup;
            });
      });
      
    $("#odkaz2").click(function(){
       $("#item_select").addOption("4", "item4", false); // pouze přidá položku seznamu viz soubor select.js
      });

    $("#pridej").click(function(){
       $("#vyrobce").html("<input type=\"text\" name=\"novy_vyrobce\" id=\"novy_vyrobce\" />");
      });      
          
});

$(document).ready(function(){
/*
		var margin = 0;			
		margin =  $(".img").height();
		$(this).css("margin-top", (124 - margin)/2 + "px");
		
*/


    $("#kpokladne").html("<img src=\"templates/zahradnik/buttons/czech/button_checkout.gif\" />");
    $("#schovany").hide();
    $("#shipping_adress_skryvany").hide();
    $("#acountboxyes").hide();
    $("#new_adress").hide();
    
      $("#kpokladne").click(function(){
          $("#schovany").show();
          return false;
      });
      
      
      // zobrazi a skryje tabulku pro zadani jine dodaci adresy
      $("#row").click(function(){
          //$("#create_account3_loginbox").toggle(500);
          $("#shipping_adress_skryvany").toggle();
      });
      // zobrazi a skryje pole pro zadání hesla     
      $("#createaccount").click(function(){      
          $("#acountboxyes").toggle();
      }); 
      
       $("#prazdny").click(function(){
          //$("#create_account3_loginbox").toggle(500);
          $("#new_adress").toggle();
          $("#adresar").toggle();
      });     
     
    
    if ( $("input[name=shipping]:checked").val() == "flat_flat") {
    //alert("Soubor vrátil: " + $str);
    $("#cod").hide();
    $("#moneyorder").hide();
    $("#cop").show();
    $("#radcop").attr("checked", "checked"); 

    }
    
        if ( $("input[name=shipping]:checked").val() == "table_table") {
        $("#cod").show();
        $("#moneyorder").show();
        $("#cop").hide();
        $("#radcod").attr("checked", "checked"); 
    }

  $(".shipping").click(function(){
    $str = $("input[name=shipping]:checked").val();
   
    
    if ( $("input[name=shipping]:checked").val() == "flat_flat") {
    //alert("Soubor vrátil: " + $str);
    $("#cod").hide();
    $("#moneyorder").hide();
    $("#cop").show();
    $("#radcop").attr("checked", "checked"); 

    }
    
    if ( $("input[name=shipping]:checked").val() == "table_table") {
        $("#cod").show();
        $("#moneyorder").show();
        $("#cop").hide();
        $("#radcod").attr("checked", "checked"); 
    }
        
  });
  
   $(".katleft").each(function(){
		var height = 0;			
		$(".pl_name", this).each(function(){
			$(this).css("height", "auto");
			height = this.offsetHeight > height ? this.offsetHeight : height;			
		}).each(function(){
			$(this).css("height", height + "px");
		
		});		
	}); 

   $(".katleft").each(function(){
		var height = 0;			
		$(".pl_popisek", this).each(function(){
			$(this).css("height", "auto");
			height = this.offsetHeight > height ? this.offsetHeight : height;			
		}).each(function(){
			$(this).css("height", height + "px");
		
		});		
	}); 

   $(".katleft").each(function(){
		var height = 0;			
		$(".pl_li", this).each(function(){
			$(this).css("height", "auto");
			height = this.offsetHeight > height ? this.offsetHeight : height;			
		}).each(function(){
			$(this).css("height", height + "px");
		
		});
	}); 	

 	
  


});