
$(document).ready( function() {
   $("#price-disp").addClass('hide');
	    $("#mode1").click( function () {
		
		$(".butt_calc img").show();
		
		$(".butt_calc img").click(
		function () {
			$("#price2").val(0);
			$("#price").val(0);
			var tableOfValues = [
						[7, 10, 12, 15, 15, 20], 
						[14, 20, 24, 30, 30, 40],
						[7, 10, 12, 15, 15, 20],
						[21, 30, 36, 45, 45, 60],
						[97, 117, 140, 135, 150, 165],
						[14, 20, 24, 30, 30, 40],
						[21, 30, 36, 45, 45, 60],
						[7, 10, 12, 15, 15, 20],
						[14, 20, 24, 30, 30, 40]
						];
			
			rabota = parseInt($("#autos div.active").attr("name"));
			col = parseInt($("#autos div.active").attr("title"));
			row = parseInt($("#types li.active").attr("value"));
			
			sum = tableOfValues [row] [col];
			
			total = rabota+sum;
			sum = total*1000;
			
			
		$("#price2").val(sum);
		
		});
       }); 
	   


//--------------------------------------------------------------//	     

   $("#mode2").click( function () {
				$("#autos div").removeClass('active');
				$("#price-disp").removeClass('hide');
				$(".butt_calc img").hide();
	sum=0;
	
	$("#price2").val(0);
		
		$("#drop-down-menu input").click(
        function () {
                var ntot = 0;
                $("#drop-down-menu input:checked").each(function () {
				$("#price-disp").removeClass('hide');
			
	var tableOfValues = [[5, 8, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 8, 1, 1, 5], 
						[6.5, 9.5, 4.5, 4.5, 4.5, 5.5, 5.5, 5.5, 5.5, 7.5, 7.5, 6.5, 9.5, 2.5, 2.5, 6.5],
						[5, 8, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 8, 1, 1, 5], 
						[8, 12, 4, 4, 4, 5, 5, 5, 5, 10, 10, 8, 12, 2, 2, 10],
						[16, 24, 8, 8, 8, 10, 10, 10, 10, 20, 20, 16, 24, 4, 4, 20],
						[6.5, 9.5, 4.5, 4.5, 4.5, 5.5, 5.5, 5.5, 5.5, 7.5,7.5, 6.5, 9.5, 2.5, 2.5, 6.5],
						[8, 12, 4, 4, 4, 5, 5, 5, 5, 10, 10, 8, 12, 2, 2, 10],
						[5, 8, 3, 3, 3, 4, 4, 4, 4, 6, 6, 5, 8, 1, 1, 5], 
						[6.5, 9.5, 4.5, 4.5, 4.5, 5.5, 5.5, 5.5, 5.5, 7.5,7.5, 6.5, 9.5, 2.5, 2.5, 6.5]
						];
			col = parseInt($(this).val());
			
			row = parseInt($("#types li.active").attr("value"));
			
			
			sum = tableOfValues [row] [col];
				
                        ntot += sum;
						
                });
                				
				sum = ntot*1000;
				$("#price2").val(sum);
				
        })
        .change();
	 
	 $("#types li").click(
        function () {
			$("#drop-down-menu input:checked").click();
			$("#price2").val(0);
		});
       });

$(".butt_calc img").click(function () {	   
	$("#price-disp").removeClass('hide');
});
$("#types li").click(function () {	  	    
	$("#price-disp").addClass('hide');
	sum=0;
	$("#price").val(0);
	$("#price2").val(0);
});

});



