// JavaScript Document

$(document).ready( function(){ 
							   $('.obraz').innerfade({ 
													animationtype: 'slide', 
													speed: 750, 
													timeout: 5000, 
													type: 'random', 
													containerheight: '1em' 
													}); 
							   
							   var originalBG = $(".projekt").css("background-color");
								var originalF = $(".projekt").css("color");
								$(".projekt").hover(function() {
									$(this).stop().animate({backgroundColor:"#fff7dc"}, 250);
										
									},
									function(){
												$(this).stop().animate({backgroundColor:originalBG},750)	
												});
								
								
			$('input[name=FIRM]').click(function () {
			if($(this).val()=="1")
			{
				$("#titul").html("Název firmy: <span class=\"red big\">*</span>");
				$("#ic").html("IČ: <span class=\"red big\">*</span>");
				$("#dic").html("DIČ:");
			}
			else
			{
				$("#titul").html("Titul: ");
				$("#ic").html("Jméno: <span class=\"red big\">*</span>");
				$("#dic").html("Příjmení: <span class=\"red big\">*</span>");
			}
			
			});	
			
			
			$('input[name=K_FIRM]').click(function () {
			if($(this).val()=="1")
			{
				$("#titul").html("Název firmy: <span class=\"red big\">*</span>");
				$("#ic").html("IČ: <span class=\"red big\">*</span>");
				$("#dic").html("DIČ:");
			}
			else
			{
				$("#titul").html("Titul: ");
				$("#ic").html("Jméno: <span class=\"red big\">*</span>");
				$("#dic").html("Příjmení: <span class=\"red big\">*</span>");
			}
			
			});	

		var zak_cena = Number($('#cena').text());
		$('input[name=velikost]').click(function () {
												  var cen = zak_cena + Number($(this).attr("alt"));
				$('#cena').text(cen.toFixed(2));
				//alert($(this).next('span').text());
				$("#text_ceny").text($(this).next('span').text());
				var obr = $(this).next('span').next('span').text();
				$("#vel_obr").attr({ 
							  src: "./images/velikosti/" + obr,
							  title: obr,
							  alt: obr
							});

				
				//alert('dasdas');
	});	
							 
							 
				
							   
			$("#dialog").dialog({
			bgiframe: true,
			//height:240,
			width:500,
			modal: true,
			buttons: {
				Ok: function() {
					$(this).dialog('close');
				}
			}
		});
			
 $(".carousel").jCarouselLite({
      btnNext: ".next",
      btnPrev: ".prev",
      mouseWheel: true

 });

	//$("#dodaci").hide();

	$('input[name=SD]').click(function () {
			$("#dodaci").slideToggle("slow");
			//alert("dasdas");
	});	
	
	
	$('input[name=PR]').click(function () {
			$("#prani").slideToggle("slow");
			//alert("dasdas");
	});	
	
	var celk = $('#cen').text();
	var ce = Number(celk) + Number($("#doprava option:selected").attr("title"));		   
	$('#cen').text(ce.toFixed(2));
	$('#doprava').change(function () {
						var ce = Number(celk) + Number($("#doprava option:selected").attr("title"));		   
				$('#cen').text(ce.toFixed(2));
				
			//alert();
			//alert($(this).attr("label"));
			//$("#dodaci").slideToggle("slow");
			//alert("dasdas");
	});	
	
	$('.objed').each(function() {
   		$(this).hide();
	  });

	
	$('.obj').click(function () {
				var pol = $(this).parent().parent().next();
				pol.slideToggle("slow");			  
				pol.next().slideToggle("slow");			  
			//$(this).next(".objed").slideToggle("slow");
			return false;
	});	
	
	
	$('#objednavatel').click(function () {
				$('#addr').slideToggle("slow");
				return false;
	});	
	
	$('#kontakt').click(function () {
				$('#konn').slideToggle("slow");
				return false;
	});	
	$('#detvypol').hide();
	$('#detvy').click(function () {
				$('#detvypol').slideToggle("slow");
				return false;
	});	
	
	
				   
							   
} ); 


   
  
   
