function dateDiff(date1,date2,interval) { 
    var second=1000, minute=second*60, hour=minute*60, day=hour*24, week=day*7; 
    date1 = new Date(date1);
    date2 = new Date(date2); 
    var timediff = date2 - date1; 
    if (isNaN(timediff)) return NaN; 
    switch (interval) { 
        case "years": return date2.getFullYear() - date1.getFullYear(); 
        case "months": return ( 
            ( date2.getFullYear() * 12 + date2.getMonth() ) 
            - 
            ( date1.getFullYear() * 12 + date1.getMonth() ) 
        ); 
        case "weeks"  : return Math.floor(timediff / week); 
        case "days"   : return Math.floor(timediff / day);  
        case "hours"  : return Math.floor(timediff / hour);  
        case "minutes": return Math.floor(timediff / minute); 
        case "seconds": return Math.floor(timediff / second); 
        default: return undefined; 
    } 
} 

function priceCalculation () {
		noOfDays = dateDiff($('#el_14').datepicker("getDate"), $('#el_17').datepicker("getDate"),"days");
		price = 0;
		price += $('#el_22').val() * 60 * noOfDays;
		price += $('#el_23').val() * 65 * noOfDays;
		price += $('#el_24').val() * 73 * noOfDays;
		price += $('#el_25').val() * 90 * noOfDays;
		price += $('#el_26').val() * 95 * noOfDays;
		price += $('#el_27').val() * 100 * noOfDays;
		
		if ($('#el_30').val() == "Ja") {
			price += 6; 
		}
		//$('.pricecalc').html('Anzahl der &Uuml;bernachtungen: <b>'+noOfDays+'</b><br>Preis: <b>'+price+',- Euro</b>');
		if (noOfDays > 0) {
			$('#el_34').val(noOfDays);  	
			$('#el_35').val(price+',- Euro');
		} else {
			$('#el_34').val("-");
			$('#el_35').val("-");
		}
}


$(document).ready(function() {
  $('#el_22').change(function() { priceCalculation();	});
  $('#el_23').change(function() { priceCalculation();	});
  $('#el_24').change(function() { priceCalculation();	});
  $('#el_25').change(function() { priceCalculation();	});
  $('#el_26').change(function() { priceCalculation();	});
  $('#el_27').change(function() { priceCalculation();	});
  $('#el_30').change(function() { priceCalculation();	});
  $('#el_14').change(function() { priceCalculation();	});
  $('#el_17').change(function() { priceCalculation();	});
  $("#el_34").attr("disabled", "disabled");
  $("#el_35").attr("disabled", "disabled");
});
