



$(document).ready(function() {

$('.tage').hide();


$('.objekt').mouseover(function() {
									  
		Rechnen();						  
									  
});








$('.zeit').change(function(){

var sel = $("option:selected", this).text();

if (sel == 'ab 8 Tage') {
			 
	$(this).siblings('.tage').show();
	$(this).siblings('.tage').children('.day').attr('value', 8);

} else if (sel == '1-3 Tage') {
	$(this).siblings('.tage').hide();
	$(this).siblings('.tage').children('.day').attr('value', 3);
	
} else if (sel == '4-7 Tage') {
	$(this).siblings('.tage').hide();
	$(this).siblings('.tage').children('.day').attr('value', 7);
	
	}

	Rechnen();	
$('.info').text(sel);
});






function total(){

    var sum = 0.0;

    $('.objekt .zahl').each(function(){
        sum += parseFloat($(this).text());
    });

    $('#tot').find('.zahl').attr('value', sum);
} 


function Rechnen () {
	
$('.objekt').each(function(){
									 
	var i = $(this).find('.stk').val();
	var b = $(this).find('.zeit').val();
	var t = $(this).find('.day').val();
	
	var erg = b * t * i;
	
	$(this).find('.zahl').text(Math.round(erg));	
	$(this).find('.preis2').attr('value', Math.round(erg));	
	
});



total();


}



});
