$(document).ready(function(){
	  $("#calc").submit(function(event){
		event.preventDefault();
		    var prices = new Array(6)
		    prices[1] = 600;
		    prices[2] = 900;
		    prices[3] = 1000;
		    prices[4] = 1250;
		    prices[5] = 1450;
		    prices[6] = 1550;
		    
		    var width = $("#cwidth option:selected").attr("value");
		    width = parseInt(width);
		   
		    if(width < 1 || width > 6)
		    {
			    alert("Nebyla zadána šířka nebo byla zadána chybně!");
		    }
		    else
		    {
			    var price = prices[width];
			    var count = $("#ccount").attr("value");
			    count = parseInt(count);
			   // alert(count);
			    if(!count)
			    {
				    alert("Nebyl zadán počet m2!");
			    }
			    else
			    {
				    total = count * price;
				    $("#calc_result").html("<span>Vaše cena: </span><span id=\"tot_price\">"+total+" Kč </span><p>Cena obsahuje veškerý materiál, dopravu a  práci. <a href='kontakty'> Objednejte si vaše zateplení ještě dnes.</a></p>");
			    }
		    }

	  });
});

